refinerycms-events 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module EventsHelper
|
2
2
|
def datetime(d)
|
3
3
|
I18n.localize(d, :format => "%B %d, %Y %l:%M %p")
|
4
4
|
end
|
@@ -49,11 +49,15 @@ module CalendarsHelper
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
def event_list
|
52
|
+
def event_list(options = Hash.new)
|
53
53
|
grouped_events = Event.
|
54
|
-
all(:limit => 10, :order => 'start_at ASC',
|
55
|
-
:conditions => [ 'start_at >= ?', Time.now ]).
|
54
|
+
all(:limit => options.fetch(:limit) { 10 }, :order => 'start_at ASC',
|
55
|
+
:conditions => [ 'start_at >= ? || end_at >= ?', Time.now, Time.now ]).
|
56
56
|
group_by { |e| e.start_at.to_date }
|
57
|
-
|
57
|
+
|
58
|
+
render(:partial => '/events/event_list',
|
59
|
+
:object => grouped_events,
|
60
|
+
:locals => { :heading => options[:heading],
|
61
|
+
:see_more_link => options.fetch(:see_more_link) { 'View the calendar' } } )
|
58
62
|
end
|
59
63
|
end
|
@@ -1,20 +1,23 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
<
|
4
|
-
|
5
|
-
<
|
6
|
-
|
7
|
-
<
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
<% unless event_list.blank? -%>
|
2
|
+
<%= content_tag('h1', heading) if heading %>
|
3
|
+
<dl class="event-list">
|
4
|
+
<% event_list.each do |d, events| -%>
|
5
|
+
<dt><%= date(d) %></dt>
|
6
|
+
<dd>
|
7
|
+
<ul>
|
8
|
+
<% events.each do |e| -%>
|
9
|
+
<li class="event">
|
10
|
+
<%= link_to(event_title(e), event_path(e)) %>
|
11
|
+
<% unless e.location.blank? -%>
|
12
|
+
@ <%= h(e.location) %>
|
13
|
+
<% end -%>
|
14
|
+
</li>
|
15
|
+
<% end -%>
|
16
|
+
</ul>
|
13
17
|
<% end -%>
|
14
|
-
</
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
</dl>
|
18
|
+
</dd>
|
19
|
+
<dt>
|
20
|
+
<%= link_to(see_more_link, events_path) %>
|
21
|
+
</dt>
|
22
|
+
</dl>
|
23
|
+
<% end -%>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: refinerycms-events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SemanticGap
|
@@ -48,7 +48,7 @@ files:
|
|
48
48
|
- app/models/event.rb
|
49
49
|
- app/controllers/events_controller.rb
|
50
50
|
- app/controllers/admin/events_controller.rb
|
51
|
-
- app/helpers/
|
51
|
+
- app/helpers/events_helper.rb
|
52
52
|
- app/views/events/index.html.erb
|
53
53
|
- app/views/events/show.html.erb
|
54
54
|
- app/views/events/_event_list.html.erb
|