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

Ajout d'un "popup" de confirmation

On vérifie que l'utilisateur a conscience de ce qu'il fait lorsqu'il
supprime un flux ou vide une catégorie
Marien Fressinaud 12 лет назад
Родитель
Сommit
c06aede546

+ 2 - 0
app/i18n/en.php

@@ -214,6 +214,8 @@ return array (
 	'forbidden_access'		=> 'Forbidden access',
 	'forbidden_access'		=> 'Forbidden access',
 	'forbidden_access_description'	=> 'Access is password protected, please <a class="signin" href="#">sign in</a> to read your feeds.',
 	'forbidden_access_description'	=> 'Access is password protected, please <a class="signin" href="#">sign in</a> to read your feeds.',
 
 
+	'confirm_action'		=> 'Are you sure you want perform this action? It cannot be canceled!',
+
 	// DATE
 	// DATE
 	'january'			=> 'january',
 	'january'			=> 'january',
 	'february'			=> 'february',
 	'february'			=> 'february',

+ 2 - 0
app/i18n/fr.php

@@ -214,6 +214,8 @@ return array (
 	'forbidden_access'		=> 'Accès interdit',
 	'forbidden_access'		=> 'Accès interdit',
 	'forbidden_access_description'	=> 'L’accès est protégé par un mot de passe, veuillez <a class="signin" href="#">vous connecter</a> pour accéder aux flux.',
 	'forbidden_access_description'	=> 'L’accès est protégé par un mot de passe, veuillez <a class="signin" href="#">vous connecter</a> pour accéder aux flux.',
 
 
+	'confirm_action'		=> 'Êtes-vous sûr de vouloir continuer ? Cette action ne peut être annulée !',
+
 	// DATE
 	// DATE
 	'january'			=> 'janvier',
 	'january'			=> 'janvier',
 	'february'			=> 'février',
 	'february'			=> 'février',

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

@@ -15,7 +15,7 @@
 			</label>
 			</label>
 			<div class="group-controls">
 			<div class="group-controls">
 				<input type="text" id="cat_<?php echo $cat->id (); ?>" name="categories[]" value="<?php echo $cat->name (); ?>" />
 				<input type="text" id="cat_<?php echo $cat->id (); ?>" name="categories[]" value="<?php echo $cat->name (); ?>" />
-				<a href="<?php echo _url ('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"><?php echo Translate::t ('ask_empty'); ?></a> (<?php echo Translate::t ('number_feeds', $cat->nbFeed ()); ?>)
+				<a class="confirm" href="<?php echo _url ('feed', 'delete', 'id', $cat->id (), 'type', 'category'); ?>"><?php echo Translate::t ('ask_empty'); ?></a> (<?php echo Translate::t ('number_feeds', $cat->nbFeed ()); ?>)
 				<?php if ($cat->id () == $this->defaultCategory->id ()) { ?>
 				<?php if ($cat->id () == $this->defaultCategory->id ()) { ?>
 				<i class="icon i_help"></i> <?php echo Translate::t ('can_not_be_deleted'); ?>
 				<i class="icon i_help"></i> <?php echo Translate::t ('can_not_be_deleted'); ?>
 				<?php } ?>
 				<?php } ?>
@@ -39,3 +39,5 @@
 		</div>
 		</div>
 	</form>
 	</form>
 </div>
 </div>
+
+<?php $this->renderHelper ('confirm_action_script'); ?>

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

@@ -106,11 +106,14 @@
 		<div class="form-group form-actions">
 		<div class="form-group form-actions">
 			<div class="group-controls">
 			<div class="group-controls">
 				<button class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
 				<button class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
-				<button class="btn btn-attention" formaction="<?php echo Url::display (array ('c' => 'feed', 'a' => 'delete', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Translate::t ('delete'); ?></button>
+				<button class="btn btn-attention confirm" formaction="<?php echo Url::display (array ('c' => 'feed', 'a' => 'delete', 'params' => array ('id' => $this->flux->id ()))); ?>"><?php echo Translate::t ('delete'); ?></button>
 			</div>
 			</div>
 		</div>
 		</div>
 	</form>
 	</form>
 </div>
 </div>
+
+<?php $this->renderHelper ('confirm_action_script'); ?>
+
 <?php } else { ?>
 <?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>
 <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 } ?>
 <?php } ?>

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

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