зеркало из https://github.com/mozilla/FlightDeck.git
"Save as new version" and "Update" buttons are disabled by default, and gets enabled once CodeMirror textfield is updated
This commit is contained in:
Родитель
3485617009
Коммит
d3b3b8e5eb
Двоичные данные
flightdeck/jetpack/media/img/_temp-browse-icon.png
Двоичные данные
flightdeck/jetpack/media/img/_temp-browse-icon.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 2.4 KiB |
|
@ -61,7 +61,7 @@ var CapVersionDependency = new Class({
|
|||
this.data = $H({
|
||||
version_name: this.options.name,
|
||||
versin_description: this.options.description,
|
||||
version_content: this.options.content,
|
||||
version_content: this.options.content
|
||||
});
|
||||
},
|
||||
listenToEvents: function() {
|
||||
|
@ -116,6 +116,5 @@ var CapVersionDependency = new Class({
|
|||
},
|
||||
setAsBase: $empty,
|
||||
switchToDescription: $empty,
|
||||
getName: $empty,
|
||||
|
||||
getName: $empty
|
||||
});
|
||||
|
|
|
@ -27,6 +27,7 @@ var Capability = new Class({
|
|||
//edit_url: '',
|
||||
//update_url: '',
|
||||
//version_create_url: '',
|
||||
menu_el: 'UI_Editor_Menu',
|
||||
is_dependency: false // was the Capability loaded as dependency?
|
||||
},
|
||||
/*
|
||||
|
@ -69,6 +70,16 @@ var Capability = new Class({
|
|||
this.switch_description_el.addEvent('click', this.switchToDescription.bind(this));
|
||||
}
|
||||
},
|
||||
/*
|
||||
* Method: enableMenuButtons
|
||||
*/
|
||||
enableMenuButtons: function() {
|
||||
$$('.' + this.options.menu_el + ' li').each(function(menuItem){
|
||||
if (menuItem.hasClass('disabled')){
|
||||
menuItem.removeClass('disabled');
|
||||
}
|
||||
});
|
||||
},
|
||||
/*
|
||||
* Method: switchToDescription
|
||||
*/
|
||||
|
@ -115,6 +126,7 @@ var Capability = new Class({
|
|||
this.description_el.removeEvent('change', this.boundAfterDataChanged);
|
||||
if (this.switch_description_el) {
|
||||
this.switch_description_el.getParent('li').addClass('UI_File_Modified');
|
||||
fd.enableMenuButtons();
|
||||
}
|
||||
},
|
||||
/*
|
||||
|
@ -321,19 +333,21 @@ var CapVersion = new Class({
|
|||
/*
|
||||
* Method: listenToCapabilityEvents
|
||||
*/
|
||||
listenToEvents: function() {
|
||||
listenToEvents: function() {
|
||||
this.changed = false;
|
||||
this.boundAfterDataChanged = this.afterDataChanged.bind(this);
|
||||
this.description_el.addEvent('change', this.boundAfterDataChanged);
|
||||
this.description_el.addEvent('change', function() {
|
||||
if (this.switch_description_el) {
|
||||
this.switch_description_el.getParent('li').addClass('UI_File_Modified');
|
||||
fd.enableMenuButtons();
|
||||
}
|
||||
}.bind(this));
|
||||
this.content_el.addEvent('change', this.boundAfterDataChanged);
|
||||
this.content_el.addEvent('change', function() {
|
||||
if (this.switch_content_el) {
|
||||
this.switch_content_el.getParent('li').addClass('UI_File_Modified');
|
||||
fd.enableMenuButtons();
|
||||
}
|
||||
}.bind(this));
|
||||
// adding dependencies
|
||||
|
@ -342,6 +356,7 @@ var CapVersion = new Class({
|
|||
add_dependency_action.addEvent('click', function(e) {
|
||||
e.stop();
|
||||
this.addDependencyFromInput();
|
||||
fd.enableMenuButtons();
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
|
|
|
@ -140,6 +140,7 @@ var JetVersion = new Class({
|
|||
this.manifest_el.addEvent('change', function() {
|
||||
if (this.switch_manifest_el) {
|
||||
this.switch_manifest_el.getParent('li').addClass('UI_File_Modified');
|
||||
fd.enableMenuButtons();
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<li class="UI_Editor_Menu_Button Icon_new">
|
||||
<a id="create" title="" href="#">New <span class="UI_Editor_Icon"></span></a>
|
||||
</li>
|
||||
<li class="UI_Editor_Menu_Button Icon_saveNewVersion">
|
||||
<li class="UI_Editor_Menu_Button Icon_saveNewVersion disabled">
|
||||
<a id="version_create" title="" href="#">Save new version
|
||||
<span class="UI_Editor_Icon"></span>
|
||||
</a>
|
||||
|
|
|
@ -46,6 +46,9 @@ if (!console) {
|
|||
|
||||
var FlightDeck = new Class({
|
||||
Implements: [Options],
|
||||
options: {
|
||||
menu_el: 'UI_Editor_Menu'
|
||||
},
|
||||
initialize: function() {
|
||||
this.warning = this.error = this.message = {
|
||||
'alert': function(title, message) {
|
||||
|
@ -60,4 +63,14 @@ var FlightDeck = new Class({
|
|||
hideEditors: function() {
|
||||
this.editors.each(function(ed){ ed.hide(); });
|
||||
},
|
||||
/*
|
||||
* Method: enableMenuButtons
|
||||
*/
|
||||
enableMenuButtons: function() {
|
||||
$$('.' + this.options.menu_el + ' li').each(function(menuItem){
|
||||
if (menuItem.hasClass('disabled')){
|
||||
menuItem.removeClass('disabled');
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче