Skip to content

Conversation

kevinnio
Copy link

@kevinnio kevinnio commented Sep 7, 2017

This makes possible to control slides publication using timestamps. This adds three new behaviors:

  1. Slides where both starts_at and ends_at are defined are only shown if they are published and Time.current is between starts_at and ends_at.
  2. Slides that have only starts_at defined will be be shown only if they are published and starts_at is in the past.
  3. Slides where starts_at and ends_at are nil and are always shown if they are published.

Users can use the new in_time scope to get only the slides that are supposed to be visible at a given time.

Also, this adds fields to capture starts_at and ends_at for each slide in the admin UI.

end

def in_time?
Time.now.between?(starts_at || 1.second.ago, ends_at || 1.second.from_now)
Copy link

@dportalesr dportalesr Sep 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Favor the use of Time.current instead of Time.now

image
Source

@kevinnio kevinnio force-pushed the master branch 3 times, most recently from 291f144 to c3e15af Compare November 30, 2017 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants