Module: Cortex::ApplicationHelper
- Defined in:
- app/helpers/cortex/application_helper.rb
Instance Method Summary collapse
- #cortex_props ⇒ Object
- #environment ⇒ Object
- #environment_abbreviated ⇒ Object
- #extra_config ⇒ Object
- #flag_enabled?(flag_name) ⇒ Boolean
- #index_props ⇒ Object
- #qualtrics_domain ⇒ Object
- #title ⇒ Object
- #user_session_props ⇒ Object
- #wizard_props ⇒ Object
Instance Method Details
#cortex_props ⇒ Object
43 44 45 46 47 48 |
# File 'app/helpers/cortex/application_helper.rb', line 43 def cortex_props user_session_props.merge({ wizard: wizard_props, index: index_props }) end |
#environment ⇒ Object
58 59 60 |
# File 'app/helpers/cortex/application_helper.rb', line 58 def environment request.local? ? :local : Rails.env end |
#environment_abbreviated ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/helpers/cortex/application_helper.rb', line 62 def environment_abbreviated case environment when 'production' :prd when 'staging' :stg when 'development' :dev else :loc end end |
#extra_config ⇒ Object
11 12 13 |
# File 'app/helpers/cortex/application_helper.rb', line 11 def extra_config Cortex.config[:extra] end |
#flag_enabled?(flag_name) ⇒ Boolean
54 55 56 |
# File 'app/helpers/cortex/application_helper.rb', line 54 def flag_enabled?(flag_name) Flipper.enabled?(flag_name, current_user, request) end |
#index_props ⇒ Object
39 40 41 |
# File 'app/helpers/cortex/application_helper.rb', line 39 def index_props @index || {} end |
#qualtrics_domain ⇒ Object
50 51 52 |
# File 'app/helpers/cortex/application_helper.rb', line 50 def qualtrics_domain extra_config[:qualtrics_id].delete('_').downcase end |
#title ⇒ Object
5 6 7 8 9 |
# File 'app/helpers/cortex/application_helper.rb', line 5 def title title = 'Cortex Administration' title += " | #{ builder: TitleBuilder}" if title end |
#user_session_props ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/cortex/application_helper.rb', line 15 def user_session_props { environment: environment, active_tenant: current_user.active_tenant, current_user: current_user, tenants: current_user.tenants_with_children, csrf_token: form_authenticity_token, sidebarExpanded: (current_page? cortex.root_path), environment_abbreviated: environment_abbreviated } end |
#wizard_props ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/helpers/cortex/application_helper.rb', line 27 def wizard_props if @wizard @wizard.data.merge({ content_type: @content_type, content_item: @content_item, fields: @content_type.fields }) else {} end end |