radiant-event_calendar-extension 1.3.9 → 1.4.0
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 +19 -19
- data/app/models/event.rb +41 -30
- data/app/models/event_calendar_page.rb +5 -9
- data/app/views/admin/calendars/_form.html.haml +12 -12
- data/app/views/admin/calendars/edit.html.haml +2 -3
- data/app/views/admin/calendars/index.html.haml +9 -9
- data/app/views/admin/calendars/new.html.haml +3 -4
- data/app/views/admin/calendars/show.html.haml +6 -6
- data/app/views/admin/event_venues/_event_venue.html.haml +2 -2
- data/app/views/admin/event_venues/_form.html.haml +13 -13
- data/app/views/admin/event_venues/edit.html.haml +6 -6
- data/app/views/admin/event_venues/index.html.haml +9 -8
- data/app/views/admin/event_venues/new.html.haml +6 -6
- data/app/views/admin/event_venues/remove.html.haml +12 -11
- data/app/views/admin/events/_event.html.haml +1 -1
- data/app/views/admin/events/_form.html.haml +21 -20
- data/app/views/admin/events/edit.html.haml +2 -2
- data/app/views/admin/events/index.html.haml +12 -12
- data/app/views/admin/events/remove.html.haml +8 -9
- data/app/views/events/_event.html.haml +11 -8
- data/app/views/events/_faceting.html.haml +6 -13
- data/app/views/events/_minicalendar.html.haml +3 -3
- data/app/views/events/_views.html.haml +5 -4
- data/app/views/events/index.html.haml +9 -9
- data/config/locales/de.yml +213 -0
- data/config/locales/en.yml +212 -6
- data/event_calendar_extension.rb +12 -6
- data/lib/calendar_period.rb +23 -18
- data/lib/event_calendar_tags.rb +13 -7
- data/radiant-event_calendar-extension.gemspec +3 -2
- metadata +6 -5
data/event_calendar_extension.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class EventCalendarExtension < Radiant::Extension
|
2
|
-
version "1.
|
2
|
+
version "1.4.0"
|
3
3
|
description "An event calendar extension that administers events locally or draws them from any ical or CalDAV publishers (Google Calendar, .Mac, Darwin Calendar Server, etc.)"
|
4
4
|
url "http://github.com/radiant/radiant-event_calendar-extension"
|
5
5
|
|
@@ -26,14 +26,20 @@ class EventCalendarExtension < Radiant::Extension
|
|
26
26
|
admin.event_venue = Radiant::AdminUI.load_default_event_venue_regions
|
27
27
|
end
|
28
28
|
|
29
|
+
if admin.respond_to? :dashboard
|
30
|
+
admin.dashboard.index.add :main, "coming_events"
|
31
|
+
else
|
32
|
+
Rails.logger.warn "NO DASHBOARD!"
|
33
|
+
end
|
34
|
+
|
29
35
|
if respond_to?(:tab)
|
30
|
-
tab(
|
31
|
-
add_item(
|
32
|
-
add_item(
|
33
|
-
add_item(
|
36
|
+
tab('calendar') do
|
37
|
+
add_item('events', '/admin/event_calendar')
|
38
|
+
add_item('calendars', '/admin/event_calendar/calendars')
|
39
|
+
add_item('locations', '/admin/event_calendar/event_venues')
|
34
40
|
end
|
35
41
|
else
|
36
|
-
admin.tabs.add
|
42
|
+
admin.tabs.add 'calendar', '/admin/event_calendar', :after => "Snippets", :visibility => [:all]
|
37
43
|
end
|
38
44
|
|
39
45
|
end
|
data/lib/calendar_period.rb
CHANGED
@@ -64,12 +64,15 @@ class CalendarPeriod
|
|
64
64
|
# descriptions
|
65
65
|
|
66
66
|
def to_s
|
67
|
-
|
67
|
+
I18n.t 'calendar_period.to_s',
|
68
|
+
:distance_of_time_in_words => distance_of_time_in_words(start, finish),
|
69
|
+
:start => (I18n.l start, :format => :default)
|
68
70
|
end
|
69
71
|
|
70
72
|
def inspect
|
71
|
-
|
72
|
-
|
73
|
+
I18n.t 'calendar_period.inspect',
|
74
|
+
:describe_start => describe_start(:calendar_period_describe_detailed),
|
75
|
+
:describe_finish => describe_finish(:calendar_period_describe_detailed)
|
73
76
|
end
|
74
77
|
|
75
78
|
[:day, :week, :month, :year].each do |period|
|
@@ -81,36 +84,38 @@ class CalendarPeriod
|
|
81
84
|
def describe_start(date_format=nil)
|
82
85
|
if start
|
83
86
|
unless date_format
|
84
|
-
date_format =
|
85
|
-
date_format
|
87
|
+
date_format = :calendar_period_describe
|
88
|
+
date_format = :calendar_period_describe_with_year unless start.year == Time.now.year
|
86
89
|
end
|
87
|
-
start
|
90
|
+
I18n.l start, :format => date_format
|
88
91
|
end
|
89
92
|
end
|
90
93
|
|
91
94
|
def describe_finish(date_format=nil)
|
92
95
|
if finish
|
93
96
|
unless date_format
|
94
|
-
date_format =
|
95
|
-
date_format
|
97
|
+
date_format = :calendar_period_describe
|
98
|
+
date_format = :calendar_period_describe_with_year unless finish.year == Time.now.year
|
96
99
|
end
|
97
|
-
finish
|
100
|
+
I18n.l finish, :format => date_format
|
98
101
|
end
|
99
102
|
end
|
100
103
|
|
101
104
|
def description
|
102
|
-
return
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
return
|
107
|
-
return
|
108
|
-
|
105
|
+
return I18n.t 'calendar_period.description_day',
|
106
|
+
:day => I18n.l(start, :format => "%d"),
|
107
|
+
:monthname => I18n.l(start ? start : finish, :format => "%B"),
|
108
|
+
:year => I18n.l(start, :format => "%Y") if is_day?
|
109
|
+
return I18n.l start, :format => :calendar_period_description_week if is_week?
|
110
|
+
return I18n.l start, :format => :calendar_period_description_month if is_month?
|
111
|
+
return I18n.l start, :format => :calendar_period_description_year if is_year?
|
112
|
+
return I18n.t 'calendar_period.onwards', :describe_start => describe_start unless finish
|
113
|
+
return I18n.t 'calendar_period.until', :describe_finish => describe_finish unless start
|
114
|
+
I18n.t 'calendar_period.between', :describe_finish => describe_finish, :describe_start => describe_start
|
109
115
|
end
|
110
116
|
|
111
117
|
def monthname
|
112
|
-
|
113
|
-
Date::MONTHNAMES[i]
|
118
|
+
I18n.l(start ? start : finish, :format => "%B")
|
114
119
|
end
|
115
120
|
|
116
121
|
# to expand the period to full calendar months
|
data/lib/event_calendar_tags.rb
CHANGED
@@ -225,12 +225,12 @@ module EventCalendarTags
|
|
225
225
|
<pre><code><r:calendars:each>...</r:calendars:each></code></pre>
|
226
226
|
}
|
227
227
|
tag 'calendars' do |tag|
|
228
|
-
tag.locals.calendars ||= set_calendars(tag)
|
229
228
|
tag.expand
|
230
229
|
end
|
231
230
|
|
232
231
|
tag 'calendars:each' do |tag|
|
233
232
|
result = []
|
233
|
+
tag.locals.calendars ||= set_calendars(tag)
|
234
234
|
tag.locals.calendars.each do |cal|
|
235
235
|
tag.locals.calendar = cal
|
236
236
|
result << tag.expand
|
@@ -558,7 +558,7 @@ module EventCalendarTags
|
|
558
558
|
}
|
559
559
|
tag "event:#{attribute}" do |tag|
|
560
560
|
date = tag.locals.event.send("#{attribute}_date")
|
561
|
-
date
|
561
|
+
I18n.l date, :format => tag.attr['format'] || "%H:%M"
|
562
562
|
end
|
563
563
|
desc %{
|
564
564
|
Renders the #{attribute} date (or time) of the current event as ordinal day, month.
|
@@ -568,7 +568,13 @@ module EventCalendarTags
|
|
568
568
|
}
|
569
569
|
tag "event:#{attribute}_date" do |tag|
|
570
570
|
date = tag.locals.event.send("#{attribute}_date")
|
571
|
-
|
571
|
+
# checkout for i18n http://info.michael-simons.eu/2009/02/12/localizing-dates-and-time-with-rails-i18n-using-procs/
|
572
|
+
case I18n.locale
|
573
|
+
when :en
|
574
|
+
%{#{date.mday.ordinalize} #{Date::MONTHNAMES[date.month]}}
|
575
|
+
default
|
576
|
+
I18n.l date, :format => "%d. %M"
|
577
|
+
end
|
572
578
|
end
|
573
579
|
end
|
574
580
|
|
@@ -588,7 +594,7 @@ module EventCalendarTags
|
|
588
594
|
</code></pre>
|
589
595
|
}
|
590
596
|
tag "event:date" do |tag|
|
591
|
-
tag.locals.event.start_date
|
597
|
+
I18n.l tag.locals.event.start_date, :format => tag.attr['format'] || "%m/%d/%Y"
|
592
598
|
end
|
593
599
|
|
594
600
|
desc %{
|
@@ -600,7 +606,7 @@ module EventCalendarTags
|
|
600
606
|
<pre><code><r:event:weekday [short="true"] /></code></pre>
|
601
607
|
}
|
602
608
|
tag "event:weekday" do |tag|
|
603
|
-
tag.attr['short'] == 'true' ?
|
609
|
+
tag.attr['short'] == 'true' ? (I18n.l tag.locals.event.start_date, :format => "%a") : (I18n.l tag.locals.event.start_date, :format => "%A" )
|
604
610
|
end
|
605
611
|
|
606
612
|
desc %{
|
@@ -649,7 +655,7 @@ module EventCalendarTags
|
|
649
655
|
<pre><code><r:event:month /></code></pre>
|
650
656
|
}
|
651
657
|
tag "event:month" do |tag|
|
652
|
-
|
658
|
+
I18n.l tag.locals.event.start_date, :format => "%B"
|
653
659
|
end
|
654
660
|
|
655
661
|
desc %{
|
@@ -846,7 +852,7 @@ module EventCalendarTags
|
|
846
852
|
cell_class += " eventful"
|
847
853
|
cell_class += " eventful_weekend" if weekend?(day)
|
848
854
|
cell_class += events_today.map{|e| " #{e.slug}"}.join
|
849
|
-
event_list << %{<ul>} << events_today.map { |e| %{<li><span class="time">#{e.
|
855
|
+
event_list << %{<ul>} << events_today.map { |e| %{<li><span class="time">#{e.start_time}:</span> #{e.title}</li>} }.join << "</ul>"
|
850
856
|
else
|
851
857
|
cell_class += " uneventful"
|
852
858
|
end
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{radiant-event_calendar-extension}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["spanner"]
|
12
|
-
s.date = %q{2011-04
|
12
|
+
s.date = %q{2011-05-04}
|
13
13
|
s.description = %q{An event calendar extension that administers events locally or draws them from any ical or CalDAV publishers (Google Calendar, .Mac, Darwin Calendar Server, etc.)}
|
14
14
|
s.email = %q{will@spanner.org}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -65,6 +65,7 @@ Gem::Specification.new do |s|
|
|
65
65
|
"app/views/events/index.html.haml",
|
66
66
|
"app/views/events/index.ics.erb",
|
67
67
|
"app/views/events/index.rss.builder",
|
68
|
+
"config/locales/de.yml",
|
68
69
|
"config/locales/en.yml",
|
69
70
|
"config/routes.rb",
|
70
71
|
"db/migrate/001_create_calendar_and_events.rb",
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: radiant-event_calendar-extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 1.
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 1.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- spanner
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-04
|
18
|
+
date: 2011-05-04 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- app/views/events/index.html.haml
|
149
149
|
- app/views/events/index.ics.erb
|
150
150
|
- app/views/events/index.rss.builder
|
151
|
+
- config/locales/de.yml
|
151
152
|
- config/locales/en.yml
|
152
153
|
- config/routes.rb
|
153
154
|
- db/migrate/001_create_calendar_and_events.rb
|