mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-05-14 17:21:02 +08:00
Fixed dynamically-loading side menu to show available plugins.
This commit is contained in:
@@ -34,8 +34,6 @@
|
||||
<div class="row">
|
||||
<div id="menu" class="three columns">
|
||||
<div class="panel">
|
||||
<h5>App Config</h5>
|
||||
<hr />
|
||||
<h5>Plugins</h5>
|
||||
<div class="links">
|
||||
<em>No Plugins Loaded</em>
|
||||
@@ -262,17 +260,11 @@
|
||||
</script>
|
||||
|
||||
<script id="app-nav-template" type="html/template">
|
||||
<li><a href="#/">Config</a></li>
|
||||
<li><a href="#/plugins">Plugins</a>
|
||||
<ul>
|
||||
<% _.each(plugins.models, function (plugin) { %>
|
||||
<li><a href="#/plugins/<%= plugin.attributes._id %>"><%= plugin.attributes.name %></a></li>
|
||||
<li><a href="#/plugins/<%= plugin.attributes.name %>"><%= plugin.attributes.name %></a></li>
|
||||
<% }); %>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<a>Reference</a>
|
||||
</li>
|
||||
</script>
|
||||
<script id="model-detail-template" type="html/template">
|
||||
<div><%= name %></div>
|
||||
|
||||
@@ -5,6 +5,10 @@ var Router = Backbone.Router.extend({
|
||||
// allows to send restful calls over AJAX
|
||||
Backbone.emulateHTTP = true;
|
||||
window.app = new App();
|
||||
window.appNavView = new AppNavView({
|
||||
model: app,
|
||||
el: $("#menu .links")
|
||||
});
|
||||
|
||||
app.fetch({
|
||||
success: function (model, response) {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
window.AppNavView = Backbone.View.extend({
|
||||
|
||||
template: _.template($("#app-nav-template").html()),
|
||||
|
||||
initialize: function () {
|
||||
this.model.bind("change", this.render, this);
|
||||
},
|
||||
render: function(type, model) {
|
||||
$(this.el).html(this.template(this.model.toJSON()));
|
||||
|
||||
// $(this.el).html(JSON.stringify(this.model.get("plugins").toJSON()));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ window.PluginView = Backbone.View.extend({
|
||||
|
||||
render: function () {
|
||||
var _self = this;
|
||||
$(this.el).empty();
|
||||
this.model.get("objects").each(function(obj){
|
||||
if (obj.get("description")) {
|
||||
//TODO: Plug this in to a view/model/template
|
||||
|
||||
@@ -43,7 +43,6 @@ window.SchemaView = Backbone.View.extend({
|
||||
this.render();
|
||||
},
|
||||
addNewProperty: function (e) {
|
||||
console.log("addNewProperty()");
|
||||
$("form", this.el).append(_.template($("#new-schema-property-template").html(),{key: '', type: ''}));
|
||||
},
|
||||
render: function () {
|
||||
|
||||
Reference in New Issue
Block a user