Sha256: cef65053ff18a8c534800000417409b43c0a7c031bb83b579ed783bb7e0a4c48

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true
module ThinkFeelDoEngine
  module Coach
    # Provides helpers for coach message composition.
    module MessagesHelper
      # Returns grouped options for selecting a section of the site.
      def options_for_site_link_select
        tasks = @group.tasks
        options = tasks.map do |task|
          content_module = BitCore::ContentModule
                           .find(task.bit_core_content_module_id)
          title = content_module.title
          [title, navigator_location_path(module_id: content_module.id)]
        end

        insert_intro_slideshow_anchor(options)
      end

      private

      def insert_intro_slideshow_anchor(options)
        if (slideshow = SlideshowAnchor.fetch(:home_intro))
          path = ThinkFeelDoEngine::Engine
                 .routes.url_helpers
                 .participants_public_slideshow_slide_path(
                   slideshow_id: slideshow.id,
                   id: slideshow.slides.first.id
                 )

          options.unshift(["Intro", [["Introduction to ThinkFeelDo", path]]])
        else
          options
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.22.8 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.22.7 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.22.6 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.22.5 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.22.4 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.22.2 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.22.1 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.22.0 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.21.2 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.21.1 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.21.0 app/helpers/think_feel_do_engine/coach/messages_helper.rb
think_feel_do_engine-3.20.1 app/helpers/think_feel_do_engine/coach/messages_helper.rb