Explorar el Código

Déplacement de confirm_action_script

Ce script a été intégré à main.js pour être certain que JQuery est
chargé au moment de l'initialisation

Voir commentaires commit c06aede546514aa35ab5369575f15710b30a2a23
Marien Fressinaud hace 12 años
padre
commit
1de8218182

+ 0 - 2
app/views/configure/categorize.phtml

@@ -45,5 +45,3 @@
 		</div>
 	</form>
 </div>
-
-<?php $this->renderHelper ('confirm_action_script'); ?>

+ 0 - 2
app/views/configure/feed.phtml

@@ -111,8 +111,6 @@
 	</form>
 </div>
 
-<?php $this->renderHelper ('confirm_action_script'); ?>
-
 <?php } else { ?>
 <div class="alert alert-warn"><span class="alert-head"><?php echo Translate::t ('no_selected_feed'); ?></span> <?php echo Translate::t ('think_to_add'); ?></div>
 <?php } ?>

+ 0 - 5
app/views/helpers/confirm_action_script.phtml

@@ -1,5 +0,0 @@
-<script type="text/javascript">
-    $('.confirm').click(function () {
-        return confirm("<?php echo Translate::t('confirm_action'); ?>");
-    });
-</script>

+ 4 - 2
app/views/helpers/javascript_vars.phtml

@@ -17,7 +17,7 @@
 			'go_website:"', $s['go_website'], '",',
 			'prev_entry:"', $s['prev_entry'], '",',
 			'next_entry:"', $s['next_entry'], '"',
-		"},";
+		"},\n";
 
 	$mail = Session::param ('mail', 'null');
 	if ($mail != 'null') {
@@ -29,4 +29,6 @@
 		'url_logout="', _url ('index', 'logout'), '",',
 		'current_user_mail=', $mail, ",\n";
 
-	echo 'load_shortcuts=', Request::controllerName () === 'index' && Request::actionName () === 'index' ? 'true' : 'false', ";\n";
+	echo 'load_shortcuts=', Request::controllerName () === 'index' && Request::actionName () === 'index' ? 'true' : 'false', ",\n";
+
+	echo 'str_confirmation="', Translate::t('confirm_action'), '"', ";\n";

+ 7 - 0
public/scripts/main.js

@@ -583,6 +583,12 @@ function init_persona() {
 }
 //</persona>
 
+function init_confirm_action() {
+	$('.confirm').click(function () {
+        return confirm(str_confirmation);
+    });
+}
+
 function init_all() {
 	if (!(window.$ && window.url_freshrss && ((!full_lazyload) || $.fn.lazyload))) {
 		if (window.console) {
@@ -606,6 +612,7 @@ function init_all() {
 	if (use_persona) {
 		init_persona();
 	}
+	init_confirm_action();
 	if (window.console) {
 		console.log('FreshRSS init done.');
 	}