Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tab 'all'; Fixed bug with missing selection of current tab #33

Merged
merged 5 commits into from
Oct 5, 2016

Conversation

trickreich
Copy link
Contributor

Q A
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
License MIT

What's in this PR?

Added tab 'All' in Sulu admin (can be disabled via config).

Why?

Fixed bug with missing selection of current tab.

'default' => $structure->getKey(),
'title' => $this->getTitle($type),
];
}
}

return $types;
$config['displayTabAll'] = $this->displayTabAll;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this into the initial of the var

$types = [];
$config = [];

$config['types'] = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this into the initial of the var

@@ -47,6 +47,7 @@ public function getConfigTreeBuilder()
->end()
->end()
->end()
->scalarNode('display_tab_all')->defaultTrue()->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont like this name (: but i cannot think of a better one. Have you any better suggestions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also you could add her some informations with ->info('...') (see http://symfony.com/doc/current/components/config/definition.html#documenting-the-option)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no better suggestion :/

Possible bundle configurations:

```yml
sulu_article:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you add some info (comment above) you could use bin/console config:dump-reference sulu_article (where you get a commented version of the config-tree) to generate this section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, that means I can remove this part from the README?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no replace it with the output of this command

@@ -16,9 +16,10 @@
<tag name="sulu_admin.content_navigation" alias="article"/>
<tag name="sulu.context" context="admin"/>
</service>
<service id="sulu_article.js_config" class="Sulu\Bundle\ArticleBundle\Admin\ArticleJsConfig">
<service id="sulu_article.js_config.types" class="Sulu\Bundle\ArticleBundle\Admin\ArticleJsConfig">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now its not only for types. remove this suffix

);

if (type === this.options.type) {
tabPreselect = types[type].title;
Copy link
Member

@wachterjohannes wachterjohannes Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cannt we use the id here? then we wont have to introduce an own var? this should be possible with preselector: 'id', preselect: this.options.type?

Copy link
Contributor Author

@trickreich trickreich Oct 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are three types:

  • url
  • position
  • name

so there is no type with id

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok its not nice but ok (:

this.sandbox.emit('husky.datagrid.articles.url.update', {type: item.id});
this.sandbox.emit('sulu.router.navigate', 'articles:' + item.id + '/' + this.options.locale, false, false);
var type = null;
var url = 'articles';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i would introduce a underscore template like defaults.templates.route: 'articles/<% if (!!type) { %>:<%=type%>/<% } %><%=locale%>' which could be used here withthis.templates.route({type: this.options.type, locale: this.options.locale)


if (config.typeNames.length === 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use yoda conditions 1 === config.typeNames.length

return app.sandbox.emit('sulu.router.navigate', 'articles:' + config.typeNames[0] + '/' + getLocale());
}
});
if (config.displayTabAll === false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use !config.displayTabAll

}

url += '/' + this.options.locale;
var type = !!item.key ? item.key : null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this line necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, I've removed this line

@wachterjohannes wachterjohannes merged commit 71d44a1 into develop Oct 5, 2016
@wachterjohannes wachterjohannes deleted the feature/tab-all branch October 5, 2016 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants