Sha256: 3620c60ed95142ebe8b1795a5f7cc0c01a06dd062782d370442a1c6b8a90bace

Contents?: true

Size: 1.32 KB

Versions: 12

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true
module ContentProviders
  # Provides a set of links to ContentModules in the current context.
  class ModuleIndexProvider < BitCore::ContentProvider
    def render_current(options)
      content_modules = get_content_modules(options)
      participant = options.participant

      options.view_context.render(
        template: "think_feel_do_engine/participants/content_modules/index",
        locals: {
          participant: participant,
          content_modules: content_modules,
          didactic_modules: content_modules.non_visualization.didactic,
          non_didactic_modules: content_modules.non_visualization.not_didactic,
          membership: options
                        .view_context
                        .view_membership(participant, participant.active_group)
        }
      )
    end

    def show_nav_link?
      false
    end

    private

    def get_content_modules(options)
      arm_id = options.participant.active_group.arm_id
      tool = BitCore::Tool.find_by_arm_id_and_title(arm_id, options.app_context)

      AvailableContentModule
        .for_participant(options.participant)
        .for_tool(tool)
        .available_by(Time.zone.today)
        .excludes_module(bit_core_content_module_id)
        .not_terminated_on(Time.zone.today)
        .latest_duplicate
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
think_feel_do_engine-3.22.9 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.22.8 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.22.7 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.22.6 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.22.5 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.22.4 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.22.2 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.22.1 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.22.0 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.21.2 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.21.1 app/models/content_providers/module_index_provider.rb
think_feel_do_engine-3.21.0 app/models/content_providers/module_index_provider.rb