Sha256: 771ee34f6257234082d01695ea3375cc2e9c2a65c259a1539717aa9c5f4be9d5

Contents?: true

Size: 662 Bytes

Versions: 23

Compression:

Stored size: 662 Bytes

Contents

module WithStudentPathNavigation
  def next_button(navigable)
    return unless navigable
    navigation_flows.lazy.map { |it| it.new(self).button(navigable) }.find(&:present?)
  end

  def next_lesson_button(guide)
    next_button(guide.lesson) || chapter_finished(guide.chapter)
  end

  def next_exercise_button(exercise)
    next_button(exercise) || next_button(exercise.guide.lesson)
  end

  def close_modal_button
    %Q{<button class="btn btn-complementary w-100 mu-close-modal">#{t :keep_learning}</button>}.html_safe
  end

  private

  def navigation_flows
    [ContinueNavigation, RevisitNavigation, NextParentNavigation, FinishNavigation]
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
mumuki-laboratory-9.1.2 app/helpers/concerns/with_student_path_navigation.rb
mumuki-laboratory-9.1.1 app/helpers/concerns/with_student_path_navigation.rb
mumuki-laboratory-9.1.0 app/helpers/concerns/with_student_path_navigation.rb