Skip to content

Commit

Permalink
Bugfix article selection (#92)
Browse files Browse the repository at this point in the history
* Bugfix article selection

* Code clean up
  • Loading branch information
trickreich authored and wachterjohannes committed Mar 7, 2017
1 parent c927f7a commit d663b9a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Resources/public/dist/components/article-selection/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 20 additions & 13 deletions Resources/public/js/components/article-selection/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,22 +153,22 @@ define([
this.sandbox.dom.append(this.$el, $element);

// load all for default
this.url = this.options.url;
var delimiter = (this.options.url.indexOf('?') === -1) ? '?' : '&';
this.url = this.options.url + delimiter + 'locale=' + this.options.locale;

if (1 !== typeNames.length) {
tabs = [];
if (config.displayTabAll === true) {
tabs.push(
{
name: 'public.all',
key: null
title: 'public.all',
key: null,
data: $data
}
);
} else {
// if not all tab is first load only for the first type
var delimiter = (this.options.url.indexOf('?') === -1) ? '?' : '&';

this.url = this.options.url + delimiter + 'type=' + typeNames[0];
this.url = this.options.url + delimiter + 'locale=' + this.options.locale + '&type=' + typeNames[0];
}

// add tab item for each type
Expand Down Expand Up @@ -235,15 +235,19 @@ define([
},

typeChange = function(item) {
for (var type in config.types) {
if (config.types.hasOwnProperty(type) && config.types[type].title === item.name) {
this.type = type;
return this.sandbox.emit('husky.datagrid.' + this.options.instanceName + '.url.update', {type: type});
this.type = null;

if (item.name) {
for (var type in config.types) {
if (config.types.hasOwnProperty(type) && config.types[type].title === item.name) {
this.type = type;

break;
}
}
}

this.type = null;
this.sandbox.emit('husky.datagrid.' + this.options.instanceName + '.url.update', {type: null});
this.sandbox.emit('husky.datagrid.' + this.options.instanceName + '.url.update', {type: this.type});
};

return {
Expand All @@ -269,7 +273,10 @@ define([
var delimiter = (this.options.url.indexOf('?') === -1) ? '?' : '&';

return [
this.options.url, delimiter, this.options.idsParameter, '=', (data || []).join(',')
this.options.url,
delimiter,
'locale=' + this.options.locale,
'&', this.options.idsParameter, '=', (data || []).join(',')
].join('');
},

Expand Down

0 comments on commit d663b9a

Please sign in to comment.