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.
Files changed (83) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +13 -1
  3. data/Rakefile +2 -2
  4. data/app/assets/javascripts/admin/events/application.js +16 -0
  5. data/app/assets/javascripts/{calendar_events.js → admin/events/calendar_events.js} +0 -0
  6. data/app/assets/javascripts/{spud/admin → admin/events}/calendars.js +0 -0
  7. data/app/assets/stylesheets/admin/events/application.css +4 -0
  8. data/app/assets/{javascripts/spud/events.js → stylesheets/admin/events/calendar_events.css} +0 -0
  9. data/app/assets/stylesheets/{spud → admin/events}/calendars.css +23 -28
  10. data/app/controllers/admin/calendar_events_controller.rb +13 -15
  11. data/app/controllers/admin/calendars_controller.rb +9 -11
  12. data/app/controllers/calendar_events_controller.rb +12 -6
  13. data/app/controllers/calendars_controller.rb +18 -18
  14. data/app/helpers/admin/calendars_helper.rb +6 -8
  15. data/app/helpers/calendars_helper.rb +66 -35
  16. data/app/models/spud_calendar.rb +30 -2
  17. data/app/models/spud_calendar_event.rb +1 -18
  18. data/app/models/spud_events/calendar_event_model.rb +31 -0
  19. data/app/views/admin/calendar_events/_calendar.html.erb +16 -11
  20. data/app/views/admin/calendar_events/_form.html.erb +16 -98
  21. data/app/views/admin/calendar_events/index.html.erb +24 -16
  22. data/app/views/admin/calendars/_calendar_legend.html.erb +5 -4
  23. data/app/views/admin/calendars/_form.html.erb +4 -19
  24. data/app/views/calendar_events/index.html.erb +22 -0
  25. data/app/views/calendar_events/show.html.erb +3 -1
  26. data/app/views/calendars/show.html.erb +18 -15
  27. data/config/locales/en.yml +9 -0
  28. data/config/routes.rb +7 -10
  29. data/db/migrate/20120216191833_create_spud_calendars.rb +3 -3
  30. data/db/migrate/20120216192531_create_spud_calendar_events.rb +1 -1
  31. data/db/migrate/20130214131628_add_location_to_spud_calendar_event.rb +1 -1
  32. data/db/migrate/20140723203144_add_identifier_to_spud_calendars.rb +6 -0
  33. data/db/migrate/20140730182213_remove_color_from_spud_calendars.rb +9 -0
  34. data/lib/spud_events/calendar_builder.rb +53 -0
  35. data/lib/spud_events/configuration.rb +6 -0
  36. data/lib/spud_events/engine.rb +25 -0
  37. data/lib/spud_events/version.rb +3 -0
  38. data/lib/tb_events.rb +4 -4
  39. metadata +62 -110
  40. data/app/assets/javascripts/calendars.js +0 -2
  41. data/app/assets/javascripts/spud/admin/calendar_events.js +0 -2
  42. data/app/assets/javascripts/spud/admin/events.js +0 -51
  43. data/app/assets/lib/colorpicker/colorpicker.css +0 -164
  44. data/app/assets/lib/colorpicker/colorpicker.js +0 -484
  45. data/app/assets/lib/colorpicker/images/blank.gif +0 -0
  46. data/app/assets/lib/colorpicker/images/colorpicker_background.png +0 -0
  47. data/app/assets/lib/colorpicker/images/colorpicker_hex.png +0 -0
  48. data/app/assets/lib/colorpicker/images/colorpicker_hsb_b.png +0 -0
  49. data/app/assets/lib/colorpicker/images/colorpicker_hsb_h.png +0 -0
  50. data/app/assets/lib/colorpicker/images/colorpicker_hsb_s.png +0 -0
  51. data/app/assets/lib/colorpicker/images/colorpicker_indic.gif +0 -0
  52. data/app/assets/lib/colorpicker/images/colorpicker_overlay.png +0 -0
  53. data/app/assets/lib/colorpicker/images/colorpicker_rgb_b.png +0 -0
  54. data/app/assets/lib/colorpicker/images/colorpicker_rgb_g.png +0 -0
  55. data/app/assets/lib/colorpicker/images/colorpicker_rgb_r.png +0 -0
  56. data/app/assets/lib/colorpicker/images/colorpicker_select.gif +0 -0
  57. data/app/assets/lib/colorpicker/images/colorpicker_submit.png +0 -0
  58. data/app/assets/lib/colorpicker/images/custom_background.png +0 -0
  59. data/app/assets/lib/colorpicker/images/custom_hex.png +0 -0
  60. data/app/assets/lib/colorpicker/images/custom_hsb_b.png +0 -0
  61. data/app/assets/lib/colorpicker/images/custom_hsb_h.png +0 -0
  62. data/app/assets/lib/colorpicker/images/custom_hsb_s.png +0 -0
  63. data/app/assets/lib/colorpicker/images/custom_indic.gif +0 -0
  64. data/app/assets/lib/colorpicker/images/custom_rgb_b.png +0 -0
  65. data/app/assets/lib/colorpicker/images/custom_rgb_g.png +0 -0
  66. data/app/assets/lib/colorpicker/images/custom_rgb_r.png +0 -0
  67. data/app/assets/lib/colorpicker/images/custom_submit.png +0 -0
  68. data/app/assets/lib/colorpicker/images/select.png +0 -0
  69. data/app/assets/lib/colorpicker/images/select2.png +0 -0
  70. data/app/assets/lib/colorpicker/images/slider.png +0 -0
  71. data/app/assets/stylesheets/spud/admin/events.css +0 -16
  72. data/app/assets/stylesheets/spud/calendar_events.css +0 -18
  73. data/app/assets/stylesheets/spud/events.css +0 -4
  74. data/app/views/calendars/_calendar.html.erb +0 -26
  75. data/app/views/calendars/_calendar_options.html.erb +0 -4
  76. data/config/application.rb +0 -50
  77. data/config/boot.rb +0 -6
  78. data/lib/spud/events/calendar.rb +0 -85
  79. data/lib/spud/events/calendar_builder.rb +0 -58
  80. data/lib/spud/events/configuration.rb +0 -8
  81. data/lib/spud/events/engine.rb +0 -26
  82. data/lib/spud/events/table_builder.rb +0 -88
  83. data/lib/spud/events/version.rb +0 -5
@@ -1,4 +1,32 @@
1
1
  class SpudCalendar < ActiveRecord::Base
2
- has_many :spud_calendar_events, :dependent => :destroy
3
- validates_presence_of :title, :color
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 < ActiveRecord::Base
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
- <p><%= link_to_next_admin_calendar_month(@calendar_date, :class => "btn") %></p>
2
- <p><%= link_to_previous_admin_calendar_month(@calendar_date, :class => "btn") %></p>
1
+ <%= link_to_next_admin_calendar_month @calendar_date %>
2
+ <%= link_to_previous_admin_calendar_month @calendar_date %>
3
3
 
4
- <%= build_calendar_for @calendar_events, :year => @calendar_date.year, :month => @calendar_date.month do |t| %>
5
- <%= raw t.head('S', 'M', 'T', 'W', 'T', 'F', 'S') %>
6
- <%= t.day do |day, tasks| %>
7
- <div class="spud_events_admin_calendar_date_container">
8
- <%= content_tag :span, day.day, :class => (tasks.count > 0 ? "spud_events_admin_calendar_date spud_events_admin_calendar_date_active" : "spud_events_admin_calendar_date") %>
9
- <% tasks.each do |task| %>
10
- <%= link_to truncate(task.title, :length => 25), edit_admin_calendar_event_path(task.id), :class => "spud_events_admin_calendar_event_marker spud_events_calendar_event_#{task.spud_calendar_id}", :style => "background-color: \##{task.spud_calendar.color}; color:\##{calendar_fore_color(task.spud_calendar.color)}" %>
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
- </div>
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
- <%= error_messages_for(f.object) %>
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
- <fieldset>
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
- <div class="control-group">
29
- <%= f.label :start_at, "Starts",:class => "control-label" %>
30
- <div class="controls">
31
- <%= f.text_field :start_at,:value => f.object.start_at.blank? ? Time.now.strftime("%Y-%m-%d %H:%M") : f.object.start_at.strftime("%Y-%m-%d %H:%M") , :class => 'spud_form_date_picker' %>
32
- <span class="time_select">
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
- <div class="controls">
41
- <%= f.text_field :end_at,:value => f.object.end_at.blank? ? Time.now.strftime("%Y-%m-%d %H:%M") : f.object.end_at.strftime("%Y-%m-%d %H:%M") , :class => 'spud_form_date_picker' %>
42
- <span class="time_select">
43
- <%= f.time_select :end_at, :ignore_date => true,:ampm => true%>
44
- </span>
45
- </div>
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
- <div class="form-actions">
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
- <%=content_for :data_controls do%>
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
- <div id="spud_events_admin_calendar">
8
- <%= render :partial => 'calendar' %>
9
- </div>
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
- <ul id="spud_events_admin_calendar_legend">
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
- <%end%>
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
- <%= content_tag :span, calendar.title, :style => "background-color: \##{calendar.color};color:\##{calendar_fore_color(calendar.color)}"%>
3
- <div class="spud_events_admin_calendar_actions">
4
- <%= link_to 'edit', edit_admin_calendar_path(calendar), :class => "btn btn-mini" %>
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)),:html=>{:class=>"form-horizontal"} do |f| %>
2
- <%= error_messages_for(f.object) %>
3
- <div class="control-group">
4
- <%= f.label :title,:class => "control-label" %>
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>&nbsp;</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
- <p><%= link_to 'Back', calendar_path %></p>
5
+
6
+ <p><%= link_to 'Events List', calendar_events_path %> | <%= link_to 'Calendar', calendar_path %></p>
7
+
@@ -1,16 +1,19 @@
1
- <%= render :partial => 'calendar_options' %>
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
- <div id="spud_events_list">
7
- <% @events.each do |event| %>
8
- <div class="spud_event_list_item">
9
- <h3><%= event.title %></h3>
10
- <p><b>Calendar:</b> <%= event.spud_calendar.title %></p>
11
- <p><em><%= event.start_at %> - <%= event.end_at %></em></p>
12
- <%= simple_format(event.description) %>
13
- <p><%= link_to 'Details', event_path(event) %></p>
14
- </div>
15
- <% end %>
16
- </div>
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
+
@@ -1,14 +1,11 @@
1
1
  Rails.application.routes.draw do
2
-
3
2
  # Calendar
4
- get 'calendar/event/:id' => "calendar_events#show", :as => "event"
5
- match 'calendar(/:month(/:year(/:calendar)))' => "calendars#show", :as => "calendar", :via => [:get, :post]
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
@@ -1,4 +1,4 @@
1
- class CreateSpudCalendarEvents < ActiveRecord::Migration
1
+ class CreateSpudCalendarEvents < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :spud_calendar_events do |t|
4
4
  t.references :spud_calendar