Просмотр исходного кода

More explicit message when deleting feeds or cats

Introduce "data-str-confirm" to override default message for confirm actions.

Fix https://github.com/marienfressinaud/FreshRSS/issues/625
Marien Fressinaud 11 лет назад
Родитель
Сommit
bcb1e3750a

+ 1 - 0
app/i18n/en.php

@@ -368,6 +368,7 @@ return array (
 	'login_required'		=> 'Login required:',
 
 	'confirm_action'		=> 'Are you sure you want to perform this action? It cannot be cancelled!',
+	'confirm_action_feed_cat'	=> 'Are you sure you want to perform this action? You may lost related favorites and user queries. It cannot be cancelled!',
 	'notif_title_new_articles'	=> 'FreshRSS: new articles!',
 	'notif_body_new_articles'	=> 'There are \d new articles to read on FreshRSS.',
 

+ 1 - 0
app/i18n/fr.php

@@ -368,6 +368,7 @@ return array (
 	'login_required'		=> 'Accès protégé par mot de passe :',
 
 	'confirm_action'		=> 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !',
+	'confirm_action_feed_cat'	=> 'Êtes-vous sûr(e) de vouloir continuer ? Vous pourriez perdre les favoris et les filtres associés. Cette action ne peut être annulée !',
 	'notif_title_new_articles'	=> 'FreshRSS : nouveaux articles !',
 	'notif_body_new_articles'	=> 'Il y a \d nouveaux articles à lire sur FreshRSS.',
 

+ 4 - 1
app/views/configure/categorize.phtml

@@ -21,7 +21,10 @@
 					<a class="btn" href="<?php echo _url('index', 'index', 'get', 'c_' . $cat->id ()); ?>">
 						<?php echo _i('link'); ?>
 					</a>
-					<button type="submit" class="btn btn-attention confirm" formaction="<?php echo _url ('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"><?php echo Minz_Translate::t ('ask_empty'); ?></button>
+					<button formaction="<?php echo _url('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"
+					        class="btn btn-attention confirm"
+					        data-str-confirm="<?php echo _t('confirm_action_feed_cat'); ?>"
+					        type="submit"><?php echo _t('ask_empty'); ?></button>
 					<?php } ?>
 				</div>
 				(<?php echo Minz_Translate::t ('number_feeds', $cat->nbFeed ()); ?>)

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

@@ -79,8 +79,11 @@
 		</div>
 		<div class="form-group form-actions">
 			<div class="group-controls">
-				<button class="btn btn-important"><?php echo Minz_Translate::t ('save'); ?></button>
-				<button class="btn btn-attention confirm" formmethod="post" formaction="<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'delete', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Minz_Translate::t ('delete'); ?></button>
+				<button class="btn btn-important"><?php echo _t('save'); ?></button>
+				<button class="btn btn-attention confirm"
+				        data-str-confirm="<?php echo _t('confirm_action_feed_cat'); ?>"
+				        formaction="<?php echo _url('feed', 'delete', 'id', $this->flux->id ()); ?>"
+				        formmethod="post"><?php echo _t('delete'); ?></button>
 			</div>
 		</div>
 

+ 1 - 1
app/views/helpers/javascript_vars.phtml

@@ -51,7 +51,7 @@ echo 'authType="', $authType, '",',
 	'url_login="', _url ('index', 'login'), '",',
 	'url_logout="', _url ('index', 'logout'), '",';
 
-echo 'str_confirmation="', Minz_Translate::t('confirm_action'), '"', ",\n";
+echo 'str_confirmation_default="', Minz_Translate::t('confirm_action'), '"', ",\n";
 echo 'str_notif_title_articles="', Minz_Translate::t('notif_title_new_articles'), '"', ",\n";
 echo 'str_notif_body_articles="', Minz_Translate::t('notif_body_new_articles'), '"', ",\n";
 echo 'html5_notif_timeout=', $this->conf->html5_notif_timeout,",\n";

+ 5 - 0
p/scripts/main.js

@@ -1109,6 +1109,11 @@ function init_persona() {
 
 function init_confirm_action() {
 	$('body').on('click', '.confirm', function () {
+		var str_confirmation = $(this).attr('data-str-confirm');
+		if (!str_confirmation) {
+			str_confirmation = str_confirmation_default;
+		}
+
 		return confirm(str_confirmation);
 	});
 }