2 'libs/text!./templates/restoreDialog.html',
 
   5 'libs/jquery-1.9.1.min'
 
   6 ], function(restoreDialogTemplate, _, Backbone, $) {
 
   8     var DialogView = Backbone.View.extend({
 
   9         template: _.template(restoreDialogTemplate),
 
  11             'click .restore-btn': 'onSave',
 
  12             'click .cancel-btn': 'close',
 
  13             'click .close': 'close'
 
  15         initialize: function() {
 
  17             this.actionsDisabled = false;
 
  20             this.setElement(this.template());
 
  21             this.$el.modal({backdrop: 'static'});
 
  22             this.$el.modal('show');
 
  23             this.$('textarea').focus();
 
  28             this.trigger('restore', {
 
  29                 data: {description: view.$el.find('textarea').val()},
 
  30                 success: function() { view.actionsDisabled = false; view.close(); },
 
  31                 error: function() { view.actionsDisabled = false; view.close(); },
 
  37             if(!this.actionsDisabled) {
 
  38                 this.$el.modal('hide');
 
  42         toggleButtons: function(toggle) {
 
  43             this.$('.btn, button').toggleClass('disabled', !toggle);
 
  44             this.$('textarea').attr('disabled', !toggle);
 
  45             this.actionsDisabled = !toggle;
 
  51             return new DialogView();