Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
refinerycms-calendar (2.0.1)
refinerycms-calendar (2.0.2)
refinerycms-core (~> 2.0.3)

GEM
Expand Down Expand Up @@ -84,7 +84,6 @@ GEM
activemodel (>= 3.0.0)
activerecord (>= 3.0.0)
paper_trail (~> 2)
growl (1.0.3)
guard (1.0.3)
ffi (>= 0.5.0)
thor (>= 0.14.6)
Expand All @@ -98,6 +97,8 @@ GEM
railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.7.3)
libnotify (0.1.4)
ffi (>= 0.6.2)
libwebsocket (0.1.3)
addressable
mail (2.4.4)
Expand Down Expand Up @@ -137,7 +138,8 @@ GEM
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
rb-fsevent (0.9.1)
rb-inotify (0.8.8)
ffi (>= 0.5.0)
rdoc (3.12)
json (~> 1.4)
refinerycms (2.0.3)
Expand Down Expand Up @@ -245,14 +247,14 @@ DEPENDENCIES
coffee-rails
factory_girl_rails
generator_spec
growl (~> 1.0.3)
guard-spork
jquery-rails
jruby-openssl
libnotify (~> 0.1.3)
mysql2
pg
rb-fchange (~> 0.0.5)
rb-fsevent (>= 0.3.9)
rb-inotify (>= 0.5.1)
rb-notifu (~> 0.0.4)
refinerycms (~> 2.0.0)
refinerycms-calendar!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class EventsController < ::Refinery::AdminController
crudify :'refinery/calendar/event',
:xhr_paging => true,
:sortable => false,
:order => "'from' DESC"
:order => "start_at DESC"

private
def find_venues
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/refinery/calendar/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Refinery
module Calendar
class EventsController < ::ApplicationController
def index
@events = Event.upcoming.order('refinery_calendar_events.from DESC')
@events = Event.upcoming.order('refinery_calendar_events.start_at DESC')

# you can use meta fields from your model instead (e.g. browser_title)
# by swapping @page for @event in the line below:
Expand All @@ -18,7 +18,7 @@ def show
end

def archive
@events = Event.archive.order('refinery_calendar_events.from DESC')
@events = Event.archive.order('refinery_calendar_events.start_at DESC')
render :template => 'refinery/calendar/events/index'
end

Expand Down
6 changes: 3 additions & 3 deletions app/models/refinery/calendar/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Event < Refinery::Core::BaseModel

validates :title, :presence => true, :uniqueness => true

attr_accessible :title, :from, :to, :registration_link,
attr_accessible :title, :start_at, :end_at, :registration_link,
:venue_id, :excerpt, :description,
:featured, :position

Expand All @@ -20,15 +20,15 @@ class Event < Refinery::Core::BaseModel

class << self
def upcoming
where('refinery_calendar_events.from >= ?', Time.now)
where('refinery_calendar_events.start_at >= ?', Time.now)
end

def featured
where(:featured => true)
end

def archive
where('refinery_calendar_events.from < ?', Time.now)
where('refinery_calendar_events.end_at < ?', Time.now)
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions app/views/refinery/calendar/admin/events/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
</div>

<div class='field'>
<%= f.label :from -%>
<%= f.text_field :from, :class => 'datetime_range' -%>
<%= f.label :start_at -%>
<%= f.text_field :start_at, :class => 'datetime_range' -%>
</div>

<div class='field'>
<%= f.label :to -%>
<%= f.text_field :to, :class => 'datetime_range' -%>
<%= f.label :end_at -%>
<%= f.text_field :end_at, :class => 'datetime_range' -%>
</div>

<div class='field'>
Expand Down
4 changes: 2 additions & 2 deletions app/views/refinery/calendar/events/_event.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= div_for event do -%>
<time class="date" datetime="<%= event.from %>">
<%= event.from.strftime('%b %d').html_safe %>
<time class="date" datetime="<%= event.start_at %>">
<%= event.start_at.strftime('%b %d').html_safe %>
</time>

<h1><%= link_to event.title, refinery.calendar_event_path(event) %></h1>
Expand Down
4 changes: 2 additions & 2 deletions app/views/refinery/calendar/events/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<h4>Event details</h4>
<h5><%= @event.venue_name %></h5>

<p>From <%= @event.from.strftime('%B %d, %Y %I:%M%p') %> to
<br><%= @event.to.strftime('%B %d, %Y %I:%M%p') %></p>
<p>From<%= @event.start_at.strftime('%B %d, %Y %I:%M%p') %> to
<br><%= @event.end_at.strftime('%B %d, %Y %I:%M%p') %></p>

<% if @event.registration_link.present? %>
<p><%= link_to 'Register for this event', @event.registration_link %></p>
Expand Down
4 changes: 2 additions & 2 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ en:
phone: Phone
refinery/calendar/event:
title: Title
from: From
to: To
start_at: From
end_at: To
registration_link: Registration Link
excerpt: Excerpt
description: Description
4 changes: 2 additions & 2 deletions config/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ es:
phone: Phone
refinery/calendar/event:
title: Title
from: From
to: To
start_at: From
end_at: To
registration_link: Registration Link
excerpt: Excerpt
description: Description
4 changes: 2 additions & 2 deletions config/locales/fr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ fr:
phone: Phone
refinery/calendar/event:
title: Title
from: From
to: To
start_at: From
end_at: To
registration_link: Registration Link
excerpt: Excerpt
description: Description
4 changes: 2 additions & 2 deletions config/locales/nb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ nb:
phone: Phone
refinery/calendar/event:
title: Title
from: From
to: To
start_at: From
end_at: To
registration_link: Registration Link
excerpt: Excerpt
description: Description
4 changes: 2 additions & 2 deletions config/locales/nl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ nl:
phone: Phone
refinery/calendar/event:
title: Title
from: From
to: To
start_at: From
end_at: To
registration_link: Registration Link
excerpt: Excerpt
description: Description
4 changes: 2 additions & 2 deletions db/migrate/1_create_calendar_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class CreateCalendarEvents < ActiveRecord::Migration
def up
create_table :refinery_calendar_events do |t|
t.string :title
t.date :from
t.date :to
t.time :start_at

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I believe you'll want t.datetime instead, no?

t.time :end_at
t.string :registration_link
t.string :excerpt
t.text :description
Expand Down