X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/2978c060aed20c464c376acf47c02b91c3db19e8..e68778f27b18c21c23387d7609d825ab3a192af7:/src/editor/modules/documentHistory/restoreDialog.js diff --git a/src/editor/modules/documentHistory/restoreDialog.js b/src/editor/modules/documentHistory/restoreDialog.js deleted file mode 100644 index a05b50f..0000000 --- a/src/editor/modules/documentHistory/restoreDialog.js +++ /dev/null @@ -1,58 +0,0 @@ -define([ -'libs/text!./templates/restoreDialog.html', -'libs/underscore', -'libs/backbone' -], function(restoreDialogTemplate, _, Backbone) { - - 'use strict'; - - - var DialogView = Backbone.View.extend({ - template: _.template(restoreDialogTemplate), - events: { - 'click .restore-btn': 'onSave', - 'click .cancel-btn': 'close', - 'click .close': 'close' - }, - initialize: function() { - _.bindAll(this); - this.actionsDisabled = false; - }, - show: function() { - this.setElement(this.template()); - this.$el.modal({backdrop: 'static'}); - this.$el.modal('show'); - this.$('textarea').focus(); - }, - onSave: function(e) { - e.preventDefault(); - var view = this; - this.trigger('restore', { - data: {description: view.$el.find('textarea').val()}, - success: function() { view.actionsDisabled = false; view.close(); }, - error: function() { view.actionsDisabled = false; view.close(); }, - }); - }, - close: function(e) { - if(e) { - e.preventDefault(); - } - if(!this.actionsDisabled) { - this.$el.modal('hide'); - this.$el.remove(); - } - }, - toggleButtons: function(toggle) { - this.$('.btn, button').toggleClass('disabled', !toggle); - this.$('textarea').attr('disabled', !toggle); - this.actionsDisabled = !toggle; - } - }); - - return { - create: function() { - return new DialogView(); - } - }; - -}); \ No newline at end of file