'}}),c.sandbox.mvc.routes.push({route:"articles/:locale/add::type",callback:function(a,b){return'
'}})),c.sandbox.mvc.routes.push({route:"articles/:locale/edit::id/:content",callback:function(a,b){return'
"}})}}});
\ No newline at end of file
diff --git a/Resources/public/js/components/articles/edit/details/main.js b/Resources/public/js/components/articles/edit/details/main.js
index 7a714391c..87d1c5e72 100644
--- a/Resources/public/js/components/articles/edit/details/main.js
+++ b/Resources/public/js/components/articles/edit/details/main.js
@@ -107,8 +107,7 @@ define(['underscore', 'jquery', 'config'], function(_, $, Config) {
loadFormTemplate: function(template) {
if (!template) {
- var types = Config.get('sulu_article.types');
- template = types[(this.options.type || this.data.type)];
+ template = this.options.config.types[(this.options.type || this.data.type)].default;
}
this.template = template;
diff --git a/Resources/public/js/components/articles/edit/main.js b/Resources/public/js/components/articles/edit/main.js
index 25a3cac4e..89f6b98b9 100644
--- a/Resources/public/js/components/articles/edit/main.js
+++ b/Resources/public/js/components/articles/edit/main.js
@@ -106,7 +106,7 @@ define(['jquery', 'underscore', 'sulusecurity/services/user-manager'], function(
},
toList: function() {
- if (this.options.config.types.length === 1) {
+ if (this.options.config.typeNames.length === 1) {
this.sandbox.emit('sulu.router.navigate', 'articles/' + this.options.locale);
} else {
this.sandbox.emit('sulu.router.navigate', 'articles:' + (this.options.type || this.data.type) + '/' + this.options.locale);
@@ -114,7 +114,7 @@ define(['jquery', 'underscore', 'sulusecurity/services/user-manager'], function(
},
toAdd: function() {
- if (this.options.config.types.length === 1) {
+ if (this.options.config.typeNames.length === 1) {
this.sandbox.emit('sulu.router.navigate', 'articles/' + this.options.locale + '/add', true, true);
} else {
this.sandbox.emit('sulu.router.navigate', 'articles/' + this.options.locale + '/add:' + (this.options.type || this.data.type), true, true);
diff --git a/Resources/public/js/components/articles/list/main.js b/Resources/public/js/components/articles/list/main.js
index 7d0bff340..e438fad49 100644
--- a/Resources/public/js/components/articles/list/main.js
+++ b/Resources/public/js/components/articles/list/main.js
@@ -7,7 +7,7 @@
* with this source code in the file LICENSE.
*/
-define(['underscore'], function(_) {
+define(['underscore', 'config'], function(_, Config) {
'use strict';
@@ -37,6 +37,7 @@ define(['underscore'], function(_) {
header: function() {
var types = this.options.config.types,
+ typeNames = this.options.config.typeNames,
button = {
icon: 'plus-circle',
title: 'public.add-new'
@@ -44,24 +45,24 @@ define(['underscore'], function(_) {
tabs = false,
items;
- if (types.length === 1) {
+ if (typeNames.length === 1) {
button.callback = function() {
- this.toAdd(types[0]);
+ this.toAdd(typeNames[0]);
}.bind(this);
} else {
- button.dropdownItems = _.map(types, function(item) {
+ button.dropdownItems = _.map(typeNames, function(type) {
return {
- title: item,
+ title: types[type].title,
callback: function() {
- this.toAdd(item);
+ this.toAdd(type);
}.bind(this)
};
}.bind(this));
- items = _.map(types, function(type) {
+ items = _.map(typeNames, function(type) {
return {
id: type,
- name: type,
+ name: types[type].title,
key: type
};
});
@@ -77,9 +78,6 @@ define(['underscore'], function(_) {
}
return {
- title: this.translations.headline,
- underline: false,
-
noBack: true,
tabs: tabs,
@@ -155,7 +153,7 @@ define(['underscore'], function(_) {
},
toAdd: function(type, locale) {
- this.sandbox.emit('sulu.router.navigate', 'articles/' + (locale || this.options.locale) + '/add' + (this.options.config.types.length > 1 ? (':' + type) : ''));
+ this.sandbox.emit('sulu.router.navigate', 'articles/' + (locale || this.options.locale) + '/add' + (this.options.config.typeNames.length > 1 ? (':' + type) : ''));
},
toList: function(locale) {
diff --git a/Resources/public/js/main.js b/Resources/public/js/main.js
index 4332ba665..cf05cdbf6 100644
--- a/Resources/public/js/main.js
+++ b/Resources/public/js/main.js
@@ -34,7 +34,8 @@ define(['underscore', 'config'], function(_, Config) {
return {id: locale, title: locale};
}),
settingsKey: 'articleLanguage',
- types: Object.keys(Config.get('sulu_article.types'))
+ typeNames: Object.keys(Config.get('sulu_article.types')),
+ types: Config.get('sulu_article.types')
};
Config.set('sulu_article', config);
@@ -47,7 +48,7 @@ define(['underscore', 'config'], function(_, Config) {
return app.sandbox.sulu.getUserSetting(config.settingsKey) || config.defaultLocale;
};
- if (config.types.length === 1) {
+ if (config.typeNames.length === 1) {
app.sandbox.mvc.routes.push({
route: 'articles',
callback: function() {
@@ -58,21 +59,21 @@ define(['underscore', 'config'], function(_, Config) {
app.sandbox.mvc.routes.push({
route: 'articles/:locale',
callback: function(locale) {
- return '
';
+ return '
';
}
});
app.sandbox.mvc.routes.push({
route: 'articles/:locale/add',
callback: function(locale, type) {
- return '
';
+ return '
';
}
});
} else {
app.sandbox.mvc.routes.push({
route: 'articles',
callback: function() {
- return app.sandbox.emit('sulu.router.navigate', 'articles:' + config.types[0] + '/' + getLocale());
+ return app.sandbox.emit('sulu.router.navigate', 'articles:' + config.typeNames[0] + '/' + getLocale());
}
});