Module: AbrahamHelper
- Defined in:
- app/helpers/abraham_helper.rb
Instance Method Summary collapse
- #abraham_cookie_prefix ⇒ Object
- #abraham_domain ⇒ Object
- #abraham_tour ⇒ Object
- #fetch_application_name ⇒ Object
Instance Method Details
#abraham_cookie_prefix ⇒ Object
27 28 29 |
# File 'app/helpers/abraham_helper.rb', line 27 def "abraham-#{fetch_application_name.to_s.underscore}-#{current_user.id}-#{controller_name}-#{action_name}" end |
#abraham_domain ⇒ Object
40 41 42 |
# File 'app/helpers/abraham_helper.rb', line 40 def abraham_domain request.host end |
#abraham_tour ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/helpers/abraham_helper.rb', line 4 def abraham_tour # Do we have tours for this controller/action in the user's locale? tours = Rails.configuration.abraham.tours["#{controller_name}.#{action_name}.#{I18n.locale}"] tours ||= Rails.configuration.abraham.tours["#{controller_name}.#{action_name}.#{I18n.default_locale}"] if tours completed = AbrahamHistory.where( creator_id: current_user.id, controller_name: controller_name, action_name: action_name ) remaining = tours.keys - completed.map(&:tour_name) if remaining.any? # Generate the javascript snippet for the next remaining tour render(partial: "application/abraham", locals: { tour_name: remaining.first, steps: tours[remaining.first]["steps"] }) end end end |
#fetch_application_name ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/helpers/abraham_helper.rb', line 31 def fetch_application_name if Module.method_defined?(:module_parent) Rails.application.class.module_parent else Rails.application.class.parent end end |