| @@ 285-322 (lines=38) @@ | ||
| 282 | if (this.model.get('_is_clone')) { |
|
| 283 | this.model.destroy(); |
|
| 284 | } else { |
|
| 285 | this.remove(); |
|
| 286 | } |
|
| 287 | }, |
|
| 288 | ||
| 289 | remove: function() { |
|
| 290 | this.removeSubview('attributes-form-view'); |
|
| 291 | this.removeSubview('attributes-list-view'); |
|
| 292 | TransitionEditView.__super__.remove.call(this); |
|
| 293 | }, |
|
| 294 | ||
| 295 | renderWidget: function() { |
|
| 296 | if (!this.widget) { |
|
| 297 | var title = this.model.get('name') ? __('Edit transition') : __('Add new transition'); |
|
| 298 | if (this.model.get('_is_clone')) { |
|
| 299 | title = __('Clone transition'); |
|
| 300 | } |
|
| 301 | this.widget = new DialogWidget({ |
|
| 302 | title: title, |
|
| 303 | el: this.$el, |
|
| 304 | stateEnabled: false, |
|
| 305 | incrementalPosition: false, |
|
| 306 | dialogOptions: { |
|
| 307 | close: _.bind(this.onCancel, this), |
|
| 308 | width: 800, |
|
| 309 | modal: true |
|
| 310 | } |
|
| 311 | }); |
|
| 312 | this.widget.render(); |
|
| 313 | } else { |
|
| 314 | this.widget._adoptWidgetActions(); |
|
| 315 | } |
|
| 316 | ||
| 317 | // Disable widget submit handler and set our own instead |
|
| 318 | this.widget.form.off('submit'); |
|
| 319 | this.widget.form.validate({ |
|
| 320 | submitHandler: _.bind(this.onTransitionAdd, this), |
|
| 321 | ignore: '[type="hidden"]', |
|
| 322 | highlight: function(element) { |
|
| 323 | var tabContent = $(element).closest('.tab-pane'); |
|
| 324 | if (tabContent.is(':hidden')) { |
|
| 325 | tabContent |
|
| @@ 78-116 (lines=39) @@ | ||
| 75 | StepEditView.__super__.remove.call(this); |
|
| 76 | }, |
|
| 77 | ||
| 78 | renderTransitions: function() { |
|
| 79 | this.transitionsListView = new TransitionsListView({ |
|
| 80 | el: this.$el.find(this.options.transitionListContainerEl), |
|
| 81 | workflow: this.options.workflow, |
|
| 82 | collection: this.model.getAllowedTransitions(this.options.workflow), |
|
| 83 | stepFrom: this.model |
|
| 84 | }); |
|
| 85 | this.transitionsListView.render(); |
|
| 86 | }, |
|
| 87 | ||
| 88 | renderWidget: function() { |
|
| 89 | if (!this.widget) { |
|
| 90 | var title = this.model.get('name') ? __('Edit step') : __('Add new step'); |
|
| 91 | if (this.model.get('_is_clone')) { |
|
| 92 | title = __('Clone step'); |
|
| 93 | } |
|
| 94 | ||
| 95 | this.widget = new DialogWidget({ |
|
| 96 | title: title, |
|
| 97 | el: this.$el, |
|
| 98 | stateEnabled: false, |
|
| 99 | incrementalPosition: false, |
|
| 100 | dialogOptions: { |
|
| 101 | close: _.bind(this.onCancel, this), |
|
| 102 | width: 800, |
|
| 103 | modal: true |
|
| 104 | } |
|
| 105 | }); |
|
| 106 | this.widget.render(); |
|
| 107 | } else { |
|
| 108 | this.widget._adoptWidgetActions(); |
|
| 109 | } |
|
| 110 | ||
| 111 | // Disable widget submit handler and set our own instead |
|
| 112 | this.widget.form.off('submit'); |
|
| 113 | this.widget.form.validate({ |
|
| 114 | submitHandler: _.bind(this.onStepAdd, this), |
|
| 115 | ignore: '[type="hidden"]', |
|
| 116 | highlight: function(element) { |
|
| 117 | var tabContent = $(element).closest('.tab-pane'); |
|
| 118 | if (tabContent.is(':hidden')) { |
|
| 119 | tabContent |
|