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

Allow to limit route actions #597

Merged
merged 1 commit into from
Mar 7, 2017

Conversation

infertux
Copy link
Contributor

This allows to limit route actions in routes.rb by using only: [:index, :show] for example and only display these routes in views.

@@ -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|

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;

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'.

@infertux
Copy link
Contributor Author

Hmm so CircleCI is failing but I don't think it's related to my changes?

@BenMorganIO
Copy link
Collaborator

@infertux Rebuilding without cache :)

@infertux
Copy link
Contributor Author

Ping @Graysonwright @BenMorganIO :)

@BenMorganIO
Copy link
Collaborator

@infertux can you add specs for this please?

@infertux
Copy link
Contributor Author

@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.
@gee-forr
Copy link

gee-forr commented Mar 5, 2017

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?

@BenMorganIO
Copy link
Collaborator

BenMorganIO commented Mar 5, 2017

@infertux Could you rebase from master? That should green up the build :)

@gee-forr thanks for the reminder :p

@nickcharlton
Copy link
Member

This will cleanly rebase on master and I can't see any other issues, so I'm going to hit the magic button. Thanks for this!

@nickcharlton nickcharlton merged commit 4ac1521 into thoughtbot:master Mar 7, 2017
mmagn added a commit to demarches-simplifiees/demarches-simplifiees.fr that referenced this pull request Jan 4, 2018
…index

This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
mmagn added a commit to demarches-simplifiees/demarches-simplifiees.fr that referenced this pull request Jan 4, 2018
…index

This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
mmagn added a commit to demarches-simplifiees/demarches-simplifiees.fr that referenced this pull request Jan 8, 2018
…index

This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
mmagn added a commit to demarches-simplifiees/demarches-simplifiees.fr that referenced this pull request Jan 8, 2018
…index

This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
mmagn added a commit to demarches-simplifiees/demarches-simplifiees.fr that referenced this pull request Jan 8, 2018
…index

This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
mmagn added a commit to demarches-simplifiees/demarches-simplifiees.fr that referenced this pull request Jan 10, 2018
…index

This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
mmagn added a commit to demarches-simplifiees/demarches-simplifiees.fr that referenced this pull request Jan 10, 2018
…index

This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
tchak pushed a commit to tchak/tps that referenced this pull request Aug 9, 2018
…d delete button from index

This can be reverted when Administrate gem will include this fix : thoughtbot/administrate#597 (>=0.5.0)
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.

5 participants