Skip to content

Commit

Permalink
confirm before destroying questions
Browse files Browse the repository at this point in the history
  • Loading branch information
luniki committed Feb 7, 2013
1 parent f13464a commit e77cfaf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion app/views/questions/_show_controls.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
<?= \STUDIP\LinkButton::create(_("Ändern"), $controller->url_for('questions/edit', $id)) ?>

<!-- DELETE -->
<form action="<?= $controller->url_for('questions/destroy', $id) ?>" method="POST">
<form class="questions-destroy"
action="<?= $controller->url_for('questions/destroy', $id) ?>"
method="POST"
data-confirm="<?= ("Wollen Sie die Frage wirklich löschen?") ?>">
<?= \STUDIP\Button::create(_("Löschen")) ?>
</form>

Expand Down
11 changes: 8 additions & 3 deletions assets/js/views/questions_show.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ define [

class QuestionView extends Backbone.View
events:
#"click .fullscreen": "showFS"
"click .appeal.start button": "startQuestion"
"click a.qr": "showQRCode"
# "click .fullscreen": "showFS"
"click .appeal.start button": "startQuestion"
"click a.qr": "showQRCode"
"submit form.questions-destroy": "confirmDestroy"

###
showFS: ->
Expand Down Expand Up @@ -49,3 +50,7 @@ define [
# do not show code, handle this on your own
event.preventDefault()
@$(".question").toggleClass "qr-visible"

confirmDestroy: (event) ->
unless confirm $(event.target).data "confirm"
event.preventDefault()
9 changes: 8 additions & 1 deletion assets/js/views/questions_show.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e77cfaf

Please sign in to comment.