Class: ContentProviders::AwakePeriodForm
- Inherits:
-
BitCore::ContentProvider
- Object
- BitCore::ContentProvider
- ContentProviders::AwakePeriodForm
- Defined in:
- app/models/content_providers/awake_period_form.rb
Overview
Provides a form for a Participant to enter the most recent AwakePeriod.
Instance Method Summary collapse
- #data_attributes ⇒ Object
- #data_class_name ⇒ Object
- #render_current(options) ⇒ Object
- #show_nav_link? ⇒ Boolean
Instance Method Details
#data_attributes ⇒ Object
34 35 36 |
# File 'app/models/content_providers/awake_period_form.rb', line 34 def data_attributes [:start_time, :end_time] end |
#data_class_name ⇒ Object
30 31 32 |
# File 'app/models/content_providers/awake_period_form.rb', line 30 def data_class_name "AwakePeriod" end |
#render_current(options) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/models/content_providers/awake_period_form.rb', line 5 def render_current() participant = .view_context.current_participant if participant.unfinished_awake_periods.exists? .view_context.render( template: "think_feel_do_engine/awake_periods/incomplete", locals: { participant: participant } ) else last_awake_time = participant.awake_periods.order("start_time").last .view_context.render( template: "think_feel_do_engine/awake_periods/new", locals: { awake_period: participant.awake_periods.build, create_path: .view_context.participant_data_path, participant: participant, wake_up_range: wake_up_range(last_awake_time), go_to_sleep_range: go_to_sleep_range(last_awake_time) } ) end end |
#show_nav_link? ⇒ Boolean
38 39 40 |
# File 'app/models/content_providers/awake_period_form.rb', line 38 def show_nav_link? false end |