Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/casaper/rails_controller_action_name_helpers

Simple helpers to have more readable checks for current controller name or action name in rails views.
https://github.com/casaper/rails_controller_action_name_helpers

Last synced: 7 days ago
JSON representation

Simple helpers to have more readable checks for current controller name or action name in rails views.

Awesome Lists containing this project

README

        

# Rails Controller Action Name Helpers

[Repository - casaper/rails_controller_action_name_helpers](https://github.com/casaper/rails_controller_action_name_helpers)
[Documentation](https://casaper.github.io/rails_controller_action_name_helpers/)

Simple view helpers to have more readable checks for current controller name or action name.

```haml
- # this condition here
- if action_name == 'index' && (controller_name == 'members' || controller_name == 'users')
%p This will only show if the partial is run on the index action on the members or users controller
- # can be done like this
- if ca_index?(:members, :users)
%p This will only show if the partial is run on the index action on the members or users controller
```