Remove hard code url

This commit is contained in:
Nicolas Le Goff
2014-02-28 17:11:50 +01:00
parent c03f654725
commit b354b063ee
2 changed files with 16 additions and 10 deletions

View File

@@ -61,7 +61,7 @@
{% block content %} {% block content %}
<div id="admin-app" data-usr="{{ app['authentication'].getUser().getId() }}"> <div id="admin-app" data-usr="{{ app['authentication'].getUser().getId() }}">
<div id="left" class="PNB left-view" style="width:250px;right:auto;" data-websocket="{{ "ws://" ~ app["conf"].get(["main" ,"websocket-server", "host"]) ~ ":" ~ app["conf"].get(["main" ,"websocket-server", "port"]) ~ "/websockets" }}"> <div id="left" class="PNB left-view" style="width:250px;right:auto;" data-tree-url="{{ path("admin_tree_display") }}" data-websocket="{{ "ws://" ~ app["conf"].get(["main" ,"websocket-server", "host"]) ~ ":" ~ app["conf"].get(["main" ,"websocket-server", "port"]) ~ "/websockets" }}">
<div class="PNB10" style="right:0"> <div class="PNB10" style="right:0">
<div id="FNDR"> <div id="FNDR">
{% include 'admin/tree.html.twig' %} {% include 'admin/tree.html.twig' %}

View File

@@ -50,6 +50,19 @@ define([
}) })
}; };
var create = function() {
AdminApp.LeftView = new LeftPanel({
el: AdminApp.$leftView,
eventManager: AdminApp.eventManager,
treeUrl: AdminApp.$leftView.data("tree-url")
});
AdminApp.RightView = new RightPanel({
el: AdminApp.$rightView,
eventManager: AdminApp.eventManager
});
}
var initialize = function (options) { var initialize = function (options) {
if (false === "wsurl" in options) { if (false === "wsurl" in options) {
throw "You must define a websocket url"; throw "You must define a websocket url";
@@ -59,15 +72,7 @@ define([
WSConnection.connect(options.wsurl); WSConnection.connect(options.wsurl);
} }
AdminApp.LeftView = new LeftPanel({ create();
el: AdminApp.$leftView,
eventManager: AdminApp.eventManager
});
AdminApp.RightView = new RightPanel({
el: AdminApp.$rightView,
eventManager: AdminApp.eventManager
});
AdminApp.LeftView.activeTree(); AdminApp.LeftView.activeTree();
AdminApp.LeftView.clickSelected(); AdminApp.LeftView.clickSelected();
@@ -76,6 +81,7 @@ define([
}; };
return { return {
create: create,
initialize: initialize initialize: initialize
}; };
}); });