summaryrefslogtreecommitdiff
path: root/src/www/syntax-editor/js
diff options
context:
space:
mode:
authorjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-11-16 09:33:55 +0000
committerjohn.j.camilleri <john.j.camilleri@chalmers.se>2012-11-16 09:33:55 +0000
commit67ca0a1eae3875cb72c4a89fe7d0f454722c3b59 (patch)
treed9c7d820f08adb8d6015081fcf0e1534c57ce8ad /src/www/syntax-editor/js
parent225cebf1214c07b5195cc8ea898bab01fabbdbc6 (diff)
Syntax editor: select subset of available languages
Also added a basic readme file with a list of todo's
Diffstat (limited to 'src/www/syntax-editor/js')
-rw-r--r--src/www/syntax-editor/js/editor.js6
-rw-r--r--src/www/syntax-editor/js/editor_menu.js25
2 files changed, 23 insertions, 8 deletions
diff --git a/src/www/syntax-editor/js/editor.js b/src/www/syntax-editor/js/editor.js
index b7fa2dd87..608770edb 100644
--- a/src/www/syntax-editor/js/editor.js
+++ b/src/www/syntax-editor/js/editor.js
@@ -108,14 +108,16 @@ Editor.prototype.get_refinements=function(cat) {
Editor.prototype.select_refinement=function(fun) {
with (this) {
+ clear(ui.refinements);
ast.removeChildren();
ast.setFun(fun);
+// redraw_tree();
+
var args = {
id: fun,
format: "json"
};
var err = function(data){
- clear(refinements);
alert("no refinements");
};
server.browse(args, bind(complete_refinement,this), err);
@@ -139,7 +141,7 @@ Editor.prototype.complete_refinement=function(data) {
}
}
- // Update vis
+ // Update ui
redraw_tree();
update_linearisation();
diff --git a/src/www/syntax-editor/js/editor_menu.js b/src/www/syntax-editor/js/editor_menu.js
index 874859ae7..ce0894ee0 100644
--- a/src/www/syntax-editor/js/editor_menu.js
+++ b/src/www/syntax-editor/js/editor_menu.js
@@ -15,11 +15,22 @@ function EditorMenu(editor,opts) {
this.container = editor.ui.menubar;
this.ui = {
startcat_menu: empty("select"),
- to_menu: empty_id("select","to_menu")
+ to_toggle: button("...", function(){
+ var sel = t.ui.to_menu;
+ if (sel.classList.contains("hidden"))
+ sel.classList.remove("hidden")
+ else
+ sel.classList.add("hidden")
+ }),
+ to_menu: node("select",{
+ id: "to_menu",
+ multiple: "multiple",
+ class: "hidden"
+ } )
};
with(this.ui) {
appendChildren(this.container, [text(" Startcat: "),startcat_menu]);
- appendChildren(this.container, [text(" To: "), to_menu]);
+ appendChildren(this.container, [text(" To: "), to_toggle, to_menu]);
startcat_menu.onchange=bind(this.change_startcat,this);
to_menu.onchange=bind(this.change_language,this);
}
@@ -119,10 +130,12 @@ EditorMenu.prototype.change_startcat=function () {
//
EditorMenu.prototype.change_language=function () {
- if (this.ui.to_menu.value == "All")
- this.editor.languages = new Array();
- else
- this.editor.languages = new Array(this.ui.to_menu.value);
+ this.editor.languages = new Array();
+ for (i in this.ui.to_menu.options) {
+ var opt = this.ui.to_menu.options[i];
+ if (opt.selected)
+ this.editor.languages.push(opt.value);
+ }
this.editor.update_linearisation();
}