Commit 8989f63f authored by Marcel Rieger's avatar Marcel Rieger
Browse files

Add preference titles to extensions.

parent 6863aca9
......@@ -47,7 +47,7 @@ var CodeEditorExtension = vispa.Extension.extend({
description: "The polling delay (in ms) for checking the job status",
selection:[500,1000,2000,3000]
}
});
}, {title: "Code Editor"});
//define shortcuts...not working yet!
this.setDefaultShortcuts(CodeEditorView, {
......@@ -67,7 +67,7 @@ var CodeEditorExtension = vispa.Extension.extend({
this.alert("Execute this");
}
}
});
}, {title: "Code Editor"});
this.setOptions(CodeEditorView, { //maximum five instances of code editor
maxInstances: 5
......
......@@ -29,7 +29,7 @@ var DemoExtension = vispa.Extension.extend({
description: "The background color",
selection: ["blue", "yellow", "red"]
}
});
}, {title: "Demo"});
// now we add default shortcuts
// the structure of the second argument is the same as above in
......@@ -45,7 +45,7 @@ var DemoExtension = vispa.Extension.extend({
this.alert("Instance " + this.getId() + " saved!");
}
}
});
}, {title: "Demo"});
// set options for the DemoView
this.setOptions(DemoView, {
......
......@@ -24,7 +24,7 @@ var FileExtension = vispa.Extension.extend({
description: "Select if you want to open directories or files with a single or a double click/tap.",
selection: ["single", "double"]
}
});
}, {title: "File Browser"});
var args = {
// path: "",
......
......@@ -131,6 +131,12 @@ class Server(object):
'/extensions': {
'tools.workspace.on': True
},
'/fs': {
'tools.workspace.on': True
},
'/ajax/fs': {
'tools.workspace.on': True
},
'/static': {
'tools.db.on': False,
'tools.user.on': False,
......
......@@ -239,7 +239,7 @@ var ExtensionManager = VispaModule.extend({
var defaultShortcuts = extension.getDefaultShortcuts(viewClass) || {};
instanceShortcuts = this.extensionShortcuts[observableName] || {};
vispa.parsePreferences(instanceShortcuts, defaultShortcuts);
var settings = {
var settings = $.extend(true, {
type: "set",
submitAction: function(section, name, shortcuts) {
return $.ajax({
......@@ -254,7 +254,7 @@ var ExtensionManager = VispaModule.extend({
applyCallback: function(section, name, newShortcuts, oldShortcuts) {
extension._updateViewShortcuts(viewName, newShortcuts, oldShortcuts);
}
};
}, extension.getShortcutSettings(viewClass));
vispa.preferences.addObservable("extensionShortcuts", observableName, instanceShortcuts, defaultShortcuts, settings);
}
if (!instanceShortcuts) {
......@@ -273,7 +273,7 @@ var ExtensionManager = VispaModule.extend({
var defaultPreferences = extension.getDefaultPreferences(viewClass) || {};
instancePreferences = this.extensionPreferences[observableName] || {};
vispa.parsePreferences(instancePreferences, defaultPreferences);
var settings = {
var settings = $.extend(true, {
type: "set",
submitAction: function(section, name, preferences) {
return $.ajax({
......@@ -288,7 +288,7 @@ var ExtensionManager = VispaModule.extend({
applyCallback: function(section, name, newPreferences, oldPreferences) {
extension._updateViewPreferences(viewName, newPreferences, oldPreferences);
}
};
}, extension.getPreferenceSettings(viewClass));
vispa.preferences.addObservable("extensionPreferences", observableName, instancePreferences,
defaultPreferences, settings);
// initial push
......@@ -543,8 +543,10 @@ var Extension = Emitter.extend({
this._options = {};
this._defaultPreferences = {};
this._preferenceSettings = {};
this._defaultShortcuts = {};
this._shortcutSettings = {};
/**
* .. note:: The attributes above should not be set directly (as indicated by the underscore) They are either contolled by setters within this class or set automatically by the :js:class:`ExtensionManager`.
......@@ -595,8 +597,14 @@ var Extension = Emitter.extend({
return this._defaultPreferences[viewClass] || null;
},
setDefaultPreferences: function(viewClass, defaultPreferences) {
getPreferenceSettings: function(viewClass) {
return this._preferenceSettings[viewClass] || null;
},
setDefaultPreferences: function(viewClass, defaultPreferences, settings) {
this._defaultPreferences[viewClass] = defaultPreferences;
if (settings)
this._preferenceSettings[viewClass] = settings;
return this;
},
......@@ -604,8 +612,14 @@ var Extension = Emitter.extend({
return this._defaultShortcuts[viewClass] || null;
},
setDefaultShortcuts: function(viewClass, defaultShortcuts) {
getShortcutSettings: function(viewClass) {
return this._shortcutSettings[viewClass] || null;
},
setDefaultShortcuts: function(viewClass, defaultShortcuts, settings) {
this._defaultShortcuts[viewClass] = defaultShortcuts;
if (settings)
this._shortcutSettings[viewClass] = settings;
return this;
},
......
......@@ -808,7 +808,7 @@ var WorkspaceView = VispaView.extend({
var getFormData = function(dialog) {
var data = {};
$("#name, #host, #login, #key, #dir, #cmd", dialog).each(function(i, input) {
data[input.id] = $(input).val();
data[input.id] = $(input).val() || undefined;
});
// check mandatory entries
var hit = false;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment