mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
Add admin field application
This commit is contained in:

committed by
Romain Neutron

parent
7199d38ab3
commit
05dc3659af
@@ -2,10 +2,48 @@ define([
|
||||
'jquery',
|
||||
'underscore',
|
||||
'backbone',
|
||||
'apps/admin/fields/router'
|
||||
], function($, _, Backbone, Router) {
|
||||
'i18n',
|
||||
'apps/admin/fields/collections/fields',
|
||||
'apps/admin/fields/collections/vocabularies',
|
||||
'apps/admin/fields/collections/dcFields',
|
||||
'apps/admin/fields/views/list'
|
||||
], function($, _, Backbone, i18n, FieldsCollection, VocabulariesCollection, DcFieldsCollection, FieldListView) {
|
||||
var initialize = function() {
|
||||
Router.initialize();
|
||||
window.AdminFieldApp = {};
|
||||
|
||||
window.AdminFieldApp.sbas_id = $('input[name=current_sbas_id]').val();
|
||||
|
||||
var fieldsCollection = new FieldsCollection(null, {
|
||||
sbas_id : window.AdminFieldApp.sbas_id
|
||||
});
|
||||
|
||||
var vocabulariesCollection = new VocabulariesCollection();
|
||||
var dcFieldsCollection = new DcFieldsCollection();
|
||||
|
||||
// load strings synchronously
|
||||
i18n.init({ resGetPath: '/admin/fields/language.json', getAsync: false });
|
||||
|
||||
var requests = [
|
||||
fieldsCollection.fetch(),
|
||||
vocabulariesCollection.fetch(),
|
||||
dcFieldsCollection.fetch()
|
||||
];
|
||||
|
||||
$.when.apply($, requests).done(
|
||||
function() {
|
||||
window.AdminFieldApp.vocabularyCollection = vocabulariesCollection;
|
||||
window.AdminFieldApp.dcFieldsCollection = dcFieldsCollection;
|
||||
|
||||
window.AdminFieldApp.fieldListView = new FieldListView({
|
||||
collection: fieldsCollection,
|
||||
el: $('.left-block')[0]
|
||||
});
|
||||
|
||||
window.AdminFieldApp.fieldListView.render();
|
||||
// click on first item list
|
||||
_.first(window.AdminFieldApp.fieldListView.itemViews).clickAction().animate();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
return {
|
||||
|
Reference in New Issue
Block a user