summaryrefslogtreecommitdiffstats
path: root/module/web
diff options
context:
space:
mode:
Diffstat (limited to 'module/web')
-rw-r--r--module/web/api_app.py6
-rw-r--r--module/web/static/js/default.js11
-rw-r--r--module/web/static/js/views/settingsView.js25
-rw-r--r--module/web/templates/default/settings.html4
4 files changed, 41 insertions, 5 deletions
diff --git a/module/web/api_app.py b/module/web/api_app.py
index ff8d0134c..c0a7df528 100644
--- a/module/web/api_app.py
+++ b/module/web/api_app.py
@@ -46,7 +46,7 @@ def call_api(func, args=""):
kwargs[x] = unquote(y)
try:
- return callApi(func, *args, **kwargs)
+ return callApi(api, func, *args, **kwargs)
except ExceptionObject, e:
return HTTPError(400, dumps(e))
except Exception, e:
@@ -55,13 +55,13 @@ def call_api(func, args=""):
# TODO Better error codes on invalid input
-def callApi(func, *args, **kwargs):
+def callApi(api, func, *args, **kwargs):
if not hasattr(PYLOAD.EXTERNAL, func) or func.startswith("_"):
print "Invalid API call", func
return HTTPError(404, dumps("Not Found"))
# TODO: encoding
- result = getattr(PYLOAD, func)(*[loads(x) for x in args],
+ result = getattr(api, func)(*[loads(x) for x in args],
**dict([(x, loads(y)) for x, y in kwargs.iteritems()]))
# null is invalid json response
diff --git a/module/web/static/js/default.js b/module/web/static/js/default.js
index 4436a85c1..bb9701935 100644
--- a/module/web/static/js/default.js
+++ b/module/web/static/js/default.js
@@ -1,5 +1,5 @@
-define('default', ['jquery', 'app', 'views/headerView', 'views/packageTreeView'],
- function($, App, HeaderView, TreeView) {
+define('default', ['require', 'jquery', 'app', 'views/headerView', 'views/packageTreeView'],
+ function(require, $, App, HeaderView, TreeView) {
App.init = function() {
App.header = new HeaderView();
@@ -13,5 +13,12 @@ define('default', ['jquery', 'app', 'views/headerView', 'views/packageTreeView']
});
};
+ App.initSettingsView = function() {
+ require(['views/settingsView'], function(SettingsView) {
+ App.settingsView = new SettingsView();
+ App.settingsView.render();
+ });
+ };
+
return App;
}); \ No newline at end of file
diff --git a/module/web/static/js/views/settingsView.js b/module/web/static/js/views/settingsView.js
new file mode 100644
index 000000000..f4e118233
--- /dev/null
+++ b/module/web/static/js/views/settingsView.js
@@ -0,0 +1,25 @@
+define(['jquery', 'underscore', 'backbone'],
+ function($, _, Backbone) {
+
+ // Renders a single package item
+ return Backbone.View.extend({
+
+ el: "#content",
+// template: _.compile($("#template-package").html()),
+
+ events: {
+
+ },
+
+ initialize: function() {
+ $.ajax("/api/getCoreConfig");
+ $.ajax("/api/getPluginConfig");
+ $.ajax("/api/getAvailablePlugins");
+ console.log("Settings initialized");
+ },
+
+ render: function() {
+ }
+
+ });
+ }); \ No newline at end of file
diff --git a/module/web/templates/default/settings.html b/module/web/templates/default/settings.html
index 60676187b..591dbc30c 100644
--- a/module/web/templates/default/settings.html
+++ b/module/web/templates/default/settings.html
@@ -8,6 +8,10 @@
<link href="static/css/default/settings.less" rel="stylesheet/less" type="text/css" media="screen"/>
{% endblock %}
+{% block require %}
+ App.initSettingsView();
+{% endblock %}
+
{% block content %}
<div class="container-fluid">
<div class="row-fluid">