Started implementing permissions into schema view.

This commit is contained in:
Jeff Cross
2011-11-26 20:15:42 -07:00
parent da883f5c7c
commit 432cd8bc96
4 changed files with 21 additions and 4 deletions

View File

@@ -181,15 +181,16 @@
<script id="schema-view-template" type="html/template">
<div class="twelve columns">
<div class="panel">
<h6><% print(name); %> Schema Description</h6>
<h6><%= name %> Schema Description</h6>
<p>
Create and edit properties below to control the validation of objects added to the <%= name %> collection.
</p>
<p>
<p style="color:#c00;">
POST /...<br />
GET /...
</p>
<hr />
<% print(JSON.stringify(groups)); %>
<form class="description nice custom">
<input type="hidden" name="_id" value="<%= _id %>" />
<% _.each(description, function (value, key, list){%>

View File

@@ -1,7 +1,7 @@
window.CollectionModel = Backbone.Model.extend({
url: function () {
console.log('/search/'+this.get('name')+'?find={}');
return '/search/' + this.get("name") + '?find={}';
// console.log('/search/'+this.get('name')+'?find={}');
return '/' + this.get('plugin') + '/' + this.get("name");
},
getItemById: function (id) {
var _items = this.get('results');

View File

@@ -6,6 +6,21 @@ window.Plugin = Backbone.Model.extend({
url: function () {
return '/settings/' + this.get("name");
},
getObjectByName: function (name) {
var _configObject = false;
console.log('getting by name');
console.log(name)
this.get('objects').each(function (item, index, list){
if (item.get('name') === name) {
_configObject = item;
return;
}
else {
console.log(JSON.stringify(item));
}
});
return _configObject;
},
initialize: function () {
this.set({url: this.url()});
}

View File

@@ -13,6 +13,7 @@ window.PluginView = Backbone.View.extend({
var tabContent = _self.addTab(obj.get("name"), obj.get("_id"));
if (obj.get("description")) {
var _schemaModel = new SchemaModel(obj);
_schemaModel.set({groups: app.get('plugins').getByPluginName('users').getObjectByName('groups')});
var _schemaEl = $("<div />").attr("id", "id-"+obj.get('_id'));
$(tabContent).append(_schemaEl);
var _schemaView = new SchemaView({