tb_events 1.1.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +13 -1
- data/Rakefile +2 -2
- data/app/assets/javascripts/admin/events/application.js +16 -0
- data/app/assets/javascripts/{calendar_events.js → admin/events/calendar_events.js} +0 -0
- data/app/assets/javascripts/{spud/admin → admin/events}/calendars.js +0 -0
- data/app/assets/stylesheets/admin/events/application.css +4 -0
- data/app/assets/{javascripts/spud/events.js → stylesheets/admin/events/calendar_events.css} +0 -0
- data/app/assets/stylesheets/{spud → admin/events}/calendars.css +23 -28
- data/app/controllers/admin/calendar_events_controller.rb +13 -15
- data/app/controllers/admin/calendars_controller.rb +9 -11
- data/app/controllers/calendar_events_controller.rb +12 -6
- data/app/controllers/calendars_controller.rb +18 -18
- data/app/helpers/admin/calendars_helper.rb +6 -8
- data/app/helpers/calendars_helper.rb +66 -35
- data/app/models/spud_calendar.rb +30 -2
- data/app/models/spud_calendar_event.rb +1 -18
- data/app/models/spud_events/calendar_event_model.rb +31 -0
- data/app/views/admin/calendar_events/_calendar.html.erb +16 -11
- data/app/views/admin/calendar_events/_form.html.erb +16 -98
- data/app/views/admin/calendar_events/index.html.erb +24 -16
- data/app/views/admin/calendars/_calendar_legend.html.erb +5 -4
- data/app/views/admin/calendars/_form.html.erb +4 -19
- data/app/views/calendar_events/index.html.erb +22 -0
- data/app/views/calendar_events/show.html.erb +3 -1
- data/app/views/calendars/show.html.erb +18 -15
- data/config/locales/en.yml +9 -0
- data/config/routes.rb +7 -10
- data/db/migrate/20120216191833_create_spud_calendars.rb +3 -3
- data/db/migrate/20120216192531_create_spud_calendar_events.rb +1 -1
- data/db/migrate/20130214131628_add_location_to_spud_calendar_event.rb +1 -1
- data/db/migrate/20140723203144_add_identifier_to_spud_calendars.rb +6 -0
- data/db/migrate/20140730182213_remove_color_from_spud_calendars.rb +9 -0
- data/lib/spud_events/calendar_builder.rb +53 -0
- data/lib/spud_events/configuration.rb +6 -0
- data/lib/spud_events/engine.rb +25 -0
- data/lib/spud_events/version.rb +3 -0
- data/lib/tb_events.rb +4 -4
- metadata +62 -110
- data/app/assets/javascripts/calendars.js +0 -2
- data/app/assets/javascripts/spud/admin/calendar_events.js +0 -2
- data/app/assets/javascripts/spud/admin/events.js +0 -51
- data/app/assets/lib/colorpicker/colorpicker.css +0 -164
- data/app/assets/lib/colorpicker/colorpicker.js +0 -484
- data/app/assets/lib/colorpicker/images/blank.gif +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_background.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_hex.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_hsb_b.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_hsb_h.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_hsb_s.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_indic.gif +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_overlay.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_rgb_b.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_rgb_g.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_rgb_r.png +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_select.gif +0 -0
- data/app/assets/lib/colorpicker/images/colorpicker_submit.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_background.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_hex.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_hsb_b.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_hsb_h.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_hsb_s.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_indic.gif +0 -0
- data/app/assets/lib/colorpicker/images/custom_rgb_b.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_rgb_g.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_rgb_r.png +0 -0
- data/app/assets/lib/colorpicker/images/custom_submit.png +0 -0
- data/app/assets/lib/colorpicker/images/select.png +0 -0
- data/app/assets/lib/colorpicker/images/select2.png +0 -0
- data/app/assets/lib/colorpicker/images/slider.png +0 -0
- data/app/assets/stylesheets/spud/admin/events.css +0 -16
- data/app/assets/stylesheets/spud/calendar_events.css +0 -18
- data/app/assets/stylesheets/spud/events.css +0 -4
- data/app/views/calendars/_calendar.html.erb +0 -26
- data/app/views/calendars/_calendar_options.html.erb +0 -4
- data/config/application.rb +0 -50
- data/config/boot.rb +0 -6
- data/lib/spud/events/calendar.rb +0 -85
- data/lib/spud/events/calendar_builder.rb +0 -58
- data/lib/spud/events/configuration.rb +0 -8
- data/lib/spud/events/engine.rb +0 -26
- data/lib/spud/events/table_builder.rb +0 -88
- data/lib/spud/events/version.rb +0 -5
data/app/models/spud_calendar.rb
CHANGED
@@ -1,4 +1,32 @@
|
|
1
1
|
class SpudCalendar < ActiveRecord::Base
|
2
|
-
has_many :spud_calendar_events, :
|
3
|
-
validates_presence_of :title
|
2
|
+
has_many :spud_calendar_events, dependent: :destroy
|
3
|
+
validates_presence_of :title
|
4
|
+
validates :identifier, presence: true, uniqueness: true
|
5
|
+
|
6
|
+
before_validation :set_identifier
|
7
|
+
|
8
|
+
def self.with_identifier(identifier)
|
9
|
+
where(identifier: identifier).first
|
10
|
+
end
|
11
|
+
|
12
|
+
def color
|
13
|
+
modulo = (id - 1) % COLORS.length
|
14
|
+
COLORS[modulo]
|
15
|
+
end
|
16
|
+
|
17
|
+
COLORS = %w(
|
18
|
+
4D854B
|
19
|
+
f89406
|
20
|
+
b94a48
|
21
|
+
3a87ad
|
22
|
+
999999
|
23
|
+
333333)
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def set_identifier
|
28
|
+
if identifier.nil? && title.present?
|
29
|
+
self.identifier = title.parameterize.underscore
|
30
|
+
end
|
31
|
+
end
|
4
32
|
end
|
@@ -1,19 +1,2 @@
|
|
1
|
-
class SpudCalendarEvent <
|
2
|
-
belongs_to :spud_calendar
|
3
|
-
validates_presence_of :title, :start_at, :end_at, :spud_calendar_id
|
4
|
-
|
5
|
-
def self.in_month_of(month)
|
6
|
-
where(["spud_calendar_events.start_at <= ? AND spud_calendar_events.start_at >= ?", month.end_of_month, month.beginning_of_month])
|
7
|
-
end
|
8
|
-
|
9
|
-
def days_span
|
10
|
-
return (end_at.to_date - start_at.to_date).to_i + 1
|
11
|
-
end
|
12
|
-
|
13
|
-
def falls_on?(day)
|
14
|
-
start_date = start_at.beginning_of_day.to_date
|
15
|
-
end_date = end_at.end_of_day.to_date
|
16
|
-
return day >= start_date && day <= end_date
|
17
|
-
end
|
18
|
-
|
1
|
+
class SpudCalendarEvent < SpudEvents::CalendarEventModel
|
19
2
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class SpudEvents::CalendarEventModel < ActiveRecord::Base
|
2
|
+
self.table_name = 'spud_calendar_events'
|
3
|
+
|
4
|
+
belongs_to :spud_calendar
|
5
|
+
validates_presence_of :title, :start_at, :end_at, :spud_calendar_id
|
6
|
+
|
7
|
+
scope :ordered, -> { order('start_at desc') }
|
8
|
+
scope :in_month_of, lambda { |date|
|
9
|
+
where('start_at BETWEEN ? AND ? OR end_at BETWEEN ? AND ?', date.beginning_of_month, date.end_of_month, date.beginning_of_month, date.end_of_month).order('start_at asc')
|
10
|
+
# where(:start_at => date.beginning_of_month...date.end_of_month)
|
11
|
+
}
|
12
|
+
scope :upcoming, ->(limit = false) { where('start_at >= ?', Date.today).order('start_at asc').limit(limit) }
|
13
|
+
|
14
|
+
def start_date
|
15
|
+
start_at.to_date
|
16
|
+
end
|
17
|
+
|
18
|
+
def end_date
|
19
|
+
end_at.to_date
|
20
|
+
end
|
21
|
+
|
22
|
+
def days_span
|
23
|
+
(end_at.to_date - start_at.to_date).to_i + 1
|
24
|
+
end
|
25
|
+
|
26
|
+
def falls_on?(day)
|
27
|
+
start_date = start_at.beginning_of_day.to_date
|
28
|
+
end_date = end_at.end_of_day.to_date
|
29
|
+
day >= start_date && day <= end_date
|
30
|
+
end
|
31
|
+
end
|
@@ -1,14 +1,19 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
<%= link_to_next_admin_calendar_month @calendar_date %>
|
2
|
+
<%= link_to_previous_admin_calendar_month @calendar_date %>
|
3
3
|
|
4
|
-
<%=
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
<%
|
10
|
-
|
4
|
+
<%= spud_calendar_for_events(@calendar_events, @calendar_date, :headers => ['S', 'M', 'T', 'W', 'T', 'F', 'S']) do |day, events| %>
|
5
|
+
<span class="calendar-day">
|
6
|
+
<%= day.day %>
|
7
|
+
</span>
|
8
|
+
<ul class="calendar-events-list">
|
9
|
+
<% events.each do |event| %>
|
10
|
+
<li>
|
11
|
+
<%= link_to edit_admin_calendar_event_path(event.id) do %>
|
12
|
+
<span class="label" style="background-color: #<%= event.spud_calendar.color %>">
|
13
|
+
<%= truncate(event.title, :length => 25) %>
|
14
|
+
</span>
|
15
|
+
<% end %>
|
16
|
+
</li>
|
11
17
|
<% end %>
|
12
|
-
|
13
|
-
<% end %>
|
18
|
+
</ul>
|
14
19
|
<% end %>
|
@@ -1,103 +1,21 @@
|
|
1
|
-
<%= form_for @calendar_event, :url => path, :html=>{:class=>"form-horizontal"} do |f| %>
|
2
|
-
<%=
|
3
|
-
<fieldset>
|
4
|
-
<legend>Details</legend>
|
5
|
-
<div class="control-group">
|
6
|
-
<%= f.label :spud_calender_id, "Calendar",:class => "control-label" %>
|
7
|
-
<div class="controls">
|
8
|
-
<%= f.select(:spud_calendar_id, options_from_collection_for_select(SpudCalendar.all, :id, :title, @calendar_event.spud_calendar_id)) %>
|
9
|
-
</div>
|
10
|
-
</div>
|
11
|
-
<div class="control-group">
|
12
|
-
<%= f.label :title,:class => "control-label" %>
|
13
|
-
<div class="controls">
|
14
|
-
<%= f.text_field :title %>
|
15
|
-
</div>
|
16
|
-
</div>
|
17
|
-
<div class="control-group">
|
18
|
-
<%= f.label :description,:class => "control-label" %>
|
19
|
-
<div class="controls">
|
20
|
-
<%= f.text_area :description, :rows => 5 %>
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
-
</fieldset>
|
1
|
+
<%= form_for @calendar_event, :url => path, :builder => TbCore::FormBuilder, :html => {:class => "form-horizontal"} do |f| %>
|
2
|
+
<%= tb_form_error_header(f.object) %>
|
24
3
|
|
25
|
-
|
26
|
-
<legend>Event Time</legend>
|
4
|
+
<%= f.tb_select :spud_calendar_id, options_from_collection_for_select(SpudCalendar.all, :id, :title, @calendar_event.spud_calendar_id) %>
|
27
5
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
<%= f.time_select :start_at, :ignore_date => true,:ampm => true%>
|
34
|
-
</span>
|
35
|
-
</div>
|
36
|
-
</div>
|
37
|
-
<div class="control-group">
|
38
|
-
<%= f.label :end_at, "Ends",:class => "control-label" %>
|
6
|
+
<%= f.tb_text_field :title %>
|
7
|
+
<%= f.tb_text_area :description, :style => "width:100%;", :class => 'tinymce full-width' %>
|
8
|
+
|
9
|
+
<%= f.tb_datetime_select :start_at, :ampm => true, :minute_step => 5 %>
|
10
|
+
<%= f.tb_datetime_select :end_at, :ampm => true, :minute_step => 5 %>
|
39
11
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
</div>
|
47
|
-
</fieldset>
|
48
|
-
<fieldset>
|
49
|
-
<legend>Location</legend>
|
50
|
-
<div class="control-group">
|
51
|
-
<%= f.label :location,:class => "control-label" %>
|
52
|
-
<div class="controls">
|
53
|
-
<%= f.text_field :location %>
|
54
|
-
</div>
|
55
|
-
</div>
|
56
|
-
<div class="control-group">
|
57
|
-
<%= f.label :address,:class => "control-label" %>
|
58
|
-
<div class="controls">
|
59
|
-
<%= f.text_field :address %>
|
60
|
-
</div>
|
61
|
-
</div>
|
62
|
-
<div class="control-group">
|
63
|
-
<%= f.label :address_2,:class => "control-label" %>
|
64
|
-
<div class="controls">
|
65
|
-
<%= f.text_field :address_2 %>
|
66
|
-
</div>
|
67
|
-
</div>
|
68
|
-
<div class="control-group">
|
69
|
-
<%= f.label :city,:class => "control-label" %>
|
70
|
-
<div class="controls">
|
71
|
-
<%= f.text_field :city %>
|
72
|
-
</div>
|
73
|
-
</div>
|
74
|
-
<div class="control-group">
|
75
|
-
<%= f.label :state,:class => "control-label" %>
|
76
|
-
<div class="controls">
|
77
|
-
<%= f.text_field :state %>
|
78
|
-
</div>
|
79
|
-
</div>
|
80
|
-
<div class="control-group">
|
81
|
-
<%= f.label :zip,:class => "control-label" %>
|
82
|
-
<div class="controls">
|
83
|
-
<%= f.text_field :zip %>
|
84
|
-
</div>
|
85
|
-
</div>
|
86
|
-
</fieldset>
|
12
|
+
<%= f.tb_text_field :location %>
|
13
|
+
<%= f.tb_text_field :address %>
|
14
|
+
<%= f.tb_text_field :address_2 %>
|
15
|
+
<%= f.tb_text_field :city %>
|
16
|
+
<%= f.tb_text_field :state %>
|
17
|
+
<%= f.tb_text_field :zip %>
|
87
18
|
|
88
|
-
|
89
|
-
<%= f.submit "Save", :class=>"btn btn-primary"%>
|
90
|
-
<%=link_to "cancel",admin_list_spud_calendar_events_path,:class => "btn"%>
|
91
|
-
<% if !@calendar_event.new_record? %>
|
92
|
-
or
|
93
|
-
<%= link_to "Delete", admin_calendar_event_path(@calendar_event), :method=>:delete,:class => "btn btn-danger", :data => {:confirm=>"Are you sure you want delete this event?"} %>
|
94
|
-
<% end %>
|
95
|
-
</div>
|
19
|
+
<%= f.tb_save_buttons 'Event', admin_list_spud_calendar_events_path, @calendar_event.id ? admin_calendar_event_path(@calendar_event) : nil %>
|
96
20
|
|
97
|
-
<% end %>
|
98
|
-
<br class="clear" />
|
99
|
-
<script type="text/javascript">
|
100
|
-
$(document).ready(function(){
|
101
|
-
spud.admin.date_picker.init();
|
102
|
-
});
|
103
|
-
</script>
|
21
|
+
<% end %>
|
@@ -1,20 +1,28 @@
|
|
1
|
-
|
2
|
-
<%= link_to "New Event", new_admin_calendar_event_path, :class => "btn btn-primary right" %>
|
3
|
-
<%end%>
|
4
|
-
<%=content_for :detail do%>
|
5
|
-
<h3>Calendar Events - <%= @calendar_date.strftime('%B %Y') %></h3>
|
1
|
+
<% @page_name = "Events - #{@calendar_date.strftime('%B %Y')}" %>
|
6
2
|
|
7
|
-
|
8
|
-
<%=
|
9
|
-
|
3
|
+
<%= content_for :data_controls do %>
|
4
|
+
<%= link_to "New Calendar", new_admin_calendar_path, :class => "btn btn-default" %>
|
5
|
+
<%= link_to "New Event", new_admin_calendar_event_path, :class => "btn btn-primary" %>
|
6
|
+
<% end %>
|
10
7
|
|
11
|
-
|
12
|
-
<%= render :partial => 'admin/calendars/calendar_legend', :collection => @calendars, :as => :calendar %>
|
13
|
-
<li>
|
14
|
-
<%= link_to("New Calendar", new_admin_calendar_path, :class => "btn btn-primary btn-small pull-right") %>
|
15
|
-
<br style="clear:right;"/>
|
16
|
-
</li>
|
17
|
-
</ul>
|
8
|
+
<%= content_for :detail do %>
|
18
9
|
|
10
|
+
<div class="row">
|
11
|
+
<div id="spud_events_admin_calendar" class="col-md-8">
|
12
|
+
<%= render :partial => 'calendar' %>
|
13
|
+
</div>
|
19
14
|
|
20
|
-
|
15
|
+
<div class="col-md-4">
|
16
|
+
<ul id="spud_events_admin_calendar_legend">
|
17
|
+
<%= render :partial => 'admin/calendars/calendar_legend', :collection => @calendars, :as => :calendar %>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<script>
|
23
|
+
$(document).ready(function() {
|
24
|
+
spud.admin.events.init();
|
25
|
+
});
|
26
|
+
</script>
|
27
|
+
|
28
|
+
<% end %>
|
@@ -1,7 +1,8 @@
|
|
1
1
|
<li id="spud_events_admin_calendar_legend_<%= calendar.id %>" class="spud_events_admin_calendar_legend_item">
|
2
|
-
|
3
|
-
|
4
|
-
<%= link_to '
|
5
|
-
<%= link_to 'delete', admin_calendar_path(calendar), :remote => true, :data => {:confirm => "This action can't be undone. Would you like to remove the calendar \"#{calendar.title}\"?"}, :method => :delete, :class => 'js-spud-calendar-delete-action btn btn-mini btn-danger' %>
|
2
|
+
<div class="spud_events_admin_calendar_actions pull-right">
|
3
|
+
<%= link_to 'edit', edit_admin_calendar_path(calendar), :class => "btn btn-sm btn-default" %>
|
4
|
+
<%= link_to 'delete', admin_calendar_path(calendar), :remote => true, :data => {:confirm => "This action can't be undone. Would you like to remove the calendar \"#{calendar.title}\"?"}, :method => :delete, :class => 'js-spud-calendar-delete-action btn btn-sm btn-danger' %>
|
6
5
|
</div>
|
6
|
+
<%= content_tag :span, calendar.title, :style => "background-color: \##{calendar.color}", :class => 'label' %>
|
7
|
+
<div class="clearfix"></div>
|
7
8
|
</li>
|
@@ -1,20 +1,5 @@
|
|
1
|
-
<%= form_for @calendar, :url => (@calendar.new_record? ? admin_calendars_path : admin_calendar_path(@calendar))
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<div class="controls">
|
6
|
-
<%= f.text_field :title %>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
<div class="control-group">
|
10
|
-
<%= f.label :color,:class => "control-label" %>
|
11
|
-
<div class="controls">
|
12
|
-
<%= f.hidden_field :color %>
|
13
|
-
<div class="spud_events_admin_color_picker"></div>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
<div class="form-actions">
|
17
|
-
<%= f.submit "Save", :class=>"btn btn-primary"%> or <%=link_to "cancel", admin_list_spud_calendar_events_path, :class => "btn" %>
|
18
|
-
</div>
|
19
|
-
|
1
|
+
<%= form_for @calendar, :url => (@calendar.new_record? ? admin_calendars_path : admin_calendar_path(@calendar)), :builder => TbCore::FormBuilder, :html => {:class => "form-horizontal"} do |f| %>
|
2
|
+
<%= tb_form_errors(f.object) %>
|
3
|
+
<%= f.tb_text_field :title %>
|
4
|
+
<%= f.tb_save_buttons('Calendar', admin_list_spud_calendar_events_path) %>
|
20
5
|
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<h1>Events</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<tr>
|
5
|
+
<th>Title</th>
|
6
|
+
<th>Date</th>
|
7
|
+
<th> </th>
|
8
|
+
</tr>
|
9
|
+
<tbody>
|
10
|
+
<% cache(@events) do %>
|
11
|
+
<% @events.each do |event| %>
|
12
|
+
<tr>
|
13
|
+
<td><%= event.title %></td>
|
14
|
+
<td><%= event.start_at.strftime('%D') %></td>
|
15
|
+
<td><%= link_to 'Details', calendar_event_path(event) %></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
19
|
+
</tbody>
|
20
|
+
</table>
|
21
|
+
|
22
|
+
<%= will_paginate(@events) %>
|
@@ -2,4 +2,6 @@
|
|
2
2
|
<p><b>Calendar:</b> <%= @event.spud_calendar.title %></p>
|
3
3
|
<p><em><%= @event.start_at %> - <%= @event.end_at %></em></p>
|
4
4
|
<%= simple_format(@event.description) %>
|
5
|
-
|
5
|
+
|
6
|
+
<p><%= link_to 'Events List', calendar_events_path %> | <%= link_to 'Calendar', calendar_path %></p>
|
7
|
+
|
@@ -1,16 +1,19 @@
|
|
1
|
-
|
2
|
-
<div id="spud_events_calendar">
|
3
|
-
<%= render :partial => 'calendar', :locals => {:date => @calendar_date} %>
|
4
|
-
</div>
|
1
|
+
<% @page_title = @calendar_date.strftime("Events Calendar %B %Y") %>
|
5
2
|
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
</
|
3
|
+
<h1><%= @page_title %></h1>
|
4
|
+
|
5
|
+
<nav id="events-calendar-nav">
|
6
|
+
<%= link_to_previous_calendar_month(@calendar_date) %>
|
7
|
+
<%= link_to_next_calendar_month(@calendar_date) %>
|
8
|
+
</nav>
|
9
|
+
|
10
|
+
<%= spud_calendar_for_events(@events, @calendar_date) do |day, events| %>
|
11
|
+
<span class="calendar-day">
|
12
|
+
<%= day.day %>
|
13
|
+
</span>
|
14
|
+
<ul class="calendar-events">
|
15
|
+
<% events.each do |event| %>
|
16
|
+
<li><%= link_to truncate(event.title, :length => 25), calendar_event_path(event.id) %></li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
<% end %>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
en:
|
5
|
+
activerecord:
|
6
|
+
attributes:
|
7
|
+
spud_calendar_event:
|
8
|
+
spud_calendar_id: 'Calendar'
|
9
|
+
|
data/config/routes.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
|
3
2
|
# Calendar
|
4
|
-
get 'calendar
|
5
|
-
|
6
|
-
|
7
|
-
namespace :admin do
|
8
|
-
# Events
|
9
|
-
resources :calendar_events, :except => [:index]
|
10
|
-
resources :calendars, :except => [:index]
|
11
|
-
get 'events(/:month(/:year(/:calendar)))' => "calendar_events#index", :as => "list_spud_calendar_events"
|
12
|
-
end
|
3
|
+
get 'calendar(/:month/:year)' => 'calendars#show', :as => :calendar
|
4
|
+
resources :calendar_events, only: [:index, :show], path: '/events'
|
13
5
|
|
6
|
+
namespace :admin do
|
7
|
+
resources :calendar_events, except: [:index]
|
8
|
+
resources :calendars, except: [:index]
|
9
|
+
get 'events(/:month(/:year(/:calendar)))' => 'calendar_events#index', :as => 'list_spud_calendar_events'
|
10
|
+
end
|
14
11
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
class CreateSpudCalendars < ActiveRecord::Migration
|
1
|
+
class CreateSpudCalendars < ActiveRecord::Migration[4.2]
|
2
2
|
def change
|
3
3
|
create_table :spud_calendars do |t|
|
4
4
|
t.string :title
|
5
5
|
t.column :color, 'binary(6)'
|
6
|
-
|
6
|
+
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
add_index :spud_calendars, :title
|
11
11
|
end
|
12
12
|
end
|