marmelab/ng-admin — pull request #76 by manuquentin (2014-10-10 06:06:53+00:00)
Title: [WIP] Introduce view

- [x] Add view entities
- [ ] Allows views entities inheritance
- [ ] Update `CrudManager`
- [ ] Update `dashboard`
- [ ] Update list view
- [ ] Update `Reference`, `ReferenceMany`
- [ ] Update create / update view
- [ ] Update ReferencedList view
- [ ] Update deletion view
- [ ] Add actions
- [ ] Update tests

Configuration:
```js
var tag = new Entity('tags')
.label('Tags')
.order(3)
.addView(new DashboardView('tag-dashboard')
.order(1)
.limit(10)
.label('Recent tags')
.addField(new Field('name').label('Name').type('string'))
.addField(new Field('published').label('Published').type('boolean'))
).addView(new ListView('tags-list')
.title('List of all tags')
.pagination(pagination)
.infinitePagination(false)
.addAction(new Action('new-tag').label('Add tag').redirect('tags-create'))
.addField(new Field('name').label('Name').type('string'))
.addField(new Field('published').label('Published').type('boolean'))
.addField(new Field('actions')
.type('callback')
.list(true)
.label('Test')
.isEditLink(false)
.callback(function() {
return '{{ entity.getField("name").value.toUpperCase() }}';
})
)
).addView(new FormView('tags-create')
.addField(new Field('name')
.label('Name')
.type('string')
.validation({
"required": true,
"max-length" : 150
})
)
.addField(new Field('published').label('Published').type('boolean'))
).addView(new FormView('tags_edit')
.addAction(new Action('delete-tag').label('Delete tag').redirect('tags-delete'))
.listView('tags-list')
.addField(new Field('name').label('Name').type('string').editable(false))
.addField(new Field('published').label('Published').type('boolean'))
).addView(new DeleteView('tags-delete')
.addField(new Field('name').label('Name').type('string').editable(false))
.addField(new Field('published').label('Published').type('boolean'))
);
```