-
Notifications
You must be signed in to change notification settings - Fork 573
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
add ability to filter plugin routes in routes tab #851
Conversation
Stickler-CI doesn't like my way of adding styling to the |
Co-authored-by: Edgaras Janušauskas <edgaras.janusauskas@gmail.com>
templates/element/routes_panel.php
Outdated
foreach (CorePlugin::loaded() as $pluginName) { | ||
if (!empty($amountOfRoutesPerGroup[$pluginName])) { | ||
$name = sprintf('%s (%s)', $pluginName, $amountOfRoutesPerGroup[$pluginName]); | ||
$pluginNames[$name] = preg_replace('/\W+/', '', strtolower($pluginName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a call to Inflector
I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not able to find a suitable function in the Inflector Utility Class to handle a plugin name like ADmad/Sequence
Inflector::variable('ADmad/Sequence');
results inaDmad/sequence
which is not a valid CSS classInflector::dasherize('ADmad/Sequence');
results ina-dmad/sequence
which is also not a valid CSS class
Thats why I used this rather simple regex
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to have a static cakephp function to just put any string into it and it returns me a valid CSS class.
Currently I have used a custom Helper in my app for that since it is mainly used in the template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try Text::slug()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good, will push that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be fair I would have never thought that a Text::slug()
method could be used to convert a string to a valid CSS class.
templates/element/routes_panel.php
Outdated
$class = 'route-entry route-entry--app'; | ||
else : | ||
$class = 'route-entry route-entry--plugin route-entry--plugin-' . | ||
preg_replace('/\W+/', '', strtolower($route->defaults['plugin'])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be Inflector
based as well.
.btn-primary:hover { | ||
cursor:pointer; | ||
} | ||
.toggle-plugin-route-active { | ||
background-color: #fff; | ||
color: #2a6496; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I love these colours in this context but I can fiddle with it afterwards.
This PR refactors the routes tab in that sense that you are now able to filter routes per plugin.
Also you can see how many routes are loaded for that specific plugin next to the filter button.
Activating the button will hide the routes for that selected plugin.
The DebugKit routes are hidden by default as they have been before as well.
Fixes #850