added sorting for public entities (fixes #93)
This commit is contained in:
parent
2deadf5ca6
commit
dad6821d22
3 changed files with 16 additions and 9 deletions
|
@ -35,6 +35,8 @@ var vz = {
|
|||
entities: new Array, // entity properties + data
|
||||
middleware: [{ // default middleware
|
||||
url: '../middleware.php',
|
||||
public: [ ] // public entities
|
||||
/* capabilities: { } */
|
||||
}],
|
||||
|
||||
// web user interface
|
||||
|
|
|
@ -89,14 +89,19 @@ vz.wui.dialogs.init = function() {
|
|||
vz.load({
|
||||
controller: 'entity',
|
||||
success: function(json) {
|
||||
if (json.entities.length > 0) {
|
||||
json.entities.each(function(index, json) {
|
||||
var entity = new Entity(json);
|
||||
$('#entity-public-entity').append(
|
||||
$('<option>').html(entity.title).val(entity.uuid).data('entity', entity)
|
||||
);
|
||||
});
|
||||
}
|
||||
var entities = new Array;
|
||||
json.entities.each(function(index, json) {
|
||||
entities.push(new Entity(json));
|
||||
});
|
||||
|
||||
entities.sort(Entity.compare);
|
||||
entities.each(function(index, entity) {
|
||||
$('#entity-public-entity').append(
|
||||
$('<option>').html(entity.title).val(entity.uuid).data('entity', entity)
|
||||
);
|
||||
});
|
||||
|
||||
vz.middleware[0].public = entities; /* store */
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class JSON extends View {
|
|||
$this->addData($data);
|
||||
}
|
||||
elseif ($data instanceof Model\Entity) {
|
||||
$this->json['entity'] = self::convertEntity($entity);
|
||||
$this->json['entity'] = self::convertEntity($data);
|
||||
}
|
||||
elseif ($data instanceof \Exception) {
|
||||
$this->addException($data);
|
||||
|
|
Loading…
Add table
Reference in a new issue