Skip to content

Commit 0980d23

Browse files
committed
add confirm to comment delete button, fixes #225
1 parent 328362a commit 0980d23

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

action.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -1183,14 +1183,18 @@ protected function showButton($cid, $label, $act, $jump = false)
11831183

11841184
$anchor = ($jump ? '#discussion__comment_form' : '');
11851185

1186+
$submitClass = '';
1187+
if($act === 'delete') {
1188+
$submitClass = ' dcs_confirmdelete';
1189+
}
11861190
?>
11871191
<form class="button discussion__<?php echo $act ?>" method="get" action="<?php echo script() . $anchor ?>">
11881192
<div class="no">
11891193
<input type="hidden" name="id" value="<?php echo $ID ?>"/>
11901194
<input type="hidden" name="do" value="show"/>
11911195
<input type="hidden" name="comment" value="<?php echo $act ?>"/>
11921196
<input type="hidden" name="cid" value="<?php echo $cid ?>"/>
1193-
<input type="submit" value="<?php echo $label ?>" class="button" title="<?php echo $label ?>"/>
1197+
<input type="submit" value="<?php echo $label ?>" class="button<?php echo $submitClass ?>" title="<?php echo $label ?>"/>
11941198
</div>
11951199
</form>
11961200
<?php

lang/en/lang.php

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
* @author Esther Brunner <[email protected]>
77
* @author iDo <[email protected]>
88
*/
9-
9+
1010
// settings must be present and set appropriately for the language
1111
$lang['encoding'] = 'utf-8';
1212
$lang['direction'] = 'ltr';
13-
13+
1414
// for admin plugins, the menu prompt to be displayed in the admin menu
1515
// if set here, the plugin doesn't need to override the getMenuText() method
16-
$lang['menu'] = 'Moderate Discussions';
16+
$lang['menu'] = 'Moderate Discussions';
1717

1818
$lang['discussion'] = 'Discussion';
1919
$lang['comment'] = 'Comment';
@@ -47,5 +47,4 @@
4747
$lang['replies'] = 'Replies';
4848
$lang['newthread'] = 'New discussion page';
4949
$lang['toggle_display'] = 'Hide/Show';
50-
51-
//Setup VIM: ex: et ts=2 enc=utf-8 :
50+
$lang['js']['confirmdelete'] = 'Are you sure you want to delete this comment and its replies?';

script.js

+5
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ jQuery(function () {
9494
return validate(this);
9595
});
9696

97+
//confirm delete actions
98+
jQuery('input.dcs_confirmdelete').on('click', function () {
99+
return confirm(LANG.plugins.discussion.confirmdelete);
100+
});
101+
97102
// toggle section visibility
98103
jQuery('#discussion__btn_toggle_visibility').on('click', function () {
99104
jQuery('#comment_wrapper').toggle();

0 commit comments

Comments
 (0)