Module: RailsBase::AppearanceHelper
- Included in:
- RailsBaseApplicationController
- Defined in:
- app/helpers/rails_base/appearance_helper.rb
Constant Summary collapse
- APPEARANCE_MODE_COOKIE =
"_#{RailsBase.app_name}_appearance_mode".gsub(' ', '-').downcase
- APPEARANCE_MODE_ACTUAL_COOKIE =
"_#{RailsBase.app_name}_appearance_actual_mode".gsub(' ', '-').downcase
- APPEARANCE_TEXT_CLASS =
RailsBase::Configuration::Display::Text::APPEARANCE_TEXT_CLASS
- VIEWPORT_EXTRA_SMALL =
'xs'.freeze
- VIEWPORT_SMALL =
'sm'.freeze
- VIEWPORT_MEDIUM =
'md'.freeze
- VIEWPORT_LARGE =
'lg'.freeze
- VIEWPORT_EXTRA_LARGE =
'xl'.freeze
- VIEWPORT_MOBILE_MAX =
VIEWPORT_MEDIUM
- VIEWPORT_SIZES =
{ VIEWPORT_EXTRA_SMALL => 576, VIEWPORT_SMALL => 768, VIEWPORT_MEDIUM => 992, VIEWPORT_LARGE => 1200, VIEWPORT_EXTRA_LARGE => nil, }
Instance Method Summary collapse
- #appearance_mode_drop_down ⇒ Object
- #appearance_text_class ⇒ Object
- #footer_mode_case ⇒ Object
- #force_sticky_mode! ⇒ Object
Instance Method Details
#appearance_mode_drop_down ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'app/helpers/rails_base/appearance_helper.rb', line 45 def appearance_mode_drop_down @appearance_mode_drop_down ||= begin current = [APPEARANCE_MODE_COOKIE] actual = [APPEARANCE_MODE_ACTUAL_COOKIE] raw_types = RailsBase::Configuration::Appearance::APPEARANCE_TYPES types_a = raw_types.map(&:to_a).map(&:flatten).map(&:reverse) types = raw_types.keys unless types.include?(current&.to_sym) [APPEARANCE_MODE_COOKIE] = current = RailsBase.appearance.default_mode end { types: types, current: current, types_a: types_a, actual: actual } end end |
#appearance_text_class ⇒ Object
41 42 43 |
# File 'app/helpers/rails_base/appearance_helper.rb', line 41 def appearance_text_class APPEARANCE_TEXT_CLASS end |
#footer_mode_case ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/helpers/rails_base/appearance_helper.rb', line 22 def return :sticky if @_sticky_mode return :bottom if RailsBase.appearance..content_bottom_or_sticky sticky_pages = RailsBase.appearance..sticky_pages return if sticky_pages.empty? full_controller_path = "#{controller_path.camelize}Controller" return unless pages = sticky_pages[full_controller_path] return :sticky if pages.include?(action_name.to_sym) nil end |
#force_sticky_mode! ⇒ Object
37 38 39 |
# File 'app/helpers/rails_base/appearance_helper.rb', line 37 def force_sticky_mode! @_sticky_mode = true end |