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
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?
render(partial: "application/abraham",
locals: { tour_name: remaining.first,
steps: tours[remaining.first]["steps"] })
end
end
end
|