summaryrefslogtreecommitdiffstats
path: root/module/web
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-01-07 19:56:01 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-01-07 19:56:01 +0100
commit2283396e235bd938c612b1a1a3a94c8bd94ba448 (patch)
treedb145abd0772ece893847fcb6bc835bbbfeb743c /module/web
parentfixed the lexer rules (diff)
downloadpyload-2283396e235bd938c612b1a1a3a94c8bd94ba448.tar.xz
render the settings menu
Diffstat (limited to 'module/web')
-rw-r--r--module/web/static/js/views/settingsView.js38
-rw-r--r--module/web/templates/default/settings.html6
2 files changed, 31 insertions, 13 deletions
diff --git a/module/web/static/js/views/settingsView.js b/module/web/static/js/views/settingsView.js
index 1b7f5e356..8372f77c1 100644
--- a/module/web/static/js/views/settingsView.js
+++ b/module/web/static/js/views/settingsView.js
@@ -12,27 +12,43 @@ define(['jquery', 'underscore', 'backbone'],
},
menu: null,
- data: null,
+
+ core_config: null, // It seems models are not needed
+ plugin_config: null,
initialize: function() {
this.menu = $('.settings-menu');
- var self = this;
+ this.refresh();
-// $.ajax("/api/getCoreConfig", {success: function(data) {
-// self.data = data;
-// self.render()
-// }});
-// $.ajax("/api/getPluginConfig");
console.log("Settings initialized");
},
- // TODO: this is only a showcase
+ refresh: function() {
+ var self = this;
+ $.ajax("/api/getCoreConfig", {success: function(data) {
+ self.core_config = data;
+ self.render()
+ }});
+ $.ajax("/api/getPluginConfig", {success: function(data) {
+ self.plugin_config = data;
+ self.render();
+ }});
+ },
+
render: function() {
- this.menu.html(this.template_menu({core:false}));
+ this.menu.html(this.template_menu({
+ core: this.core_config,
+ plugin: this.plugin_config
+ }));
},
- change_section: function(el) {
- console.log("Section changed");
+ change_section: function(e) {
+ var el = $(e.target).parent();
+ var name = el.data("name");
+ console.log("Section changed to " + name);
+
+ this.menu.find("li.active").removeClass("active");
+ el.addClass("active");
}
});
diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html
index 5fa34a40d..77413a222 100644
--- a/module/web/templates/default/settings.html
+++ b/module/web/templates/default/settings.html
@@ -15,9 +15,11 @@
{% block head %}
<script type="text/template" id="template-menu">
<%=if core%>
- Core
+ <li class="nav-header"><i class="icon-globe icon-white"></i> {{ _("General") }}</li>
+ <%=each core%>
+ <li data-name="<% this.name %>"><a href="#"><% this.label %></a></li>
+ <%/each%>
<%/if%>
- <li class="nav-header"><i class="icon-globe icon-white"></i> {{ _("General") }}</li>
<li class="divider"></li>
<li class="nav-header"><i class="icon-th-large icon-white"></i> {{ _("Addons") }}</li>
<li class="divider"></li>