-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow to limit route actions #597
Conversation
@@ -79,6 +79,17 @@ def nav_link_state(resource) | |||
end | |||
end | |||
|
|||
helper_method :valid_action? | |||
def valid_action?(name, resource = resource_name) | |||
!!routes.find do |controller, action| |
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.
Prefer detect
over find
.
if (!event.target.href) { | ||
var url = $(event.target).closest("tr").data("url"); | ||
|
||
if (url) window.location = url; |
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.
Expected '{' and instead saw 'window'.
Hmm so CircleCI is failing but I don't think it's related to my changes? |
@infertux Rebuilding without cache :) |
Ping @Graysonwright @BenMorganIO :) |
@infertux can you add specs for this please? |
7451072
to
1379971
Compare
@BenMorganIO Sorry about the delay, I added specs. BTW the build is failing because of bundler-audit. |
This allows to limit route actions such as :index and :show in routes.rb and only display these routes in views.
1379971
to
852d8d9
Compare
I'd really love to see this feature make it into the main gem. Any chance of this getting approved? Is there anything I can do to help? |
This will cleanly rebase on |
…index This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
…index This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
…index This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
…index This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
…index This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
…index This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
…index This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
…d delete button from index This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
This allows to limit route actions in
routes.rb
by usingonly: [:index, :show]
for example and only display these routes in views.