Module: AbrahamHelper
- Includes:
- FlipperHelper
- 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
Methods included from FlipperHelper
Instance Method Details
#abraham_cookie_prefix ⇒ Object
42 43 44 |
# File 'app/helpers/abraham_helper.rb', line 42 def "abraham-#{fetch_application_name.to_s.underscore}-#{current_user.id}-#{controller_path}-#{action_name}" end |
#abraham_domain ⇒ Object
54 55 56 |
# File 'app/helpers/abraham_helper.rb', line 54 def abraham_domain request.host end |
#abraham_tour ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'app/helpers/abraham_helper.rb', line 6 def abraham_tour # Do we have tours for this controller/action in the user's locale? tours = Rails.configuration.abraham.tours["#{controller_path}.#{action_name}.#{I18n.locale}"] # Otherwise, default to the default locale tours ||= Rails.configuration.abraham.tours["#{controller_path}.#{action_name}.#{I18n.default_locale}"] if tours # Have any automatic tours been completed already? completed = AbrahamHistory.where( creator_id: current_user.id, controller_name: controller_path, action_name: action_name ) tour_keys_completed = completed.map(&:tour_name) tour_keys = tours.keys tour_html = '' tour_keys.each do |key| flipper_key = tours[key]["flipper_key"] flipper_activation = tours[key]["flipper_activation"] if should_add_tour(flipper_key, flipper_activation) tour_html += render(partial: "application/abraham", locals: { tour_name: key, tour_completed: tour_keys_completed.include?(key), trigger: tours[key]["trigger"], steps: tours[key]["steps"] }) end end tour_html.html_safe end end |
#fetch_application_name ⇒ Object
46 47 48 49 50 51 52 |
# File 'app/helpers/abraham_helper.rb', line 46 def fetch_application_name if Module.method_defined?(:module_parent) Rails.application.class.module_parent else Rails.application.class.parent end end |