refinerycms-sl-calendar 2.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/app/controllers/refinery/calendar/admin/events_controller.rb +20 -0
  2. data/app/controllers/refinery/calendar/admin/venues_controller.rb +15 -0
  3. data/app/controllers/refinery/calendar/events_controller.rb +38 -0
  4. data/app/helpers/refinery/calendar/calendar_helper.rb +246 -0
  5. data/app/models/refinery/calendar/event.rb +60 -0
  6. data/app/models/refinery/calendar/venue.rb +17 -0
  7. data/app/views/refinery/calendar/admin/events/_actions.html.erb +26 -0
  8. data/app/views/refinery/calendar/admin/events/_event.html.erb +28 -0
  9. data/app/views/refinery/calendar/admin/events/_events.html.erb +2 -0
  10. data/app/views/refinery/calendar/admin/events/_form.html.erb +86 -0
  11. data/app/views/refinery/calendar/admin/events/_records.html.erb +18 -0
  12. data/app/views/refinery/calendar/admin/events/_sortable_list.html.erb +5 -0
  13. data/app/views/refinery/calendar/admin/events/edit.html.erb +1 -0
  14. data/app/views/refinery/calendar/admin/events/index.html.erb +8 -0
  15. data/app/views/refinery/calendar/admin/events/new.html.erb +1 -0
  16. data/app/views/refinery/calendar/admin/shared/_links.html.erb +8 -0
  17. data/app/views/refinery/calendar/admin/shared/_locale_picker.html.erb +11 -0
  18. data/app/views/refinery/calendar/admin/venues/_actions.html.erb +26 -0
  19. data/app/views/refinery/calendar/admin/venues/_form.html.erb +36 -0
  20. data/app/views/refinery/calendar/admin/venues/_records.html.erb +18 -0
  21. data/app/views/refinery/calendar/admin/venues/_sortable_list.html.erb +5 -0
  22. data/app/views/refinery/calendar/admin/venues/_venue.html.erb +23 -0
  23. data/app/views/refinery/calendar/admin/venues/_venues.html.erb +2 -0
  24. data/app/views/refinery/calendar/admin/venues/edit.html.erb +1 -0
  25. data/app/views/refinery/calendar/admin/venues/index.html.erb +8 -0
  26. data/app/views/refinery/calendar/admin/venues/new.html.erb +1 -0
  27. data/app/views/refinery/calendar/events/_event.html.erb +8 -0
  28. data/app/views/refinery/calendar/events/index.html.erb +15 -0
  29. data/app/views/refinery/calendar/events/show.html.erb +28 -0
  30. data/app/views/sitemap/index.xml.builder +25 -0
  31. data/config/database.yml.mysql +20 -0
  32. data/config/database.yml.postgresql +58 -0
  33. data/config/database.yml.sqlite3 +18 -0
  34. data/config/initializers/refinery/authentication.rb +4 -0
  35. data/config/initializers/refinery/core.rb +50 -0
  36. data/config/initializers/refinery/images.rb +44 -0
  37. data/config/initializers/refinery/pages.rb +52 -0
  38. data/config/initializers/refinery/resources.rb +26 -0
  39. data/config/locales/en.yml +61 -0
  40. data/config/locales/es.yml +59 -0
  41. data/config/locales/fr.yml +57 -0
  42. data/config/locales/nb.yml +59 -0
  43. data/config/locales/nl.yml +59 -0
  44. data/config/routes.rb +31 -0
  45. data/db/migrate/1_create_calendar_events.rb +34 -0
  46. data/db/migrate/2_create_calendar_venues.rb +29 -0
  47. data/db/migrate/3_create_calendar_events_translations.rb +16 -0
  48. data/db/migrate/4_create_calendar_venues_translations.rb +13 -0
  49. data/db/seeds.rb +26 -0
  50. data/lib/generators/refinery/calendar_generator.rb +19 -0
  51. data/lib/refinery/events/engine.rb +26 -0
  52. data/lib/refinery/events.rb +21 -0
  53. data/lib/refinery/venues/engine.rb +14 -0
  54. data/lib/refinery/venues.rb +21 -0
  55. data/lib/refinerycms-calendar.rb +2 -0
  56. data/lib/tasks/refinery/calendar.rake +13 -0
  57. data/readme.md +23 -0
  58. data/vendor/assets/images/chosen-sprite.png +0 -0
  59. data/vendor/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  60. data/vendor/assets/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
  61. data/vendor/assets/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
  62. data/vendor/assets/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
  63. data/vendor/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  64. data/vendor/assets/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  65. data/vendor/assets/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
  66. data/vendor/assets/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
  67. data/vendor/assets/images/ui-icons_217bc0_256x240.png +0 -0
  68. data/vendor/assets/images/ui-icons_2e83ff_256x240.png +0 -0
  69. data/vendor/assets/images/ui-icons_469bdd_256x240.png +0 -0
  70. data/vendor/assets/images/ui-icons_6da8d5_256x240.png +0 -0
  71. data/vendor/assets/images/ui-icons_cd0a0a_256x240.png +0 -0
  72. data/vendor/assets/images/ui-icons_d8e7f3_256x240.png +0 -0
  73. data/vendor/assets/images/ui-icons_f9bd01_256x240.png +0 -0
  74. data/vendor/assets/javascripts/chosen.jquery.min.js +10 -0
  75. data/vendor/assets/javascripts/jquery.ui.timepicker.addon.js +1326 -0
  76. data/vendor/assets/javascripts/refinery/calendar.js.coffee +7 -0
  77. data/vendor/assets/stylesheets/chosen.css +372 -0
  78. data/vendor/assets/stylesheets/jquery-ui.css +377 -0
  79. data/vendor/assets/stylesheets/refinery/calendar.css.scss +22 -0
  80. metadata +158 -0
@@ -0,0 +1,20 @@
1
+ module Refinery
2
+ module Calendar
3
+ module Admin
4
+ class EventsController < ::Refinery::AdminController
5
+ before_filter :find_venues, :except => [:index, :destroy]
6
+
7
+ crudify :'refinery/calendar/event',
8
+ :xhr_paging => true,
9
+ :sortable => false,
10
+ :order => "'from' DESC",
11
+ :include => [:translations]
12
+
13
+ private
14
+ def find_venues
15
+ @venues = Venue.order('name')
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ module Refinery
2
+ module Calendar
3
+ module Admin
4
+ class VenuesController < ::Refinery::AdminController
5
+
6
+ crudify :'refinery/calendar/venue',
7
+ :title_attribute => 'name',
8
+ :xhr_paging => true,
9
+ :sortable => false,
10
+ :order => 'created_at DESC',
11
+ :include => [:translations]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,38 @@
1
+ module Refinery
2
+ module Calendar
3
+ class EventsController < ::ApplicationController
4
+
5
+ helper 'refinery/calendar/calendar'
6
+
7
+ def index
8
+ d = Date.parse(params[:date]) rescue nil
9
+ @events = d.nil? ?
10
+ Event.upcoming.order('refinery_calendar_events.from DESC') :
11
+ Event.on_day(d).order('refinery_calendar_events.from DESC')
12
+
13
+ # you can use meta fields from your model instead (e.g. browser_title)
14
+ # by swapping @page for @event in the line below:
15
+ present(@page)
16
+ end
17
+
18
+ def show
19
+ @event = Event.find(params[:id])
20
+
21
+ # you can use meta fields from your model instead (e.g. browser_title)
22
+ # by swapping @page for @event in the line below:
23
+ present(@page)
24
+ end
25
+
26
+ def archive
27
+ @events = Event.archive.order('refinery_calendar_events.from DESC')
28
+ render :template => 'refinery/calendar/events/index'
29
+ end
30
+
31
+ protected
32
+ def find_page
33
+ @page = ::Refinery::Page.where(:link_url => "/connect/events").first
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,246 @@
1
+ require 'date'
2
+
3
+ # CalendarHelper allows you to draw a databound calendar with fine-grained CSS formatting
4
+ # https://github.com/topfunky/calendar_helper
5
+ module Refinery::Calendar::CalendarHelper
6
+
7
+ VERSION = '0.2.4'
8
+
9
+ # Returns an HTML calendar. In its simplest form, this method generates a plain
10
+ # calendar (which can then be customized using CSS) for a given month and year.
11
+ # However, this may be customized in a variety of ways -- changing the default CSS
12
+ # classes, generating the individual day entries yourself, and so on.
13
+ #
14
+ # The following options are required:
15
+ # :year # The year number to show the calendar for.
16
+ # :month # The month number to show the calendar for.
17
+ #
18
+ # The following are optional, available for customizing the default behaviour:
19
+ # :table_id => "calendar-2008-08" # The id for the <table> tag.
20
+ # :table_class => "calendar" # The class for the <table> tag.
21
+ # :summary => "Calendar for August 2008" # The summary attribute for the <table> tag. Required for 508 compliance.
22
+ # :month_name_class => "monthName" # The class for the name of the month, at the top of the table.
23
+ # :other_month_class => "otherMonth" # Not implemented yet.
24
+ # :day_name_class => "dayName" # The class is for the names of the weekdays, at the top.
25
+ # :day_class => "day" # The class for the individual day number cells.
26
+ # This may or may not be used if you specify a block (see below).
27
+ # :abbrev => true # This option specifies whether day names should be displayed abbrevidated (true)
28
+ # or in full (false)
29
+ # :first_day_of_week => 0 # Renders calendar starting on Sunday. Use 1 for Monday, and so on.
30
+ # :accessible => true # Turns on accessibility mode. This suffixes dates within the
31
+ # # calendar that are outside the range defined in the <caption> with
32
+ # # <span class="hidden"> MonthName</span>
33
+ # # Defaults to false.
34
+ # # You'll need to define an appropriate style in order to make this disappear.
35
+ # # Choose your own method of hiding content appropriately.
36
+ #
37
+ # :show_today => false # Highlights today on the calendar using the CSS class 'today'.
38
+ # # Defaults to true.
39
+ # :previous_month_text => nil # Displayed left of the month name if set
40
+ # :next_month_text => nil # Displayed right of the month name if set
41
+ # :month_header => false # If you use false, the current month header will disappear.
42
+ # :calendar_title => month_names[options[:month]] # Pass in a custom title for the calendar. Defaults to month name
43
+ #
44
+ # For more customization, you can pass a code block to this method, that will get one argument, a Date object,
45
+ # and return a values for the individual table cells. The block can return an array, [cell_text, cell_attrs],
46
+ # cell_text being the text that is displayed and cell_attrs a hash containing the attributes for the <td> tag
47
+ # (this can be used to change the <td>'s class for customization with CSS).
48
+ # This block can also return the cell_text only, in which case the <td>'s class defaults to the value given in
49
+ # +:day_class+. If the block returns nil, the default options are used.
50
+ #
51
+ # Example usage:
52
+ # calendar(:year => 2005, :month => 6) # This generates the simplest possible calendar.
53
+ # calendar({:year => 2005, :month => 6, :table_class => "calendar_helper"}) # This generates a calendar, as
54
+ # # before, but the <table>'s class
55
+ # # is set to "calendar_helper".
56
+ # calendar(:year => 2005, :month => 6, :abbrev => (0..-1)) # This generates a simple calendar but shows the
57
+ # # entire day name ("Sunday", "Monday", etc.) instead
58
+ # # of only the first three letters.
59
+ # calendar(:year => 2005, :month => 5) do |d| # This generates a simple calendar, but gives special days
60
+ # if listOfSpecialDays.include?(d) # (days that are in the array listOfSpecialDays) one CSS class,
61
+ # [d.mday, {:class => "specialDay"}] # "specialDay", and gives the rest of the days another CSS class,
62
+ # else # "normalDay". You can also use this highlight today differently
63
+ # [d.mday, {:class => "normalDay"}] # from the rest of the days, etc.
64
+ # end
65
+ # end
66
+ #
67
+ # An additional 'weekend' class is applied to weekend days.
68
+ #
69
+ # For consistency with the themes provided in the calendar_styles generator, use "specialDay" as the CSS class for marked days.
70
+ #
71
+ # Accessibility & 508 Compliance:
72
+ # The table tag has a summary attribute (overridable).
73
+ # Each th has an id.
74
+ # Each td has a headers attribute, containing the element id of the appropriate th.
75
+ #
76
+ def calendar(options = {}, &block)
77
+ raise(ArgumentError, "No year given") unless options.has_key?(:year)
78
+ raise(ArgumentError, "No month given") unless options.has_key?(:month)
79
+
80
+ block ||= Proc.new do |d|
81
+ if Refinery::Calendar::Event.on_day(d).count > 0
82
+ [link_to(d.day, refinery.calendar_events_path(date: d)), class: "day-with-events"]
83
+ else
84
+ d.day
85
+ end
86
+ end
87
+
88
+ month_names = (!defined?(I18n) || I18n.t("date.month_names").include?("missing")) ? Date::MONTHNAMES.dup : I18n.t("date.month_names")
89
+
90
+ month_names = (!defined?(I18n) || I18n.t("date.month_names").include?("missing")) ? Date::MONTHNAMES.dup : I18n.t("date.month_names")
91
+
92
+ defaults = {
93
+ :table_id => "calendar-#{options[:year]}-#{"0%d" % options[:month]}",
94
+ :table_class => 'calendar',
95
+ :month_name_class => 'monthName',
96
+ :other_month_class => 'otherMonth',
97
+ :day_name_class => 'dayName',
98
+ :day_class => 'day',
99
+ :abbrev => true,
100
+ :first_day_of_week => 0,
101
+ :accessible => false,
102
+ :show_today => true,
103
+ :previous_month_text => nil,
104
+ :next_month_text => nil,
105
+ :month_header => true,
106
+ :calendar_title => month_names[options[:month]],
107
+ :summary => "Calendar for #{month_names[options[:month]]} #{options[:year]}"
108
+ }
109
+ options = defaults.merge options
110
+
111
+ first = Date.civil(options[:year], options[:month], 1)
112
+ last = Date.civil(options[:year], options[:month], -1)
113
+
114
+ first_weekday = first_day_of_week(options[:first_day_of_week])
115
+ last_weekday = last_day_of_week(options[:first_day_of_week])
116
+
117
+ day_names = (!defined?(I18n) || I18n.t("date.day_names").include?("missing")) ? Date::DAYNAMES.dup : I18n.t("date.day_names").dup
118
+ abbr_day_names = (!defined?(I18n) || I18n.t("date.abbr_day_names").include?("missing")) ? Date::ABBR_DAYNAMES.dup : I18n.t("date.abbr_day_names").dup
119
+ first_weekday.times do
120
+ day_names.push(day_names.shift)
121
+ abbr_day_names.push(abbr_day_names.shift)
122
+ end
123
+
124
+ # TODO Use some kind of builder instead of straight HTML
125
+ cal = %(<table id="#{options[:table_id]}" class="#{options[:table_class]}" border="0" cellspacing="0" cellpadding="0" summary="#{options[:summary]}">)
126
+ cal << %(<thead>)
127
+
128
+ if (options[:month_header])
129
+ cal << %(<tr>)
130
+ if options[:previous_month_text] or options[:next_month_text]
131
+ cal << %(<th colspan="2">#{options[:previous_month_text]}</th>)
132
+ colspan=3
133
+ else
134
+ colspan=7
135
+ end
136
+ cal << %(<th colspan="#{colspan}" class="#{options[:month_name_class]}">#{options[:calendar_title]}</th>)
137
+ cal << %(<th colspan="2">#{options[:next_month_text]}</th>) if options[:next_month_text]
138
+ cal << %(</tr>)
139
+ end
140
+
141
+ cal << %(<tr class="#{options[:day_name_class]}">)
142
+
143
+ day_names.each_with_index do |day_name, index|
144
+ cal << %(<th id="#{th_id(day_name, options[:table_id])}" scope='col'>)
145
+ cal << (options[:abbrev] ? %(<abbr title='#{day_name}'>#{abbr_day_names[index]}</abbr>) : day_name)
146
+ cal << %(</th>)
147
+ end
148
+
149
+ cal << "</tr></thead><tbody><tr>"
150
+
151
+ # previous month
152
+ beginning_of_week(first, first_weekday).upto(first - 1) do |d|
153
+ cal << generate_other_month_cell(d, options)
154
+ end unless first.wday == first_weekday
155
+
156
+ first.upto(last) do |cur|
157
+ cell_text, cell_attrs = block.call(cur)
158
+ cell_text ||= cur.mday
159
+ cell_attrs ||= {}
160
+ cell_attrs[:headers] = th_id(cur, options[:table_id])
161
+ cell_attrs[:class] ||= options[:day_class]
162
+ cell_attrs[:class] += " weekendDay" if [0, 6].include?(cur.wday)
163
+ today = (Time.respond_to?(:zone) && !(zone = Time.zone).nil? ? zone.now.to_date : Date.today)
164
+ cell_attrs[:class] += " today" if (cur == today) and options[:show_today]
165
+
166
+ cal << generate_cell(cell_text, cell_attrs)
167
+ cal << "</tr><tr>" if cur.wday == last_weekday
168
+ end
169
+
170
+ # next month
171
+ (last + 1).upto(beginning_of_week(last + 7, first_weekday) - 1) do |d|
172
+ cal << generate_other_month_cell(d, options)
173
+ end unless last.wday == last_weekday
174
+
175
+ cal << "</tr></tbody></table>"
176
+ cal.respond_to?(:html_safe) ? cal.html_safe : cal
177
+ end
178
+
179
+ def date_events_path(area, date, month_date)
180
+ params = {}
181
+ params[:month_date] = month_date.strftime("%m-%Y") unless month_date.blank?
182
+ params[:date] = date.strftime("%d-%m-%Y") unless date.blank?
183
+ area.blank? ? events_path(params) : area_events_path(area, params)
184
+ end
185
+
186
+ private
187
+
188
+ def first_day_of_week(day)
189
+ day
190
+ end
191
+
192
+ def last_day_of_week(day)
193
+ if day > 0
194
+ day - 1
195
+ else
196
+ 6
197
+ end
198
+ end
199
+
200
+ def days_between(first, second)
201
+ if first > second
202
+ second + (7 - first)
203
+ else
204
+ second - first
205
+ end
206
+ end
207
+
208
+ def beginning_of_week(date, start = 1)
209
+ days_to_beg = days_between(start, date.wday)
210
+ date - days_to_beg
211
+ end
212
+
213
+ def generate_cell(cell_text, cell_attrs)
214
+ cell_attrs = cell_attrs.map {|k, v| %(#{k}="#{v}") }.join(" ")
215
+ "<td #{cell_attrs}>#{cell_text}</td>"
216
+ end
217
+
218
+ def generate_other_month_cell(date, options)
219
+ cell_attrs = {}
220
+ cell_attrs[:headers] = th_id(date, options[:table_id])
221
+ cell_attrs[:class] = options[:other_month_class]
222
+ cell_attrs[:class] += " weekendDay" if weekend?(date)
223
+
224
+ cell_text = date.day
225
+ if options[:accessible]
226
+ cell_text += %(<span class="hidden"> #{month_names[date.month]}</span>)
227
+ end
228
+
229
+ generate_cell(date.day, cell_attrs)
230
+ end
231
+
232
+ # Calculates id for th element.
233
+ # derived from calendar_id and dow.
234
+ #
235
+ # Params:
236
+ # `day` can be either Date or DOW('Sunday', 'Monday')
237
+ def th_id(day, calendar_id)
238
+ return th_id(Date::DAYNAMES[day.wday], calendar_id) if day.is_a?(Date)
239
+ "#{calendar_id}-#{day[0..2].downcase}"
240
+ end
241
+
242
+ def weekend?(date)
243
+ [0, 6].include?(date.wday)
244
+ end
245
+
246
+ end
@@ -0,0 +1,60 @@
1
+ module Refinery
2
+ module Calendar
3
+ class Event < Refinery::Core::BaseModel
4
+
5
+ translates :title, :excerpt, :description, :slug
6
+
7
+ extend FriendlyId
8
+ friendly_id :title, :use => [:slugged, :globalize]
9
+
10
+ belongs_to :venue
11
+
12
+ validates :title, :presence => true, :uniqueness => true
13
+
14
+ attr_accessible :title, :from, :to, :registration_link,
15
+ :venue_id, :excerpt, :description,
16
+ :featured, :position
17
+
18
+ attr_accessor :locale
19
+
20
+ delegate :name, :address,
21
+ :to => :venue,
22
+ :prefix => true,
23
+ :allow_nil => true
24
+
25
+ scope :on_day, lambda {|day| where('(refinery_calendar_events.`from` = ?) OR (refinery_calendar_events.`to` = ?) OR (refinery_calendar_events.`from` < ? AND (refinery_calendar_events.`to` > ?))', day, day, day, day) }
26
+
27
+ class Translation
28
+ attr_accessible :locale
29
+ end
30
+
31
+ class << self
32
+ def upcoming
33
+ where('refinery_calendar_events.from >= ?', Time.now).with_globalize
34
+ end
35
+
36
+ def featured
37
+ where(:featured => true).with_globalize
38
+ end
39
+
40
+ def archive
41
+ where('refinery_calendar_events.from < ?', Time.now).with_globalize
42
+ end
43
+
44
+ # Wrap up the logic of finding the events based on the translations table.
45
+ def with_globalize(conditions = {})
46
+ conditions = {:locale => ::Globalize.locale}.merge(conditions)
47
+ globalized_conditions = {}
48
+ conditions.keys.each do |key|
49
+ if (translated_attribute_names.map(&:to_s) | %w(locale)).include?(key.to_s)
50
+ globalized_conditions["#{self.translation_class.table_name}.#{key}"] = conditions.delete(key)
51
+ end
52
+ end
53
+ # A join implies readonly which we don't really want.
54
+ joins(:translations).where(globalized_conditions).where(conditions).readonly(false)
55
+ end
56
+
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,17 @@
1
+ module Refinery
2
+ module Calendar
3
+ class Venue < Refinery::Core::BaseModel
4
+ translates :name
5
+ has_many :events
6
+ validates :name, :presence => true, :uniqueness => true
7
+ attr_accessible :name, :address, :url, :phone, :position
8
+
9
+ attr_accessor :locale
10
+
11
+ class Translation
12
+ attr_accessible :locale
13
+ end
14
+
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,26 @@
1
+ <ul>
2
+ <% if ::Refinery::Calendar::Admin::EventsController.searchable? %>
3
+ <li>
4
+ <%= render '/refinery/admin/search', :url => refinery.calendar_admin_events_path %>
5
+ </li>
6
+ <% end %>
7
+ <li>
8
+ <%= link_to t('.create_new'), refinery.new_calendar_admin_event_path,
9
+ :class => "add_icon" %>
10
+ </li>
11
+ <%= render 'refinery/calendar/admin/shared/links' %>
12
+ <% if !searching? && ::Refinery::Calendar::Admin::EventsController.sortable? && ::Refinery::Calendar::Event.any? %>
13
+ <li>
14
+ <%= link_to t('.reorder', :what => "Events"),
15
+ refinery.calendar_admin_events_path,
16
+ :id => "reorder_action",
17
+ :class => "reorder_icon" %>
18
+
19
+ <%= link_to t('.reorder_done', :what => "Events"),
20
+ refinery.calendar_admin_events_path,
21
+ :id => "reorder_action_done",
22
+ :style => "display: none;",
23
+ :class => "reorder_icon" %>
24
+ </li>
25
+ <% end %>
26
+ </ul>
@@ -0,0 +1,28 @@
1
+ <li class='clearfix record <%= cycle("on", "on-hover") %>' id="<%= dom_id(event) -%>">
2
+ <span class='title'>
3
+ <%= event.title.presence || event.translations.detect {|t| t.title.present?}.title %>
4
+ <% if Refinery.i18n_enabled? and Refinery::I18n.frontend_locales.many? %>
5
+ <span class='preview'>
6
+ <% event.translations.each do |translation| %>
7
+ <%= link_to refinery_icon_tag("flags/#{translation.locale}.png", :size => '16x11'),
8
+ refinery.edit_calendar_admin_event_path(event, :switch_locale => translation.locale),
9
+ :class => 'locale' if translation.title.present? %>
10
+ <% end %>
11
+ </span>
12
+ <% end %>
13
+ </span>
14
+ <span class='actions'>
15
+
16
+ <%= link_to refinery_icon_tag("application_go.png"), refinery.calendar_event_path(event),
17
+ :title => t('.view_live_html'),
18
+ :target => "_blank" %>
19
+
20
+ <%= link_to refinery_icon_tag("application_edit.png"), refinery.edit_calendar_admin_event_path(event),
21
+ :title => t('.edit') %>
22
+ <%= link_to refinery_icon_tag("delete.png"), refinery.calendar_admin_event_path(event),
23
+ :class => "cancel confirm-delete",
24
+ :title => t('.delete'),
25
+ :confirm => t('message', :scope => 'refinery.admin.delete', :title => event.title),
26
+ :method => :delete %>
27
+ </span>
28
+ </li>
@@ -0,0 +1,2 @@
1
+ <%= will_paginate @events if Refinery::Calendar::Admin::EventsController.pageable? %>
2
+ <%= render 'sortable_list' %>
@@ -0,0 +1,86 @@
1
+ <%= form_for [refinery, :calendar_admin, @event] do |f| -%>
2
+ <%= render '/refinery/admin/error_messages',
3
+ :object => @event,
4
+ :include_object_name => true %>
5
+
6
+ <%= render '/refinery/calendar/admin/shared/locale_picker', :current_locale => Globalize.locale if Refinery.i18n_enabled? %>
7
+
8
+ <div class='field'>
9
+ <%= f.label :title -%>
10
+ <%= f.text_field :title, :class => 'larger widest' -%>
11
+ </div>
12
+
13
+ <div class="field">
14
+ <p>
15
+ <%= f.check_box :featured %>
16
+ <%= f.label :featured, :class => 'stripped' %>
17
+ </p>
18
+ </div>
19
+
20
+ <div class='field'>
21
+ <%= f.label :from -%>
22
+ <%= f.text_field :from, :class => 'datetime_range' -%>
23
+ </div>
24
+
25
+ <div class='field'>
26
+ <%= f.label :to -%>
27
+ <%= f.text_field :to, :class => 'datetime_range' -%>
28
+ </div>
29
+
30
+ <div class='field'>
31
+ <%= f.label :registration_link -%>
32
+ <%= f.text_field :registration_link, :class => 'larger' -%>
33
+ </div>
34
+
35
+ <div class='field'>
36
+ <%= f.label :venue_id, 'Venue' %>
37
+ <%= f.collection_select :venue_id, @venues, :id, :name, { :include_blank => 'None' }, :class => 'chzn-select', :'data-placeholder' => 'Search Venues', :style => 'width: 300px;' %>
38
+ </div>
39
+
40
+ <div class='field'>
41
+ <%= f.label :excerpt -%>
42
+ <%= f.text_area :excerpt, :size => '65x5' -%>
43
+ </div>
44
+
45
+ <div class='field'>
46
+ <div id='page-tabs' class='clearfix ui-tabs ui-widget ui-widget-content ui-corner-all'>
47
+ <ul id='page_parts'>
48
+ <% [:description].each_with_index do |part, part_index| %>
49
+ <li class='ui-state-default<%= ' ui-state-active' if part_index == 0 %>'>
50
+ <%= link_to t("#{part}", :scope => "activerecord.attributes.refinery/calendar/event", :default => part.to_s.titleize), "##{part}" %>
51
+ </li>
52
+ <% end %>
53
+ </ul>
54
+ <div id='page_part_editors'>
55
+ <% [:description].each do |part| %>
56
+ <div class='page_part' id='<%= part %>'>
57
+ <%= f.text_area part, :rows => 20, :class => 'wymeditor widest' -%>
58
+ </div>
59
+ <% end %>
60
+ </div>
61
+ </div>
62
+
63
+ </div>
64
+
65
+ <%= render '/refinery/admin/form_actions', :f => f,
66
+ :continue_editing => false,
67
+ :delete_title => t('delete', :scope => 'refinery.events.admin.events.event'),
68
+ :delete_confirmation => t('message', :scope => 'refinery.admin.delete', :title => @event.title) %>
69
+ <% end -%>
70
+ <% content_for :stylesheets do %>
71
+ <%= stylesheet_link_tag 'chosen' %>
72
+ <% end %>
73
+
74
+ <% content_for :javascripts do %>
75
+ <%= javascript_include_tag 'chosen.jquery.min' %>
76
+ <script>
77
+ $(document).ready(function(){
78
+ page_options.init(false, '', '');
79
+
80
+ $('#event_venue_id').chosen({
81
+ no_results_text: "No results matched",
82
+ allow_single_deselect: true
83
+ });
84
+ });
85
+ </script>
86
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <% if searching? %>
2
+ <h2><%= t('results_for', :scope => 'refinery.admin.search', :query => params[:search]) %></h2>
3
+ <% end %>
4
+ <div class='pagination_container'>
5
+ <% if @events.any? %>
6
+ <%= render 'events' %>
7
+ <% else %>
8
+ <p>
9
+ <% unless searching? %>
10
+ <strong>
11
+ <%= t('.no_items_yet') %>
12
+ </strong>
13
+ <% else %>
14
+ <%= t('no_results', :scope => 'refinery.admin.search') %>
15
+ <% end %>
16
+ </p>
17
+ <% end %>
18
+ </div>
@@ -0,0 +1,5 @@
1
+ <ul id='sortable_list'>
2
+ <%= render :partial => 'event', :collection => @events %>
3
+ </ul>
4
+ <%= render '/refinery/admin/sortable_list',
5
+ :continue_reordering => (local_assigns.keys.include?(:continue_reordering)) ? continue_reordering : true %>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,8 @@
1
+ <section id='records'>
2
+ <h2>Calendar: Events</h2>
3
+ <%= render 'records' %>
4
+ </section>
5
+ <aside id='actions'>
6
+ <%= render 'actions' %>
7
+ </aside>
8
+ <%= render '/refinery/admin/make_sortable', :tree => false if !searching? and ::Refinery::Calendar::Admin::EventsController.sortable? and ::Refinery::Calendar::Event.count > 1 %>
@@ -0,0 +1 @@
1
+ <%= render 'form' %>
@@ -0,0 +1,8 @@
1
+ <li>
2
+ <%= link_to t('.manage_events'), refinery.calendar_admin_events_path,
3
+ :class => "manage_icon" %>
4
+ </li>
5
+ <li>
6
+ <%= link_to t('.manage_venues'), refinery.calendar_admin_venues_path,
7
+ :class => "manage_icon" %>
8
+ </li>
@@ -0,0 +1,11 @@
1
+ <input type='hidden' name='switch_locale' id='switch_locale' value='<%= local_assigns[:current_locale] %>' />
2
+ <% if (locales ||= (Refinery::I18n.frontend_locales if Refinery.i18n_enabled?)).present? && locales.many? %>
3
+ <ul id='switch_locale_picker' class='clearfix'>
4
+ <% locales.each do |locale| %>
5
+ <li<%= " class='selected'" if locale.to_s == local_assigns[:current_locale].to_s %>>
6
+ <%= link_to refinery_icon_tag("flags/#{locale}.png", :size => "32x22"),
7
+ refinery.url_for(:switch_locale => locale) %>
8
+ </li>
9
+ <% end %>
10
+ </ul>
11
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <ul>
2
+ <% if ::Refinery::Calendar::Admin::VenuesController.searchable? %>
3
+ <li>
4
+ <%= render '/refinery/admin/search', :url => refinery.calendar_admin_venues_path %>
5
+ </li>
6
+ <% end %>
7
+ <li>
8
+ <%= link_to t('.create_new'), refinery.new_calendar_admin_venue_path,
9
+ :class => "add_icon" %>
10
+ </li>
11
+ <%= render 'refinery/calendar/admin/shared/links' %>
12
+ <% if !searching? && ::Refinery::Calendar::Admin::VenuesController.sortable? && ::Refinery::Calendar::Venue.any? %>
13
+ <li>
14
+ <%= link_to t('.reorder', :what => "Venues"),
15
+ refinery.calendar_admin_venues_path,
16
+ :id => "reorder_action",
17
+ :class => "reorder_icon" %>
18
+
19
+ <%= link_to t('.reorder_done', :what => "Venues"),
20
+ refinery.calendar_admin_venues_path,
21
+ :id => "reorder_action_done",
22
+ :style => "display: none;",
23
+ :class => "reorder_icon" %>
24
+ </li>
25
+ <% end %>
26
+ </ul>