Sha256: f44c43b4a3fb3f448407f19ce86f29909ca6a188ace258ff5d43ce94cd4896fc

Contents?: true

Size: 1004 Bytes

Versions: 13

Compression:

Stored size: 1004 Bytes

Contents

# frozen_string_literal: true
module ContentProviders
  # Provides a form for a Participant to schedule new Activities that have
  # been fun in the past.
  class CreateActivity < BitCore::ContentProvider
    def render_current(options)
      options.view_context.render(
        template: "think_feel_do_engine/activities/create_activity",
        locals: {
          past_activities: activities(options.participant),
          create_path: options.view_context.participant_data_path
        }
      )
    end

    def data_attributes
      [
        :activity_type_title,
        :activity_type_new_title,
        :predicted_pleasure_intensity,
        :predicted_accomplishment_intensity,
        :start_time
      ]
    end

    def data_class_name
      "PlannedActivity"
    end

    def show_nav_link?
      false
    end

    private

    def activities(participant)
      participant.activities
                 .random
                 .in_the_past
                 .first(5)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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