event_calendar_engine 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/app/controllers/events_controller.rb +2 -3
- data/app/helpers/event_calendar/application_helper.rb +4 -4
- data/app/models/event.rb +1 -1
- data/app/views/events/_calendar.html.erb +1 -1
- data/app/views/events/_current_event.html.erb +2 -8
- data/app/views/events/_list.html.erb +2 -6
- data/app/views/events/_list_group.html.erb +4 -4
- data/app/views/events/_times.html.erb +4 -2
- data/config/initializers/constants.rb +1 -0
- data/public/javascripts/event_calendar/event_calendar.js +1 -0
- data/public/javascripts/event_calendar/event_calendar_behaviors.js +17 -1
- data/public/stylesheets/event_calendar/blueprint/screen.css +1 -0
- data/spec/controllers/events_controller_spec.rb +0 -5
- data/spec/helpers/event_calendar/application_helper_spec.rb +15 -0
- data/spec/models/event_spec.rb +3 -2
- metadata +7 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.11
|
@@ -46,9 +46,8 @@ class EventsController < EventCalendar::ApplicationController
|
|
46
46
|
if params[:start] && params[:end]
|
47
47
|
@events = Event.between(Time.at(params[:start].to_i), Time.at(params[:end].to_i))
|
48
48
|
else
|
49
|
-
@past_events = Event.past.order("start_on
|
50
|
-
@
|
51
|
-
@current_events = Event.current.order("start_on ASC")
|
49
|
+
@past_events = Event.past.order("start_on DESC")
|
50
|
+
@current_events = Event.current.order("start_on DESC")
|
52
51
|
end
|
53
52
|
|
54
53
|
respond_to do |format|
|
@@ -29,14 +29,14 @@ module EventCalendar::ApplicationHelper
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def time_with_zones(time=Time.now)
|
32
|
-
out =
|
33
|
-
format = "%H:%M"
|
32
|
+
out = []
|
34
33
|
ActiveSupport::TimeZone.us_zones.map(&:name).each do |us_zone|
|
35
34
|
next unless us_zone =~ /Pacific|Mountain|Central|Eastern/
|
36
35
|
key = time.in_time_zone(us_zone).strftime("%Z")
|
37
|
-
out[key] = time.in_time_zone(us_zone).strftime(format)
|
36
|
+
# out[key] = time.in_time_zone(us_zone).strftime(format)
|
37
|
+
out << [key, time.in_time_zone(us_zone).strftime(TIME_BASE)]
|
38
38
|
end
|
39
|
-
out
|
39
|
+
out.reverse
|
40
40
|
end
|
41
41
|
|
42
42
|
def times_with_zones(event)
|
data/app/models/event.rb
CHANGED
@@ -15,7 +15,7 @@ class Event < ActiveRecord::Base
|
|
15
15
|
|
16
16
|
scope :past, where(sanitize_sql_array(["end_on < '%s'", Date.current]))
|
17
17
|
scope :future, where(sanitize_sql_array(["start_on > '%s'", Date.current]))
|
18
|
-
scope :current, where(sanitize_sql_array(["end_on >= '%s'
|
18
|
+
scope :current, where(sanitize_sql_array(["end_on >= '%s'", Date.current]))
|
19
19
|
scope :between, lambda{ |start_datetime, end_datetime|
|
20
20
|
where(["start_on BETWEEN ? AND ? OR end_on BETWEEN ? AND ?",
|
21
21
|
start_datetime, end_datetime, start_datetime, end_datetime])
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<div style="clear:both"></div>
|
6
6
|
|
7
|
-
<div id="event_quick_description" class="span-
|
7
|
+
<div id="event_quick_description" class="span-16" style="display:none"></div>
|
8
8
|
|
9
9
|
<% content_for :javascript do %>
|
10
10
|
<script type="text/javascript">
|
@@ -1,10 +1,4 @@
|
|
1
1
|
<%- if current_event_counter == 0; then current_event_counter += 1; end -%>
|
2
|
-
<div class="span-
|
3
|
-
|
4
|
-
<%- if current_event.one_day? -%>
|
5
|
-
<%= render :partial => 'events/times', :object => times_with_zones(current_event) %>
|
6
|
-
<%- else -%>
|
7
|
-
<p><em><%= current_event.start_on.in_time_zone(current_event.timezone).strftime("%a, %b %d") %></em></p>
|
8
|
-
<p><em><%= current_event.end_on.in_time_zone(current_event.timezone).strftime("%a, %b %d") %></em></p>
|
9
|
-
<%- end -%>
|
2
|
+
<div class="span-4<%= current_event_counter % 3 == 0 ? ' last' : '' %>">
|
3
|
+
<%= render current_event %>
|
10
4
|
</div>
|
@@ -1,13 +1,9 @@
|
|
1
|
-
<div class="span-
|
1
|
+
<div class="span-8">
|
2
2
|
<h2>Current Events (<em><%= @current_events.count %></em>)</h2>
|
3
|
-
<%= render :partial => 'events/
|
3
|
+
<%= render :partial => 'events/list_group', :locals => {:events => @current_events} %>
|
4
4
|
</div>
|
5
5
|
<div class="span-8 last">
|
6
6
|
<h2>Past Events (<em><%= @past_events.count %></em>)</h2>
|
7
7
|
<%= render :partial => 'events/list_group', :locals => {:events => @past_events} %>
|
8
8
|
</div>
|
9
|
-
<div class="span-8">
|
10
|
-
<h2>Future Events (<em><%= @future_events.count %></em>)</h2>
|
11
|
-
<%= render :partial => 'events/list_group', :locals => {:events => @future_events} %>
|
12
|
-
</div>
|
13
9
|
<div style="clear:both;"></div>
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<ul class="events">
|
2
2
|
<% events.group_by(&:start_year).each do |year, years_events| %>
|
3
|
-
<li><%= year
|
4
|
-
<ul>
|
3
|
+
<li><span class="collapsible open"><%= year %></span>
|
4
|
+
<ul>
|
5
5
|
<% years_events.group_by(&:start_month).each do |month, months_events| %>
|
6
|
-
<li><%= month
|
6
|
+
<li><span class="collapsible closed"><%= month %></span>
|
7
7
|
<ul>
|
8
8
|
<% months_events.each do |event| %>
|
9
9
|
<li>
|
10
|
-
<p><%= link_to event.name, event_path(event)
|
10
|
+
<p class="collapsible closed"><%= link_to event.name, event_path(event) %> (<%= event.start_on.strftime("%a") %> <%= event.start_day.ordinalize %>)</p>
|
11
11
|
<%- if event.one_day? -%>
|
12
12
|
<%= render :partial => 'events/one_day_list_event', :object => event %>
|
13
13
|
<%- else -%>
|
@@ -1,3 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<%- t = [] -%>
|
2
|
+
<% times.first.each_with_index do |z_t, i| %>
|
3
|
+
<% t << "#{z_t.last} - #{times.last[i].last} " + content_tag(:em, z_t.first) %>
|
3
4
|
<% end %>
|
5
|
+
<p><%= t.join(" / ").html_safe %></p>
|
@@ -0,0 +1 @@
|
|
1
|
+
TIME_BASE = '%I:%M %p'
|
@@ -167,4 +167,20 @@ EventView = $.klass({
|
|
167
167
|
$('#event_list').show();
|
168
168
|
}
|
169
169
|
}
|
170
|
-
});
|
170
|
+
});
|
171
|
+
|
172
|
+
var Collapsible = $.klass({
|
173
|
+
initialize: function() {
|
174
|
+
this.element.find('.open').each(function(i, e) {
|
175
|
+
$(e).siblings().show();
|
176
|
+
});
|
177
|
+
this.element.find('.closed').each(function(i, e) {
|
178
|
+
$(e).siblings().hide();
|
179
|
+
});
|
180
|
+
},
|
181
|
+
onclick: $.delegate({
|
182
|
+
'.collapsible': function(clickedElement, event) {
|
183
|
+
clickedElement.siblings().toggle();
|
184
|
+
}
|
185
|
+
})
|
186
|
+
});
|
@@ -446,6 +446,7 @@ form.formtastic fieldset ol li.string input {width:69%;}
|
|
446
446
|
form.formtastic fieldset ol li.text textarea {width:69%;height:70px;}
|
447
447
|
form.formtastic fieldset ol li.check_boxes fieldset ol li label {font-weight:normal;padding-left:40px;}
|
448
448
|
form.formtastic fieldset ol li p.inline-hints {color:#666666;font-size:11px;margin:0.3em 0 0 25%;}
|
449
|
+
.collapsible {cursor:pointer;}
|
449
450
|
.base_content {background:#fff;}
|
450
451
|
.inner_content {padding:16px;}
|
451
452
|
.top-banner {background:#336;-webkit-border-bottom-left-radius:8px;-moz-border-radius-bottomleft:8px;border-bottom-left-radius:8px;}
|
@@ -21,7 +21,6 @@ describe EventsController do
|
|
21
21
|
subject.stub(:find).with("37"){ event }
|
22
22
|
subject.stub_chain(:past, :order){ ['past'] }
|
23
23
|
subject.stub_chain(:current, :order){ ['current'] }
|
24
|
-
subject.stub_chain(:future, :order){ ['future'] }
|
25
24
|
end
|
26
25
|
|
27
26
|
describe "GET index" do
|
@@ -33,10 +32,6 @@ describe EventsController do
|
|
33
32
|
get :index
|
34
33
|
assigns(:current_events).should eq ['current']
|
35
34
|
end
|
36
|
-
it "assigns future events as @future_events" do
|
37
|
-
get :index
|
38
|
-
assigns(:future_events).should eq ['future']
|
39
|
-
end
|
40
35
|
end
|
41
36
|
|
42
37
|
describe "GET index as json" do
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe EventCalendar::ApplicationHelper do
|
4
|
+
describe "time_with_zones (singular)" do
|
5
|
+
it "returns times" do
|
6
|
+
time = Time.now
|
7
|
+
helper.time_with_zones(time).should eq [
|
8
|
+
["EST", time.in_time_zone("Eastern Time (US & Canada)").strftime(TIME_BASE)],
|
9
|
+
["CST", time.in_time_zone("Central Time (US & Canada)").strftime(TIME_BASE)],
|
10
|
+
["MST", time.in_time_zone("Mountain Time (US & Canada)").strftime(TIME_BASE)],
|
11
|
+
["PST", time.in_time_zone("Pacific Time (US & Canada)").strftime(TIME_BASE)]
|
12
|
+
]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/models/event_spec.rb
CHANGED
@@ -29,8 +29,9 @@ describe Event do
|
|
29
29
|
Event.future.first.should eql @mar_2100
|
30
30
|
end
|
31
31
|
|
32
|
-
it "Event.current finds current events" do
|
33
|
-
Event.current.
|
32
|
+
it "Event.current finds current events (in progress and future)" do
|
33
|
+
Event.current.should include @current
|
34
|
+
Event.current.should include @mar_2100
|
34
35
|
end
|
35
36
|
|
36
37
|
it "Event.between finds events between limits" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: event_calendar_engine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 11
|
10
|
+
version: 0.1.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jason LaPier
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2011-01-
|
19
|
+
date: 2011-01-27 00:00:00 -08:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -446,6 +446,7 @@ files:
|
|
446
446
|
- config/environments/production.rb
|
447
447
|
- config/environments/test.rb
|
448
448
|
- config/initializers/backtrace_silencers.rb
|
449
|
+
- config/initializers/constants.rb
|
449
450
|
- config/initializers/formtastic.rb
|
450
451
|
- config/initializers/inflections.rb
|
451
452
|
- config/initializers/mime_types.rb
|
@@ -547,6 +548,7 @@ files:
|
|
547
548
|
- spec/controllers/event_revisions_controller_spec.rb
|
548
549
|
- spec/controllers/events_controller_spec.rb
|
549
550
|
- spec/fixtures/event_calendar_events.yml
|
551
|
+
- spec/helpers/event_calendar/application_helper_spec.rb
|
550
552
|
- spec/models/deletable_instance_methods_spec.rb
|
551
553
|
- spec/models/event_revision_spec.rb
|
552
554
|
- spec/models/event_spec.rb
|
@@ -591,6 +593,7 @@ test_files:
|
|
591
593
|
- spec/controllers/event_revisions_controller_spec.rb
|
592
594
|
- spec/controllers/events_controller_spec.rb
|
593
595
|
- spec/fixtures/event_calendar_events.yml
|
596
|
+
- spec/helpers/event_calendar/application_helper_spec.rb
|
594
597
|
- spec/models/deletable_instance_methods_spec.rb
|
595
598
|
- spec/models/event_revision_spec.rb
|
596
599
|
- spec/models/event_spec.rb
|