1 define(function(require) {
7 var $ = require('libs/jquery'),
8 _ = require('libs/underscore'),
9 documentElement = require('modules/documentCanvas/canvas/documentElement'),
10 Dialog = require('views/dialog/dialog');
13 var choiceBase = Object.create(documentElement.DocumentNodeElement.prototype);
14 _.extend(choiceBase, {
17 documentElement.DocumentNodeElement.prototype.init.call(this);
18 this.x = $('<div class="edumed-exercise-remove btn btn-mini btn-danger">x</div>');
19 this.x.on('click', function() {
20 var dialog = Dialog.create({
21 title: 'Removing exercise',
22 text: gettext('Do you really want to remove this exercise?'),
23 executeButtonText: gettext('Yes'),
24 cancelButtonText: gettext('No, don\'t do anything!')
26 dialog.on('execute', function(event) {
27 el.canvas.wlxmlDocument.transaction(function() {
28 el.wlxmlNode.detach();
31 description: gettext('Removing exercise')
42 this.addWidget(this.x);