tb_events 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +58 -0
  3. data/Rakefile +28 -0
  4. data/app/assets/images/spud/admin/events_thumb.png +0 -0
  5. data/app/assets/javascripts/calendar_events.js +2 -0
  6. data/app/assets/javascripts/calendars.js +2 -0
  7. data/app/assets/javascripts/spud/admin/calendar_events.js +2 -0
  8. data/app/assets/javascripts/spud/admin/calendars.js +0 -0
  9. data/app/assets/javascripts/spud/admin/events.js +51 -0
  10. data/app/assets/javascripts/spud/events.js +0 -0
  11. data/app/assets/lib/colorpicker/colorpicker.css +164 -0
  12. data/app/assets/lib/colorpicker/colorpicker.js +484 -0
  13. data/app/assets/lib/colorpicker/images/blank.gif +0 -0
  14. data/app/assets/lib/colorpicker/images/colorpicker_background.png +0 -0
  15. data/app/assets/lib/colorpicker/images/colorpicker_hex.png +0 -0
  16. data/app/assets/lib/colorpicker/images/colorpicker_hsb_b.png +0 -0
  17. data/app/assets/lib/colorpicker/images/colorpicker_hsb_h.png +0 -0
  18. data/app/assets/lib/colorpicker/images/colorpicker_hsb_s.png +0 -0
  19. data/app/assets/lib/colorpicker/images/colorpicker_indic.gif +0 -0
  20. data/app/assets/lib/colorpicker/images/colorpicker_overlay.png +0 -0
  21. data/app/assets/lib/colorpicker/images/colorpicker_rgb_b.png +0 -0
  22. data/app/assets/lib/colorpicker/images/colorpicker_rgb_g.png +0 -0
  23. data/app/assets/lib/colorpicker/images/colorpicker_rgb_r.png +0 -0
  24. data/app/assets/lib/colorpicker/images/colorpicker_select.gif +0 -0
  25. data/app/assets/lib/colorpicker/images/colorpicker_submit.png +0 -0
  26. data/app/assets/lib/colorpicker/images/custom_background.png +0 -0
  27. data/app/assets/lib/colorpicker/images/custom_hex.png +0 -0
  28. data/app/assets/lib/colorpicker/images/custom_hsb_b.png +0 -0
  29. data/app/assets/lib/colorpicker/images/custom_hsb_h.png +0 -0
  30. data/app/assets/lib/colorpicker/images/custom_hsb_s.png +0 -0
  31. data/app/assets/lib/colorpicker/images/custom_indic.gif +0 -0
  32. data/app/assets/lib/colorpicker/images/custom_rgb_b.png +0 -0
  33. data/app/assets/lib/colorpicker/images/custom_rgb_g.png +0 -0
  34. data/app/assets/lib/colorpicker/images/custom_rgb_r.png +0 -0
  35. data/app/assets/lib/colorpicker/images/custom_submit.png +0 -0
  36. data/app/assets/lib/colorpicker/images/select.png +0 -0
  37. data/app/assets/lib/colorpicker/images/select2.png +0 -0
  38. data/app/assets/lib/colorpicker/images/slider.png +0 -0
  39. data/app/assets/stylesheets/spud/admin/events.css +16 -0
  40. data/app/assets/stylesheets/spud/calendar_events.css +18 -0
  41. data/app/assets/stylesheets/spud/calendars.css +136 -0
  42. data/app/assets/stylesheets/spud/events.css +4 -0
  43. data/app/controllers/calendar_events_controller.rb +8 -0
  44. data/app/controllers/calendars_controller.rb +30 -0
  45. data/app/controllers/spud/admin/calendar_events_controller.rb +64 -0
  46. data/app/controllers/spud/admin/calendars_controller.rb +52 -0
  47. data/app/helpers/calendars_helper.rb +50 -0
  48. data/app/helpers/spud/admin/calendar_events_helper.rb +2 -0
  49. data/app/helpers/spud/admin/calendars_helper.rb +15 -0
  50. data/app/models/spud_calendar.rb +7 -0
  51. data/app/models/spud_calendar_event.rb +11 -0
  52. data/app/views/calendar_events/show.html.erb +5 -0
  53. data/app/views/calendars/_calendar.html.erb +26 -0
  54. data/app/views/calendars/_calendar_options.html.erb +4 -0
  55. data/app/views/calendars/show.html.erb +4 -0
  56. data/app/views/spud/admin/calendar_events/_calendar.html.erb +14 -0
  57. data/app/views/spud/admin/calendar_events/_form.html.erb +98 -0
  58. data/app/views/spud/admin/calendar_events/edit.html.erb +1 -0
  59. data/app/views/spud/admin/calendar_events/index.html.erb +20 -0
  60. data/app/views/spud/admin/calendar_events/new.html.erb +1 -0
  61. data/app/views/spud/admin/calendars/_calendar_legend.html.erb +7 -0
  62. data/app/views/spud/admin/calendars/_form.html.erb +20 -0
  63. data/app/views/spud/admin/calendars/edit.html.erb +1 -0
  64. data/app/views/spud/admin/calendars/new.html.erb +1 -0
  65. data/config/application.rb +50 -0
  66. data/config/boot.rb +6 -0
  67. data/config/routes.rb +17 -0
  68. data/db/migrate/20120216191833_create_spud_calendars.rb +12 -0
  69. data/db/migrate/20120216192531_create_spud_calendar_events.rb +15 -0
  70. data/db/migrate/20130214131628_add_location_to_spud_calendar_event.rb +10 -0
  71. data/lib/spud_events/calendar_builder.rb +133 -0
  72. data/lib/spud_events/configuration.rb +10 -0
  73. data/lib/spud_events/engine.rb +31 -0
  74. data/lib/spud_events/table_builder.rb +88 -0
  75. data/lib/spud_events/version.rb +5 -0
  76. data/lib/tb_events.rb +8 -0
  77. metadata +258 -0
@@ -0,0 +1,136 @@
1
+ /* Calendar Tables
2
+ ----------------------- */
3
+ #spud_events_admin_calendar table,
4
+ #spud_events_calendar table {
5
+ border-collapse: collapse;
6
+ font-size: 13px;
7
+ border: 1px solid #d9d9d9;;
8
+ width: 100%;
9
+ }
10
+ #spud_events_admin_calendar th,
11
+ #spud_events_calendar th {
12
+ background-image: -webkit-gradient(
13
+ linear,
14
+ left bottom,
15
+ left top,
16
+ color-stop(0, rgb(244,244,244)),
17
+ color-stop(1, rgb(255,255,255))
18
+ );
19
+ background-image: -moz-linear-gradient(
20
+ center bottom,
21
+ rgb(244,244,244) 6%,
22
+ rgb(255,255,255) 53%
23
+ );
24
+ }
25
+ #spud_events_admin_calendar td, #spud_events_admin_calendar th,
26
+ #spud_events_calendar td, #spud_events_calendar th {
27
+ padding: 0 10px;
28
+ line-height: 30px;
29
+ text-align: left;
30
+ vertical-align: middle;
31
+ }
32
+ #spud_events_admin_calendar td img, #spud_events_admin_calendar th img,
33
+ #spud_events_calendar td img, #spud_events_calendar th img {
34
+ display: block;
35
+ }
36
+ #spud_events_admin_calendar tbody tr,
37
+ #spud_events_calendar tbody tr {
38
+ border-top: 1px solid #d9d9d9;
39
+ border-bottom: 1px solid #d9d9d9;
40
+ -webkit-transition:background 0.15s ease-in;
41
+ -moz-transition:background 0.15s ease-in;
42
+ }
43
+ #spud_events_admin_calendar tbody tr:hover,
44
+ #spud_events_calendar tbody tr:hover {
45
+ background: #f0f0f0;
46
+ -webkit-transition:background 0.15s ease-in;
47
+ -moz-transition:background 0.15s ease-in;
48
+ }
49
+
50
+ #spud_events_admin_calendar,
51
+ #spud_events_calendar {
52
+ width: 700px;
53
+ padding-bottom: 50px;
54
+ position: relative;
55
+ float: left;
56
+ }
57
+ #spud_events_calendar {
58
+ width: auto;
59
+ }
60
+ #spud_events_admin_calendar p:first-child,
61
+ #spud_events_calendar p:first-child {
62
+ float: right;
63
+ }
64
+ #spud_events_admin_calendar table,
65
+ #spud_events_calendar table {
66
+ margin: 15px 0 0;
67
+ }
68
+ #spud_events_admin_calendar th,
69
+ #spud_events_calendar th {
70
+ text-align: center;
71
+ }
72
+ #spud_events_admin_calendar td,
73
+ #spud_events_calendar td {
74
+ border: 1px solid #d9d9d9;;
75
+ position: relative;
76
+ height: 90px;
77
+ padding: 0;
78
+ vertical-align: top;
79
+ width: 98px;
80
+ }
81
+ .spud_events_admin_calendar_date_container,
82
+ .spud_events_calendar_date_container {
83
+ display: block;
84
+ padding: 18px 5px 0;
85
+ position: relative;
86
+ }
87
+ span.spud_events_admin_calendar_date,
88
+ span.spud_events_calendar_date {
89
+ position: absolute;
90
+ top: 3px;
91
+ right: 3px;
92
+ font-size: 11px;
93
+ line-height: 11px;
94
+ }
95
+
96
+ /* Calendar Legend
97
+ ----------------------- */
98
+ #spud_events_admin_calendar_legend,
99
+ #spud_events_calendar_legend {
100
+ list-style: none;
101
+ border: 1px solid #d9d9d9;
102
+ padding: 0;
103
+ margin: 45px 0 0 725px;
104
+ }
105
+ #spud_events_admin_calendar_legend li,
106
+ #spud_events_calendar_legend li {
107
+ display: block;
108
+ padding: 5px 5px 5px 3px;
109
+ -webkit-transition: background 0.15s ease-in;
110
+ }
111
+ #spud_events_admin_calendar_legend li:hover,
112
+ #spud_events_calendar_legend li:hover {
113
+ background: #F0F0F0;
114
+ }
115
+ #spud_events_admin_calendar_legend li,
116
+ #spud_events_calendar_legend li {
117
+ border-bottom: 1px solid #d9d9d9;
118
+ }
119
+ #spud_events_admin_calendar_legend li:last-child,
120
+ #spud_events_calendar_legend li:last-child {
121
+ border: none;
122
+ }
123
+ .spud_events_admin_calendar_actions,
124
+ .spud_events_calendar_actions {
125
+ text-align: right;
126
+ }
127
+
128
+ #spud_events_admin_calendar_legend span,
129
+ #spud_events_calendar_legend span {
130
+ display: inline-block;
131
+ -moz-border-radius: 3px;
132
+ -webkit-border-radius: 3px;
133
+ border-radius: 3px;
134
+ padding: 2px 8px;
135
+ margin: 8px 0 0 8px;
136
+ }
@@ -0,0 +1,4 @@
1
+ /* ...
2
+ *= require spud/calendars
3
+ *= require spud/calendar_events
4
+ */
@@ -0,0 +1,8 @@
1
+ class CalendarEventsController < ApplicationController
2
+
3
+ layout Spud::Events.config.calendar_layout || 'spud/calendar'
4
+
5
+ def show
6
+ @event = SpudCalendarEvent.find(params[:id])
7
+ end
8
+ end
@@ -0,0 +1,30 @@
1
+ class CalendarsController < ApplicationController
2
+
3
+ layout Spud::Events.config.calendar_layout || 'spud/calendar'
4
+
5
+ def show
6
+ if params[:month]
7
+ year = params[:year] ? params[:year] : Time.new.year
8
+ begin
9
+ @calendar_date = Time.local(year, params[:month])
10
+ rescue
11
+ @calendar_date = default_date
12
+ end
13
+ else
14
+ @calendar_date = default_date
15
+ end
16
+ if params[:calendar] && calendar = SpudCalendar.find_by_title(params[:calendar].titleize)
17
+ @events = calendar.spud_calendar_events.where(["start_at >= ?",@calendar_date]).order(:start_at).all
18
+ else
19
+ @events = SpudCalendarEvent.where(["start_at >= ?",@calendar_date]).order(:start_at).all
20
+ end
21
+ @current_calendar = params[:calendar] ? params[:calendar] : 0
22
+ @page_title = @calendar_date.strftime("Calendar - %B %Y")
23
+ end
24
+
25
+ def default_date
26
+ tempDate = Time.new
27
+ return Time.local(tempDate.year,tempDate.month)
28
+
29
+ end
30
+ end
@@ -0,0 +1,64 @@
1
+ class Spud::Admin::CalendarEventsController < Spud::Admin::ApplicationController
2
+
3
+ layout 'spud/admin/detail'
4
+ add_breadcrumb "Events", :spud_admin_list_spud_calendar_events_path
5
+ belongs_to_spud_app :events
6
+
7
+ respond_to :html, :xml, :json
8
+ respond_to :js, :only => [:index, ]
9
+
10
+ def index
11
+ if params[:month]
12
+ year = params[:year] ? params[:year] : Time.new.year
13
+ begin
14
+ @calendar_date = Time.local(year, params[:month])
15
+ rescue
16
+ @calendar_date = Time.new
17
+ end
18
+ else
19
+ @calendar_date = Time.new
20
+ end
21
+
22
+ if params[:spud_calendar] && calendar = SpudCalendar.find_by_title(params[:spud_calendar].titleize)
23
+ @calendar_events = calendar.events
24
+ else
25
+ @calendar_events = SpudCalendarEvent
26
+ end
27
+ @calendar_events = @calendar_events.in_month_of(@calendar_date).order('spud_calendar_events.start_at ASC').all
28
+
29
+ @calendars = SpudCalendar.all
30
+ @current_calendar = params[:spud_calendar] ? params[:spud_calendar] : 0
31
+
32
+ respond_with(@calendars, :include => :events)
33
+ end
34
+
35
+ def new
36
+ @calendar_event = SpudCalendarEvent.new
37
+ if params[:spud_calendar]
38
+ @calendar_event.spud_calendar_id = SpudCalendar.find_by_title(params[:spud_calendar].titleize).id
39
+ end
40
+ end
41
+
42
+ def edit
43
+ @calendar_event = SpudCalendarEvent.find(params[:id])
44
+ end
45
+
46
+ def create
47
+ @calendar_event = SpudCalendarEvent.new(params[:spud_calendar_event])
48
+ flash[:notice] = 'Calendar event was successfully created.' if @calendar_event.save
49
+ respond_with(@calendar_event, :location => spud_admin_list_spud_calendar_events_path)
50
+ end
51
+
52
+ def update
53
+ @calendar_event = SpudCalendarEvent.find(params[:id])
54
+ flash[:notice] = 'Calendar event was successfully updated.' if @calendar_event.update_attributes(params[:spud_calendar_event])
55
+ respond_with(@calendar_event, :location =>spud_admin_list_spud_calendar_events_path)
56
+ end
57
+
58
+ def destroy
59
+ @calendar_event = SpudCalendarEvent.find(params[:id])
60
+ @calendar_event.destroy
61
+ respond_with(@calendar_event, :location => spud_admin_list_spud_calendar_events_path)
62
+ end
63
+
64
+ end
@@ -0,0 +1,52 @@
1
+ class Spud::Admin::CalendarsController < Spud::Admin::ApplicationController
2
+
3
+ layout 'spud/admin/detail'
4
+ add_breadcrumb "Events", :spud_admin_list_spud_calendar_events_path
5
+
6
+ belongs_to_spud_app :events
7
+
8
+ respond_to :html, :xml, :json, :js
9
+
10
+ def new
11
+ @page_name = "New Calendar"
12
+ @calendar = SpudCalendar.new
13
+ respond_with(@calendar)
14
+ end
15
+
16
+ def create
17
+ @calendar = SpudCalendar.new(params[:spud_calendar])
18
+ if @calendar.save
19
+ redirect_to spud_admin_list_spud_calendar_events_path
20
+ else
21
+ render :action => "new"
22
+ end
23
+ end
24
+
25
+ def edit
26
+ @page_name = "Edit Calendar"
27
+ @calendar = SpudCalendar.find(params[:id])
28
+ respond_with(@calendar)
29
+ end
30
+
31
+ def update
32
+ @calendar = SpudCalendar.find(params[:id])
33
+ if @calendar.update_attributes(params[:spud_calendar])
34
+ flash[:notice] = 'Calendar was successfully updated.'
35
+ redirect_to spud_admin_list_spud_calendar_events_path
36
+ else
37
+ render :action => "edit"
38
+ end
39
+ end
40
+
41
+ def destroy
42
+ @calendar = SpudCalendar.find(params[:id])
43
+ @calendar.spud_calendar_events.each do |event|
44
+ event.update_attribute(:spud_calendar_id, 0)
45
+ end
46
+ @calendar.destroy
47
+ respond_with(@calendar) do |format|
48
+ format.js { render(:nothing => true) }
49
+ end
50
+ end
51
+
52
+ end
@@ -0,0 +1,50 @@
1
+ module CalendarsHelper
2
+
3
+ def link_to_previous_calendar_month(date, url_for_options)
4
+ date = date.advance(:months => -1)
5
+ calendar = params[:calendar] ? params[:calendar] : nil
6
+ link_to('&laquo; Previous Month'.html_safe, calendar_path(:month => date.month, :year => date.year, :calendar => calendar), :class => 'spud_events_calendar_link previous_calendar btn').html_safe
7
+ end
8
+
9
+ def link_to_next_calendar_month(date, url_for_options)
10
+ date = date.advance(:months => 1)
11
+ calendar = params[:calendar] ? params[:calendar] : nil
12
+ link_to('Next Month &raquo;'.html_safe, calendar_path(:month => date.month, :year => date.year, :calendar => calendar), :class => 'spud_events_calendar_link next_calendar btn').html_safe
13
+ end
14
+
15
+ def build_calendar_for(objects, *args, &block)
16
+ raise ArgumentError, "Missing block" unless block_given?
17
+ options = args.last.is_a?(Hash) ? args.pop : {}
18
+ html_options = options[:html]
19
+ builder = options[:builder] || Spud::Events::CalendarBuilder
20
+ calendar = options[:calendar] || Spud::Events::Calendar
21
+
22
+ content = with_output_buffer{block.call(builder.new(objects||[], self, calendar, options))}
23
+ self.content_tag(:table, content, html_options, false)
24
+ end
25
+
26
+ def get_calendar_options(text_for_all)
27
+ options_for_select(SpudCalendar.all.collect { |f| [f.title, f.title.gsub(/([^A-Z0-9]+)/i, "-").downcase] }.insert(0, text_for_all), @current_calendar)
28
+ end
29
+
30
+ def calendar_fore_color(backcolor)
31
+ fore_color = "ffffff"
32
+ if backcolor.length != 6
33
+ return fore_color
34
+ end
35
+
36
+ red = backcolor[0,2].hex
37
+ green = backcolor[2,2].hex
38
+ blue = backcolor[4,2].hex
39
+
40
+ perceived_brightness = Math.sqrt(red*red*0.241 + green*green*0.691 + blue*blue*0.068)
41
+
42
+
43
+ # average = (red+green+blue) / 3
44
+ if(perceived_brightness >= 130)
45
+ return "000000"
46
+ else
47
+ return fore_color
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,2 @@
1
+ module Spud::Admin::CalendarEventsHelper
2
+ end
@@ -0,0 +1,15 @@
1
+ module Spud::Admin::CalendarsHelper
2
+
3
+ def link_to_previous_admin_calendar_month(date, url_for_options)
4
+ date = date.advance(:months => -1)
5
+ calendar = params[:calendar] ? params[:calendar] : nil
6
+ link_to('&laquo; Previous Month'.html_safe, spud_admin_list_spud_calendar_events_path(:month => date.month, :year => date.year, :calendar => calendar), :class => 'spud_events_calendar_link previous_calendar btn').html_safe
7
+ end
8
+
9
+ def link_to_next_admin_calendar_month(date, url_for_options)
10
+ date = date.advance(:months => 1)
11
+ calendar = params[:calendar] ? params[:calendar] : nil
12
+ link_to('Next Month &raquo;'.html_safe, spud_admin_list_spud_calendar_events_path(:month => date.month, :year => date.year, :calendar => calendar), :class => 'spud_events_calendar_link next_calendar btn').html_safe
13
+ end
14
+
15
+ end
@@ -0,0 +1,7 @@
1
+ class SpudCalendar < ActiveRecord::Base
2
+ has_many :spud_calendar_events, :dependent => :destroy
3
+ validates_presence_of :title, :color
4
+
5
+ attr_accessible :title, :color
6
+
7
+ end
@@ -0,0 +1,11 @@
1
+ class SpudCalendarEvent < ActiveRecord::Base
2
+ belongs_to :spud_calendar
3
+ validates_presence_of :title, :start_at, :end_at, :spud_calendar_id
4
+
5
+ attr_accessible :title, :description, :start_at, :end_at, :all_day, :spud_calendar_id, :spud_calendar, :location, :address, :address_2, :city, :state, :zip
6
+
7
+ def self.in_month_of(month)
8
+ where(["spud_calendar_events.start_at <= ? AND spud_calendar_events.start_at >= ?", month.end_of_month, month.beginning_of_month])
9
+ end
10
+
11
+ end
@@ -0,0 +1,5 @@
1
+ <h2><%= @event.title %></h2>
2
+ <h4 class="spud_calendar_event_date">
3
+ <%= @event.start_at.strftime('%B %d, %Y') %>
4
+ </h4>
5
+ <p><%= @event.description %></p>
@@ -0,0 +1,26 @@
1
+ <div>
2
+ <h2><%= date.strftime("%B %Y") %></h2>
3
+ <% build_calendar_for @events, :year => date.year, :month => date.month do |t| %>
4
+ <%= raw t.head('S', 'M', 'T', 'W', 'T', 'F', 'S') %>
5
+ <% t.day do |day, tasks| %>
6
+ <%= content_tag :span, day.day, :class => (tasks.count > 0 ? "spud_events_calendar_date spud_events_calendar_date_active" : "spud_events_calendar_date") %>
7
+ <% end %>
8
+ <% end %>
9
+ </div>
10
+
11
+ <nav id="spud_events_calendar_nav">
12
+ <%= link_to_previous_calendar_month(@calendar_date, {:controller => 'spud/events/calendars', :action => :show}) %>
13
+ <%= link_to_next_calendar_month(@calendar_date, {:controller => 'spud/events/calendars', :action => :show}) %>
14
+ </nav>
15
+
16
+ <%= build_calendar_for @events, :year => date.year, :month => date.month do |t| %>
17
+ <%= raw t.head('S', 'M', 'T', 'W', 'T', 'F', 'S') %>
18
+ <%= t.day do |day, tasks| %>
19
+ <div class="spud_events_calendar_date_container">
20
+ <%= content_tag :span, day.day, :class => (tasks.count > 0 ? "spud_events_calendar_date spud_events_calendar_date_active" : "spud_events_calendar_date") %>
21
+ <% tasks.each do |task| %>
22
+ <%= link_to task.title[0,25], "#", :class => "spud_events_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)};" %>
23
+ <% end %>
24
+ </div>
25
+ <% end %>
26
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <%= form_tag calendar_path(@calendar_date.strftime("%b").downcase, @calendar_date.strftime("%Y")), :method => 'post', :id => "spud_events_calendar_for" do %>
2
+ <%= select_tag 'calendar', get_calendar_options('All Calendars') %>
3
+ <%= submit_tag 'Go' %>
4
+ <% end %>
@@ -0,0 +1,4 @@
1
+ <%= render :partial => 'calendar_options' %>
2
+ <div id="spud_events_calendar">
3
+ <%= render :partial => 'calendar', :locals => {:date => @calendar_date} %>
4
+ </div>
@@ -0,0 +1,14 @@
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>
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 task.title[0,25], edit_spud_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)}" %>
11
+ <% end %>
12
+ </div>
13
+ <% end %>
14
+ <% end %>
@@ -0,0 +1,98 @@
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>
24
+
25
+ <fieldset>
26
+ <legend>Event Time</legend>
27
+
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" %>
39
+
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>
87
+
88
+ <div class="form-actions">
89
+ <%=f.submit "Create Event", :class=>"btn btn-primary"%> <%= link_to "Delete", spud_admin_calendar_event_path(@calendar_event), :method=>:delete,:class => "btn btn-danger", :confirm=>"Are you sure you want delete this event?" if !@calendar_event.new_record? %> or <%=link_to "cancel",spud_admin_list_spud_calendar_events_path,:class => "btn"%>
90
+ </div>
91
+
92
+ <% end %>
93
+ <br class="clear" />
94
+ <script type="text/javascript">
95
+ $(document).ready(function(){
96
+ spud.admin.date_picker.init();
97
+ });
98
+ </script>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => spud_admin_calendar_event_path(@calendar_event)} %>
@@ -0,0 +1,20 @@
1
+ <%=content_for :data_controls do%>
2
+ <%= link_to "New Event", new_spud_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>
6
+
7
+ <div id="spud_events_admin_calendar">
8
+ <%= render :partial => 'calendar' %>
9
+ </div>
10
+
11
+ <ul id="spud_events_admin_calendar_legend">
12
+ <%= render :partial => 'spud/admin/calendars/calendar_legend', :collection => @calendars, :as => :calendar %>
13
+ <li>
14
+ <%= link_to("New Calendar", new_spud_admin_calendar_path, :class => "btn btn-primary btn-small pull-right") %>
15
+ <br style="clear:right;"/>
16
+ </li>
17
+ </ul>
18
+
19
+
20
+ <%end%>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form', :locals => {:path => spud_admin_calendar_events_path} %>
@@ -0,0 +1,7 @@
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_spud_admin_calendar_path(calendar), :class => "btn btn-mini" %>
5
+ <%= link_to 'delete', spud_admin_calendar_path(calendar), :remote => true, :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' %>
6
+ </div>
7
+ </li>
@@ -0,0 +1,20 @@
1
+ <%= form_for @calendar, :url => (@calendar.new_record? ? spud_admin_calendars_path : spud_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",spud_admin_list_spud_calendar_events_path,:class => "btn"%>
18
+ </div>
19
+
20
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form' %>
@@ -0,0 +1 @@
1
+ <%= render :partial => 'form' %>
@@ -0,0 +1,50 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ if defined?(Bundler)
6
+ # If you precompile assets before deploying to production, use this line
7
+ Bundler.require *Rails.groups(:assets => %w(development test))
8
+ # If you want your assets lazily compiled in production, use this line
9
+ # Bundler.require(:default, :assets, Rails.env)
10
+ end
11
+
12
+ module Spud
13
+ module Events
14
+ class Application < Rails::Application
15
+ # Settings in config/environments/* take precedence over those specified here.
16
+ # Application configuration should go into files in config/initializers
17
+ # -- all .rb files in that directory are automatically loaded.
18
+
19
+ # Custom directories with classes and modules you want to be autoloadable.
20
+ # config.autoload_paths += %W(#{config.root}/extras)
21
+
22
+ # Only load the plugins named here, in the order given (default is alphabetical).
23
+ # :all can be used as a placeholder for all plugins not explicitly named.
24
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
25
+
26
+ # Activate observers that should always be running.
27
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
28
+
29
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
30
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
31
+ # config.time_zone = 'Central Time (US & Canada)'
32
+
33
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
34
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
35
+ # config.i18n.default_locale = :de
36
+
37
+ # Configure the default encoding used in templates for Ruby 1.9.
38
+ config.encoding = "utf-8"
39
+
40
+ # Configure sensitive parameters which will be filtered from the log file.
41
+ config.filter_parameters += [:password]
42
+
43
+ # Enable the asset pipeline
44
+ config.assets.enabled = true
45
+
46
+ # Version of your assets, change this if you want to expire all your assets
47
+ config.assets.version = '1.0'
48
+ end
49
+ end
50
+ end