Module: FL::ApplicationHelper
- Defined in:
- app/helpers/fl/application_helper.rb
Instance Method Summary collapse
-
#admin? ⇒ Boolean
> Checks for namespace => stackoverflow.com/a/15028731/1143732 (comment) => Devise should be “devise_controller?”.
-
#current_layout ⇒ Object
> Current Layout => Need to pass some sort of object to it, otherwise fails => stackoverflow.com/questions/22787021/rails-4-name-of-current-layout.
-
#devise_mapping ⇒ Object
Mappings ##.
-
#i(*args) ⇒ Object
> Icons.
-
#resource ⇒ Object
Class ##.
-
#resource_name ⇒ Object
Devise ##.
Instance Method Details
#admin? ⇒ Boolean
> Checks for namespace
> stackoverflow.com/a/15028731/1143732 (comment)
> Devise should be “devise_controller?”
19 20 21 22 |
# File 'app/helpers/fl/application_helper.rb', line 19 def admin? defined? Admin and controller.class.parents.include? Admin defined? Devise and controller.class.parents.include? Devise end |
#current_layout ⇒ Object
> Current Layout
> Need to pass some sort of object to it, otherwise fails
> stackoverflow.com/questions/22787021/rails-4-name-of-current-layout
10 11 12 13 |
# File 'app/helpers/fl/application_helper.rb', line 10 def current_layout layout = controller.send :_layout, ["test"] layout.inspect.split("/").last.gsub(/.haml/,"").tr('"', '') end |
#devise_mapping ⇒ Object
Mappings ##
45 46 47 |
# File 'app/helpers/fl/application_helper.rb', line 45 def devise_mapping @devise_mapping ||= Devise.mappings[:user] end |
#i(*args) ⇒ Object
> Icons
25 26 27 28 29 |
# File 'app/helpers/fl/application_helper.rb', line 25 def i *args gem_name = 'font-awesome-rails' gdep = Gem::Dependency.new(gem_name) gdep.matching_specs.max_by(&:version) ? fa_icon(*args) : ion_icon(*args) end |
#resource ⇒ Object
Class ##
40 41 42 |
# File 'app/helpers/fl/application_helper.rb', line 40 def resource @resource ||= User.new end |
#resource_name ⇒ Object
Devise ##
35 36 37 |
# File 'app/helpers/fl/application_helper.rb', line 35 def resource_name :user end |