caboose-cms 0.9.124 → 0.9.125

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 89db90e456ec10da8d902580a6c3fe73ca091a6e
4
- data.tar.gz: 3aae82e00416e0808c85c12de81b2db703cf2b03
3
+ metadata.gz: 6d0f41c9e4aac8144f0c2ea941bb103882a5816b
4
+ data.tar.gz: 56262fc53302f3ff7796ab9fe98a7ce744a44567
5
5
  SHA512:
6
- metadata.gz: 23fd6652a4da42ef9781b17abc12509ba99119e00e84911477276ea48ee4312131cac84fce5c696d0fd9be7ffb50a5391f1d681da8cb29b75d48170cb8249fd5
7
- data.tar.gz: 00bc440aadc45ce5aff30034dc57400193a978b2683fa3067bcb69ebe15fceb9ab536f3ea0d0fed215d7d2bf9f5597bea0fde326681f2f3567180c738c113ebb
6
+ metadata.gz: 2123ed23c5f19fdb0a2884c9143bf34b59fbfd6a282299805b19fa45ecbd0c3d98d385dc0aa3f9b72a8ea95ec2122a78321887cae945ac49bd684ff5931e395f
7
+ data.tar.gz: 5096d6d79e8e5fb41afc0ca2e93aaa0d854ed6612ae5cad8ddff65d6bee9fa0ea5011e3072a4454d6fb2510dce0cbee4e6a560ceac95cca60603a9b4278d8f17
@@ -6,7 +6,60 @@ module Caboose
6
6
 
7
7
  def before_action
8
8
  @page = Page.page_with_uri(request.host_with_port, '/admin')
9
- end
9
+ end
10
+
11
+ # @route GET /calendar/feed/:id
12
+ def feed
13
+ cal = Caboose::Calendar.find(params[:id])
14
+ if cal
15
+ query = []
16
+ args = []
17
+ d1 = Date.parse(params[:start])
18
+ d2 = Date.parse(params[:end])
19
+ query << "(( cast(begin_date as date) >= ? and cast(begin_date as date) <= ?) or ( cast(end_date as date) >= ? and cast(end_date as date) <= ? )) or ( cast(begin_date as date) <= ? and cast(end_date as date) >= ? )"
20
+ args << d1
21
+ args << d2
22
+ args << d1
23
+ args << d2
24
+ args << d1
25
+ args << d2
26
+ where = [query.join(' and ')]
27
+ where2 = params[:admin] == 'true' && params[:published] == 'false' ? '(published is false)' : '(published is true)'
28
+ args.each { |arg| where << arg }
29
+ events = Caboose::CalendarEvent.where(where2).where("calendar_id = ?", cal.id).where(where).reorder(:begin_date).all
30
+ render :json => events.collect { |e|
31
+ begin_date = e.all_day ? Date.parse(e.begin_date.strftime("%Y-%m-%d")) : e.begin_date
32
+ end_date = e.all_day ? Date.parse(e.end_date.strftime("%Y-%m-%d")).next : e.end_date
33
+ {
34
+ 'id' => e.id,
35
+ 'title' => (e.published ? e.name : "#{e.name} (DRAFT)"),
36
+ 'start' => begin_date.strftime('%Y-%m-%d %H:%M:%S'),
37
+ 'end' => end_date.strftime('%Y-%m-%d %H:%M:%S'),
38
+ 'url' => (params[:admin] == 'true' ? "/admin/calendars/#{cal.id}/events/#{e.id}" : "/calendar-events/#{e.id}"),
39
+ 'allDay' => e.all_day
40
+ }
41
+ }
42
+ else
43
+ return nil
44
+ end
45
+ end
46
+
47
+ # @route GET /calendar/event/:id/json
48
+ def json
49
+ event = Caboose::CalendarEvent.find(params[:id])
50
+ e = {
51
+ 'id' => event.id,
52
+ 'name' => event.name,
53
+ 'begin_date' => event.begin_date.strftime('%Y-%m-%d %H:%M:%S'),
54
+ 'end_date' => event.end_date.strftime('%Y-%m-%d %H:%M:%S'),
55
+ 'location' => event.location,
56
+ 'description' => event.description,
57
+ 'all_day' => event.all_day
58
+ }
59
+ if event
60
+ render :json => e
61
+ end
62
+ end
10
63
 
11
64
  # @route GET /admin/calendars
12
65
  def admin_index
@@ -39,9 +39,10 @@ module Caboose
39
39
  # @route DELETE /admin/event-groups/:id
40
40
  def admin_delete
41
41
  return unless user_is_allowed('calendars', 'delete')
42
+ cal_id = CalendarEvent.where(:calendar_event_group_id => params[:id]).first.calendar_id
42
43
  CalendarEvent.where(:calendar_event_group_id => params[:id]).destroy_all
43
44
  CalendarEventGroup.find(params[:id]).destroy
44
- resp = StdClass.new({ 'redirect' => "/admin/calendars" })
45
+ resp = StdClass.new({ 'redirect' => "/admin/calendars/#{cal_id}" })
45
46
  render :json => resp
46
47
  end
47
48
 
@@ -13,36 +13,40 @@ module Caboose
13
13
  @event.calendar_event_group_id = g.id
14
14
  @event.save
15
15
  end
16
- render :layout => 'caboose/modal'
16
+ render :layout => 'caboose/admin'
17
+ end
18
+
19
+ # @route GET /calendar-events/:id
20
+ def show
21
+ @event = CalendarEvent.where(:id => params[:id], :published => true).first
22
+ render :file => "caboose/extras/error404" and return if @event.nil?
23
+ @page.title = @event.name if @event
24
+ render :layout => 'caboose/application'
17
25
  end
18
26
 
19
27
  # @route_priority 1
20
28
  # @route GET /admin/calendars/:calendar_id/events/new
21
- def admin_new
22
- return unless user_is_allowed('calendars', 'edit')
23
- @calendar = Calendar.find(params[:calendar_id])
24
- @begin_date = DateTime.iso8601(params[:begin_date])
25
- render :layout => 'caboose/modal'
26
- end
29
+ # def admin_new
30
+ # return unless user_is_allowed('calendars', 'edit')
31
+ # @calendar = Calendar.find(params[:calendar_id])
32
+ # @begin_date = DateTime.iso8601(params[:begin_date])
33
+ # render :layout => 'caboose/admin'
34
+ # end
27
35
 
28
36
  # @route POST /admin/calendars/:calendar_id/events
29
37
  def admin_add
30
38
  return unless user_is_allowed('calendars', 'edit')
31
-
32
39
  resp = StdClass.new
33
40
  event = CalendarEvent.new
34
41
  event.calendar_id = params[:calendar_id]
35
42
  event.name = params[:name]
36
- event.begin_date = DateTime.iso8601("#{params[:begin_date]}T10:00:00-05:00")
37
- event.end_date = DateTime.iso8601("#{params[:begin_date]}T10:00:00-05:00")
38
- event.all_day = true
39
-
40
- if event.name.nil? || event.name.strip.length == 0
41
- resp.error = "Please enter an event name."
42
- else
43
- event.save
44
- resp.redirect = "/admin/calendars/#{event.calendar_id}/events/#{event.id}"
45
- end
43
+ event.begin_date = DateTime.parse("#{params[:begin_date]}T10:00:00-05:00")
44
+ event.end_date = DateTime.parse("#{params[:begin_date]}T10:00:00-05:00")
45
+ event.all_day = false
46
+ event.published = false
47
+ event.url_label = "More Information"
48
+ event.save
49
+ resp.redirect = "/admin/calendars/#{event.calendar_id}/events/#{event.id}"
46
50
  render :json => resp
47
51
  end
48
52
 
@@ -59,6 +63,9 @@ module Caboose
59
63
  when 'name' then event.name = value
60
64
  when 'location' then event.location = value
61
65
  when 'description' then event.description = value
66
+ when 'url' then event.url = value
67
+ when 'url_label' then event.url_label = value
68
+ when 'published' then event.published = value
62
69
  when 'all_day' then event.all_day = value
63
70
  when 'begin_date'
64
71
  t = event.begin_date ? event.begin_date.strftime('%H:%M %z') : '10:00 -0500'
@@ -79,20 +86,32 @@ module Caboose
79
86
  g.date_end = event.end_date.to_date if g.date_end.nil?
80
87
  g.save
81
88
  end
82
- event.repeats = value
83
-
89
+ event.repeats = value
84
90
  end
85
91
  end
86
92
 
87
93
  resp.success = save && event.save
88
94
  render :json => resp
89
- end
95
+ end
96
+
97
+
98
+ # @route POST /admin/calendars/:calendar_id/events/:event_id/image
99
+ def admin_update_image
100
+ return if !user_is_allowed('calendars', 'edit')
101
+ resp = Caboose::StdClass.new
102
+ event = CalendarEvent.find(params[:event_id])
103
+ event.image = params[:image]
104
+ resp.success = event.save
105
+ resp.attributes = { 'image' => { 'value' => event.image.url(:thumb) }}
106
+ render :text => resp.to_json
107
+ end
90
108
 
91
109
  # @route DELETE /admin/calendars/:calendar_id/events/:id
92
110
  def admin_delete
93
111
  return unless user_is_allowed('calendars', 'delete')
112
+ cal_id = CalendarEvent.find(params[:id]).calendar_id
94
113
  CalendarEvent.find(params[:id]).destroy
95
- resp = StdClass.new({ 'redirect' => "/admin/calendars" })
114
+ resp = StdClass.new({ 'redirect' => "/admin/calendars/#{cal_id}" })
96
115
  render :json => resp
97
116
  end
98
117
 
@@ -13,7 +13,21 @@ module Caboose
13
13
  :begin_date ,
14
14
  :end_date ,
15
15
  :all_day ,
16
- :repeats
16
+ :repeats ,
17
+ :published ,
18
+ :url ,
19
+ :url_label
20
+
21
+
22
+ has_attached_file :image,
23
+ :path => ':caboose_prefixevents/:id_:style.:extension',
24
+ :default_url => 'http://placehold.it/300x300',
25
+ :styles => {
26
+ :thumb => '150x150>',
27
+ :large => '800x800>',
28
+ :huge => '1600x1600>'
29
+ }
30
+ do_not_validate_attachment_file_type :image
17
31
 
18
32
  def self.events_for_day(calendar_id, d)
19
33
  q = ["calendar_id = ?
@@ -24,16 +38,22 @@ module Caboose
24
38
  end
25
39
 
26
40
  def duplicate(d)
41
+ btime = self.begin_date.to_s[10..-1]
42
+ etime = self.end_date.to_s[10..-1]
43
+ bdate = DateTime.parse(d.to_s + btime)
44
+ edate = DateTime.parse(d.to_s + btime) + (self.end_date - self.begin_date).seconds
27
45
  e = CalendarEvent.create(
28
46
  :calendar_id => self.calendar_id,
29
47
  :calendar_event_group_id => self.calendar_event_group_id,
30
48
  :name => self.name,
31
49
  :description => self.description,
32
50
  :location => self.location,
33
- :begin_date => d,
34
- :end_date => d + (self.end_date - self.begin_date).seconds,
51
+ :begin_date => bdate,
52
+ :end_date => edate,
35
53
  :all_day => self.all_day,
36
- :repeats => self.repeats
54
+ :repeats => self.repeats,
55
+ :published => self.published,
56
+ :url => self.url
37
57
  )
38
58
  return e
39
59
  end
@@ -40,8 +40,8 @@ module Caboose
40
40
  while d <= self.date_end
41
41
  if !CalendarEvent.where("calendar_event_group_id = ? and cast(begin_date as date) = ?", self.id, d).exists?
42
42
  e.duplicate(d)
43
- dates << d.to_date
44
43
  end
44
+ dates << d.to_date
45
45
  d = d + 1.day
46
46
  end
47
47
 
@@ -59,8 +59,8 @@ module Caboose
59
59
  Caboose.log("Found a day")
60
60
  if !CalendarEvent.where("calendar_event_group_id = ? and cast(begin_date as date) = ?", self.id, d).exists?
61
61
  e.duplicate(d)
62
- dates << d.to_date
63
62
  end
63
+ dates << d.to_date
64
64
  end
65
65
  end
66
66
  d = d + (self.frequency-1).weeks
@@ -68,12 +68,12 @@ module Caboose
68
68
 
69
69
  elsif self.period == 'Month'
70
70
  d = self.date_start
71
- if self.repeat_by == self::REPEAT_BY_DAY_OF_MONTH
71
+ if self.repeat_by == 'Day of month'
72
72
  while d <= self.date_end
73
73
  if !CalendarEvent.where("calendar_event_group_id = ? and cast(begin_date as date) = ?", self.id, d).exists?
74
74
  e.duplicate(d)
75
- dates << d.to_date
76
75
  end
76
+ dates << d.to_date
77
77
  d = d + self.frequency.months
78
78
  end
79
79
  elsif self.repeat_by == self::REPEAT_BY_DAY_OF_WEEK
@@ -106,8 +106,8 @@ module Caboose
106
106
  while d <= self.date_end
107
107
  if !CalendarEvent.where("calendar_event_group_id = ? and cast(begin_date as date) = ?", self.id, d).exists?
108
108
  e.duplicate(d)
109
- dates << d.to_date
110
109
  end
110
+ dates << d.to_date
111
111
  d = d + 1.year
112
112
  end
113
113
 
@@ -233,7 +233,11 @@ class Caboose::Schema < Caboose::Utilities::Schema
233
233
  [ :begin_date , :datetime ],
234
234
  [ :end_date , :datetime ],
235
235
  [ :all_day , :boolean , { :default => false }],
236
- [ :repeats , :boolean , { :default => false }]
236
+ [ :repeats , :boolean , { :default => false }],
237
+ [ :published , :boolean , { :default => false }],
238
+ [ :url , :string ],
239
+ [ :url_label , :string ],
240
+ [ :image , :attachment ]
237
241
  ],
238
242
  Caboose::CalendarEventGroup => [
239
243
  [ :frequency , :integer , { :default => 1 }],
@@ -1,54 +1,22 @@
1
-
2
1
  <h1>Edit Calendar</h1>
3
2
  <p><div id='calendar_<%= @calendar.id %>_name' ></div></p>
4
3
  <p><div id='calendar_<%= @calendar.id %>_color' ></div></p>
5
- <p><div id='calendar_<%= @calendar.id %>_description' ></div></p>
4
+ <!-- <p><div id='calendar_<%= @calendar.id %>_description' ></div></p> -->
6
5
 
7
- <div id='calendar'>
8
- <h2><%= @d.strftime('%B %Y') %></h2>
6
+ <form action='/admin/calendars' method='post' id='new_calendar_form' style="display:none;">
7
+ <input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>'>
8
+ <p><input type='text' name='name' id='name' placeholder='Name' style='width: 500px;'></p>
9
+ <div id='new_message'></div>
9
10
  <p>
10
- <input type='button' value='< Previous Month' onclick="window.location='/admin/calendars/<%= @calendar.id %>?d=<%= (@d - 1.month).strftime('%Y-%m-%d') %>';" />
11
- <input type='button' value='Current Month' onclick="window.location='/admin/calendars/<%= @calendar.id %>?d=<%= DateTime.now.strftime('%Y-%m-%d') %>';" />
12
- <input type='button' value='Next Month >' onclick="window.location='/admin/calendars/<%= @calendar.id %>?d=<%= (@d + 1.month).strftime('%Y-%m-%d') %>';" />
13
- </p>
14
- <p>To add an event to the calendar, click the date below:</p>
15
- <table>
16
- <tr>
17
- <th>Sun</th>
18
- <th>Mon</th>
19
- <th>Tue</th>
20
- <th>Wed</th>
21
- <th>Thu</th>
22
- <th>Fri</th>
23
- <th>Sat</th>
24
- </tr>
25
- <%
26
- days_in_previous_month = (@d - (@d - 1.month)).to_f.ceil.to_i
27
- days_in_month = ((@d + 1.month) - @d).to_f.ceil.to_i
28
- start_day = @d.strftime('%w').to_i
29
- %>
30
- <tr>
31
- <% (0...start_day).each do |i| %><td class='blank'><span class='day'><%= days_in_previous_month - (start_day - i) %></span></td><% end %>
32
- <% day = 1 %>
33
- <% while day <= days_in_month %>
34
- <% d = @d + (day-1).days %>
35
- <% if (day + start_day-1) % 7 == 0 %></tr><% if day < days_in_month %><tr><% end %><% end %>
36
- <td id='day_<%= d.strftime('%Y-%m-%d') %>'>
37
- <span class='day'><%= day %></span>
38
- <% events = Caboose::CalendarEvent.events_for_day(@calendar.id, d) %>
39
- <% if events.count > 0 %>
40
- <ul>
41
- <% events.each do |ev| %><li><a href='/admin/calendars/<%= @calendar.id %>/events/<%= ev.id %>' class='event_link'><%= ev.name %></a></li><% end %>
42
- </ul>
43
- <% end %>
44
- </td>
45
- <% day = day + 1 %>
46
- <% end %>
47
- <% last_day = (start_day + days_in_month) % 7 %>
48
- <% remaining_days = 7 - last_day %>
49
- <% if last_day > 0 %><% (0...remaining_days).each do |i| %><td class='blank'><span class='day'><%= (i + 1) %></span></td><% end %><% end %>
50
- <% if (start_day + days_in_month) != 0 %></tr><% end %>
51
- </table><br />
11
+ <input type='button' value='Cancel' onclick="$('#new_calendar_form').slideToggle();">
12
+ <input type='submit' value='Add New Calendar' onclick="add_calendar(); return false;">
13
+ </p>
14
+ </form>
15
+
16
+ <p>To add an event to the calendar, click the date below:</p>
17
+
18
+ <div class="calendar-wrapper">
19
+ <div id="calendar"></div>
52
20
  </div>
53
21
 
54
22
  <div id='message'></div>
@@ -57,85 +25,113 @@
57
25
  <input type='button' value='Delete Calendar' onclick="delete_calendar(<%= @calendar.id %>);" />
58
26
  </div>
59
27
 
28
+ <% content_for :caboose_css do %>
29
+ <%= stylesheet_link_tag "//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.6.2/fullcalendar.min.css" %>
30
+ <%= stylesheet_link_tag 'caboose/spectrum' %>
31
+ <style>
32
+ .calendar-wrapper {
33
+ max-width: 1200px;
34
+ margin: 0 auto;
35
+ padding: 20px 2%;
36
+ }
37
+ .fc-day-grid-event {
38
+ padding: 2px 2px 1px 2px;
39
+ }
40
+ .calendar_<%= @calendar.id %>_color_bound_color {
41
+ width: 100px !important;
42
+ }
43
+ .fc-day {
44
+ cursor: pointer;
45
+ }
46
+ .fc-day:hover {
47
+ background-color: #e7f3ff;
48
+ }
49
+ #content {
50
+ padding-right: 30px;
51
+ }
52
+ </style>
53
+ <% end %>
60
54
  <% content_for :caboose_js do %>
61
- <%= javascript_include_tag "caboose/model/all" %>
62
- <%= javascript_include_tag "caboose/spectrum" %>
63
- <script type="text/javascript">
64
-
65
- $(document).ready(function() {
66
- new ModelBinder({
67
- name: 'Calendar',
68
- id: <%= @calendar.id %>,
69
- update_url: '/admin/calendars/<%= @calendar.id %>',
70
- authenticity_token: '<%= form_authenticity_token %>',
71
- attributes: [
72
- { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@calendar.name ) %>, width: 400 },
73
- { name: 'description' , nice_name: 'Description' , type: 'textarea', value: <%= raw Caboose.json(@calendar.description ) %>, width: 400, height: 100 },
74
- { name: 'color' , nice_name: 'Color' , type: 'color', value: <%= raw Caboose.json(@calendar.color ) %>, width: 400, height: 100 }
75
- ]
76
- });
77
- $('#calendar td')
78
- .mouseover(function(e) { $(this).addClass('over'); })
79
- .mouseout(function(e) { $(this).removeClass('over'); })
80
- .click(function(e) {
81
- e.preventDefault();
82
- e.stopPropagation();
83
- if (!$(this).hasClass('blank'))
84
- {
85
- var d = $(this).attr('id').replace('day_', '');
86
- caboose_modal_url('/admin/calendars/<%= @calendar.id %>/events/new?begin_date=' + d);
87
- }
55
+ <%= javascript_include_tag "//cdn.jsdelivr.net/npm/moment@2.19.1/moment.js" %>
56
+ <%= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.6.2/fullcalendar.min.js" %>
57
+ <%= javascript_include_tag "caboose/model/all" %>
58
+ <%= javascript_include_tag "caboose/spectrum" %>
59
+ <script>
60
+ var toshow = 'month';
61
+ $(document).ready(function() {
62
+ $("#calendar").fullCalendar({
63
+ defaultView: toshow,
64
+ height: '700',
65
+ header: {
66
+ left: 'title',
67
+ center: '',
68
+ right: 'prev,next today'
69
+ },
70
+ eventSources: [
71
+ {
72
+ url: "/calendar/feed/<%= @calendar.id %>?admin=true&published=true",
73
+ color: "<%= @calendar.color %>",
74
+ textColor: "white"
75
+ },
76
+ {
77
+ url: "/calendar/feed/<%= @calendar.id %>?admin=true&published=false",
78
+ color: "#a9a9a9",
79
+ textColor: "white"
80
+ }
81
+ ],
82
+ eventClick: function(calEvent, jsEvent, view) {
83
+ window.location = '/admin/calendars/<%= @calendar.id %>/events/' + calEvent.id;
84
+ },
85
+ dayClick: function(date, jsEvent, view) {
86
+ $.ajax({
87
+ url: '/admin/calendars/<%= @calendar.id %>/events',
88
+ type: 'post',
89
+ data: {
90
+ begin_date: date.format()
91
+ },
92
+ success: function(resp) {
93
+ if (resp.redirect) window.location = resp.redirect;
94
+ }
95
+ });
96
+ }
97
+ });
88
98
  });
89
- $('#calendar td a.event_link')
90
- .click(function(e) {
91
- e.preventDefault();
92
- e.stopPropagation();
93
- caboose_modal_url($(this).attr('href'));
99
+
100
+ $(document).ready(function() {
101
+ new ModelBinder({
102
+ name: 'Calendar',
103
+ id: <%= @calendar.id %>,
104
+ update_url: '/admin/calendars/<%= @calendar.id %>',
105
+ authenticity_token: '<%= form_authenticity_token %>',
106
+ attributes: [
107
+ { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@calendar.name ) %>, width: 400 },
108
+ // { name: 'description' , nice_name: 'Description' , type: 'textarea', value: <%= raw Caboose.json(@calendar.description ) %>, width: 400, height: 100 },
109
+ { name: 'color' , nice_name: 'Color' , type: 'color', value: <%= raw Caboose.json(@calendar.color ) %>, width: 400, height: 100 }
110
+ ]
111
+ });
94
112
  });
95
- });
96
113
 
97
- function delete_calendar(calendar_id, confirm)
98
- {
99
- if (!confirm)
100
- {
101
- var p = $('<p/>').addClass('note confirm')
102
- .append('Are you sure you want to delete the calendar? ')
103
- .append($('<input/>').attr('type','button').val('Yes').click(function() { delete_calendar(calendar_id, true); })).append(' ')
104
- .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); }));
105
- $('#message').empty().append(p);
106
- return;
107
- }
108
- $('#message').html("<p class='loading'>Deleting calendar...</p>");
109
- $.ajax({
110
- url: '/admin/calendars/' + calendar_id,
111
- type: 'delete',
112
- success: function(resp) {
113
- if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
114
- if (resp.redirect) window.location = resp.redirect;
114
+ function delete_calendar(calendar_id, confirm)
115
+ {
116
+ if (!confirm)
117
+ {
118
+ var p = $('<p/>').addClass('note confirm')
119
+ .append('Are you sure you want to delete the calendar? ')
120
+ .append($('<input/>').attr('type','button').val('Yes').click(function() { delete_calendar(calendar_id, true); })).append(' ')
121
+ .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); }));
122
+ $('#message').empty().append(p);
123
+ return;
124
+ }
125
+ $('#message').html("<p class='loading'>Deleting calendar...</p>");
126
+ $.ajax({
127
+ url: '/admin/calendars/' + calendar_id,
128
+ type: 'delete',
129
+ success: function(resp) {
130
+ if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
131
+ if (resp.redirect) window.location = resp.redirect;
132
+ }
133
+ });
115
134
  }
116
- });
117
- }
118
135
 
119
- </script>
120
- <% end %>
121
-
122
- <% content_for :caboose_css do %>
123
- <%= stylesheet_link_tag 'caboose/spectrum' %>
124
- <style type='text/css'>
125
-
126
- #calendar table { border-collapse: collapse; width: 95%; }
127
- #calendar th { border: #666 1px solid; background: #666; color: #fff; margin: 0; padding: 4px 8px; }
128
- #calendar td { border: #666 1px solid; position: relative; margin: 0; padding: 0; width: 14%; height: 100px; cursor: pointer;vertical-align: top; }
129
- #calendar td.blank { background: #efefef; border: #666 1px solid; }
130
- #calendar td.over { background: #ffcc99; }
131
- #calendar td span.day { display: block; float: left; border-right: #666 1px solid; border-bottom: #666 1px solid; width: 20px; text-align: center; }
132
- #calendar td ul { margin: 0; padding: 0; list-style: none; }
133
- #calendar td ul li { margin: 0; padding: 0; list-style: none; }
134
- #calendar td ul li a { display: block; }
135
- #calendar td ul li a:hover { background: #fff; }
136
- .calendar_<%= @calendar.id %>_color_bound_color {
137
- width: 100px !important;
138
- }
139
-
140
- </style>
141
- <% end %>
136
+ </script>
137
+ <% end %>
@@ -0,0 +1,141 @@
1
+
2
+ <h1>Edit Calendar</h1>
3
+ <p><div id='calendar_<%= @calendar.id %>_name' ></div></p>
4
+ <p><div id='calendar_<%= @calendar.id %>_color' ></div></p>
5
+ <p><div id='calendar_<%= @calendar.id %>_description' ></div></p>
6
+
7
+ <div id='calendar'>
8
+ <h2><%= @d.strftime('%B %Y') %></h2>
9
+ <p>
10
+ <input type='button' value='< Previous Month' onclick="window.location='/admin/calendars/<%= @calendar.id %>?d=<%= (@d - 1.month).strftime('%Y-%m-%d') %>';" />
11
+ <input type='button' value='Current Month' onclick="window.location='/admin/calendars/<%= @calendar.id %>?d=<%= DateTime.now.strftime('%Y-%m-%d') %>';" />
12
+ <input type='button' value='Next Month >' onclick="window.location='/admin/calendars/<%= @calendar.id %>?d=<%= (@d + 1.month).strftime('%Y-%m-%d') %>';" />
13
+ </p>
14
+ <p>To add an event to the calendar, click the date below:</p>
15
+ <table>
16
+ <tr>
17
+ <th>Sun</th>
18
+ <th>Mon</th>
19
+ <th>Tue</th>
20
+ <th>Wed</th>
21
+ <th>Thu</th>
22
+ <th>Fri</th>
23
+ <th>Sat</th>
24
+ </tr>
25
+ <%
26
+ days_in_previous_month = (@d - (@d - 1.month)).to_f.ceil.to_i
27
+ days_in_month = ((@d + 1.month) - @d).to_f.ceil.to_i
28
+ start_day = @d.strftime('%w').to_i
29
+ %>
30
+ <tr>
31
+ <% (0...start_day).each do |i| %><td class='blank'><span class='day'><%= days_in_previous_month - (start_day - i) %></span></td><% end %>
32
+ <% day = 1 %>
33
+ <% while day <= days_in_month %>
34
+ <% d = @d + (day-1).days %>
35
+ <% if (day + start_day-1) % 7 == 0 %></tr><% if day < days_in_month %><tr><% end %><% end %>
36
+ <td id='day_<%= d.strftime('%Y-%m-%d') %>'>
37
+ <span class='day'><%= day %></span>
38
+ <% events = Caboose::CalendarEvent.events_for_day(@calendar.id, d) %>
39
+ <% if events.count > 0 %>
40
+ <ul>
41
+ <% events.each do |ev| %><li><a href='/admin/calendars/<%= @calendar.id %>/events/<%= ev.id %>' class='event_link'><%= ev.name %></a></li><% end %>
42
+ </ul>
43
+ <% end %>
44
+ </td>
45
+ <% day = day + 1 %>
46
+ <% end %>
47
+ <% last_day = (start_day + days_in_month) % 7 %>
48
+ <% remaining_days = 7 - last_day %>
49
+ <% if last_day > 0 %><% (0...remaining_days).each do |i| %><td class='blank'><span class='day'><%= (i + 1) %></span></td><% end %><% end %>
50
+ <% if (start_day + days_in_month) != 0 %></tr><% end %>
51
+ </table><br />
52
+ </div>
53
+
54
+ <div id='message'></div>
55
+ <div id='controls'>
56
+ <input type='button' value='Back' onclick="window.location='/admin/calendars';" />
57
+ <input type='button' value='Delete Calendar' onclick="delete_calendar(<%= @calendar.id %>);" />
58
+ </div>
59
+
60
+ <% content_for :caboose_js do %>
61
+ <%= javascript_include_tag "caboose/model/all" %>
62
+ <%= javascript_include_tag "caboose/spectrum" %>
63
+ <script type="text/javascript">
64
+
65
+ $(document).ready(function() {
66
+ new ModelBinder({
67
+ name: 'Calendar',
68
+ id: <%= @calendar.id %>,
69
+ update_url: '/admin/calendars/<%= @calendar.id %>',
70
+ authenticity_token: '<%= form_authenticity_token %>',
71
+ attributes: [
72
+ { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(@calendar.name ) %>, width: 400 },
73
+ { name: 'description' , nice_name: 'Description' , type: 'textarea', value: <%= raw Caboose.json(@calendar.description ) %>, width: 400, height: 100 },
74
+ { name: 'color' , nice_name: 'Color' , type: 'color', value: <%= raw Caboose.json(@calendar.color ) %>, width: 400, height: 100 }
75
+ ]
76
+ });
77
+ $('#calendar td')
78
+ .mouseover(function(e) { $(this).addClass('over'); })
79
+ .mouseout(function(e) { $(this).removeClass('over'); })
80
+ .click(function(e) {
81
+ e.preventDefault();
82
+ e.stopPropagation();
83
+ if (!$(this).hasClass('blank'))
84
+ {
85
+ var d = $(this).attr('id').replace('day_', '');
86
+ caboose_modal_url('/admin/calendars/<%= @calendar.id %>/events/new?begin_date=' + d);
87
+ }
88
+ });
89
+ $('#calendar td a.event_link')
90
+ .click(function(e) {
91
+ e.preventDefault();
92
+ e.stopPropagation();
93
+ caboose_modal_url($(this).attr('href'));
94
+ });
95
+ });
96
+
97
+ function delete_calendar(calendar_id, confirm)
98
+ {
99
+ if (!confirm)
100
+ {
101
+ var p = $('<p/>').addClass('note confirm')
102
+ .append('Are you sure you want to delete the calendar? ')
103
+ .append($('<input/>').attr('type','button').val('Yes').click(function() { delete_calendar(calendar_id, true); })).append(' ')
104
+ .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); }));
105
+ $('#message').empty().append(p);
106
+ return;
107
+ }
108
+ $('#message').html("<p class='loading'>Deleting calendar...</p>");
109
+ $.ajax({
110
+ url: '/admin/calendars/' + calendar_id,
111
+ type: 'delete',
112
+ success: function(resp) {
113
+ if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
114
+ if (resp.redirect) window.location = resp.redirect;
115
+ }
116
+ });
117
+ }
118
+
119
+ </script>
120
+ <% end %>
121
+
122
+ <% content_for :caboose_css do %>
123
+ <%= stylesheet_link_tag 'caboose/spectrum' %>
124
+ <style type='text/css'>
125
+
126
+ #calendar table { border-collapse: collapse; width: 95%; }
127
+ #calendar th { border: #666 1px solid; background: #666; color: #fff; margin: 0; padding: 4px 8px; }
128
+ #calendar td { border: #666 1px solid; position: relative; margin: 0; padding: 0; width: 14%; height: 100px; cursor: pointer;vertical-align: top; }
129
+ #calendar td.blank { background: #efefef; border: #666 1px solid; }
130
+ #calendar td.over { background: #ffcc99; }
131
+ #calendar td span.day { display: block; float: left; border-right: #666 1px solid; border-bottom: #666 1px solid; width: 20px; text-align: center; }
132
+ #calendar td ul { margin: 0; padding: 0; list-style: none; }
133
+ #calendar td ul li { margin: 0; padding: 0; list-style: none; }
134
+ #calendar td ul li a { display: block; }
135
+ #calendar td ul li a:hover { background: #fff; }
136
+ .calendar_<%= @calendar.id %>_color_bound_color {
137
+ width: 100px !important;
138
+ }
139
+
140
+ </style>
141
+ <% end %>
@@ -5,9 +5,9 @@
5
5
  <input type='submit' value='Search' />
6
6
  </form>
7
7
 
8
- <p><a href='/admin/calendars/new' id='new_calendar' class="caboose-btn-white">New Calendar</a></p>
8
+ <p style="margin:0;"><a href='/admin/calendars/new' id='new_calendar' class="caboose-btn-white">New Calendar</a></p>
9
9
 
10
- <form action='/admin/calendars' method='post' id='new_calendar_form'>
10
+ <form action='/admin/calendars' method='post' id='new_calendar_form' style="display:none;">
11
11
  <input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>'>
12
12
  <p><input type='text' name='name' id='name' placeholder='Name' style='width: 500px;'></p>
13
13
  <div id='new_message'></div>
@@ -17,17 +17,20 @@
17
17
  </p>
18
18
  </form>
19
19
 
20
+ <br />
21
+ <br />
22
+
20
23
  <% if @calendars.count > 0 %>
21
24
  <table class='data'>
22
25
  <tr>
23
26
  <th>Name</th>
24
- <th>Description</th>
27
+ <!-- <th>Description</th> -->
25
28
  <th>Color</th>
26
29
  </tr>
27
30
  <% @calendars.each do |calendar| %>
28
31
  <tr onclick="window.location='/admin/calendars/<%= calendar.id %>';">
29
32
  <td><%= calendar.name %></td>
30
- <td><%= calendar.description %></td>
33
+ <!-- <td><%= calendar.description %></td> -->
31
34
  <td><div class="swatch" style="background-color:<%= calendar.color %>"></div></td>
32
35
  </tr>
33
36
  <% end %>
@@ -6,6 +6,14 @@ g = @event.calendar_event_group
6
6
  <h1>Edit Event</h1>
7
7
  <p><div id='calendarevent_<%= e.id %>_name' ></div></p>
8
8
  <p><div id='calendarevent_<%= e.id %>_location' ></div></p>
9
+ <p><div id='calendarevent_<%= e.id %>_url' ></div>
10
+ <span style="display:block;font-size:13px;margin:3px 0 0 3px;">Use for registration link, more info, or external website.</span>
11
+ </p>
12
+ <p><div id='calendarevent_<%= e.id %>_url_label' ></div></p>
13
+ <p><div id='calendarevent_<%= e.id %>_published' ></div>
14
+ <span style="display:block;font-size:13px;margin:3px 0 0 3px;">Only published events will display on the website.</span>
15
+ </p>
16
+ <p><div id='calendarevent_<%= e.id %>_image' ></div></p>
9
17
  <p><div id='calendarevent_<%= @event.id %>_description' ></div></p>
10
18
  <div id='datetime_container' class='<%= @event.all_day ? 'all_day' : 'non_all_day' %>'>
11
19
  <div id='calendarevent_<%= e.id %>_begin_date' ></div>
@@ -48,19 +56,20 @@ g = @event.calendar_event_group
48
56
 
49
57
  <div id='message'></div>
50
58
  <p>
51
- <input type='button' value='Close' onclick="modal.close();" />
59
+ <input type='button' value='Back' onclick="window.location = '/admin/calendars/<%= @event.calendar_id %>';" />
52
60
  <input type='button' value='Delete Event' onclick="delete_event(<%= @event.id %>);" />
53
61
  <input type='button' value='Delete Event Group' onclick="delete_event_group(<%= @event.id %>);" />
54
62
  </p>
55
63
 
56
64
  <% content_for :caboose_js do %>
57
65
  <%= javascript_include_tag "caboose/model/all" %>
66
+ <%= raw caboose_tinymce %>
58
67
  <script type="text/javascript">
59
68
 
60
- var modal = false;
61
- $(window).ready(function() {
62
- modal = new CabooseModal(460);
63
- });
69
+ // var modal = false;
70
+ // $(window).ready(function() {
71
+ // modal = new CabooseModal(460);
72
+ // });
64
73
 
65
74
  $(document).ready(function() {
66
75
  new ModelBinder({
@@ -69,17 +78,21 @@ $(document).ready(function() {
69
78
  update_url: '/admin/calendars/<%= c.id %>/events/<%= e.id %>',
70
79
  authenticity_token: '<%= form_authenticity_token %>',
71
80
  attributes: [
72
- { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(e.name ) %>, width: 430 },
73
- { name: 'description' , nice_name: 'Description' , type: 'textarea' , value: <%= raw Caboose.json(e.description ) %>, width: 430, height: 100 },
74
- { name: 'location' , nice_name: 'Location' , type: 'text' , value: <%= raw Caboose.json(e.location ) %>, width: 430 },
75
- { name: 'begin_date' , nice_name: 'Begin date' , type: 'date' , value: <%= raw Caboose.json(e.begin_date.strftime('%m/%d/%Y') ) %>, width: 200 , align: 'right' },
76
- { name: 'begin_time' , nice_name: 'Begin time' , type: 'time' , value: <%= raw Caboose.json(e.begin_date.strftime('%I:%M %P') ) %>, width: 200 , fixed_placeholder: false },
77
- { name: 'end_date' , nice_name: 'End date' , type: 'date' , value: <%= raw Caboose.json(e.end_date.strftime('%m/%d/%Y') ) %>, width: 200 , align: 'right' },
78
- { name: 'end_time' , nice_name: 'End time' , type: 'time' , value: <%= raw Caboose.json(e.end_date.strftime('%I:%M %P') ) %>, width: 200 , fixed_placeholder: false },
81
+ { name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(e.name ) %>, width: 600 },
82
+ { name: 'description' , nice_name: 'Description' , type: 'richtext' , value: <%= raw Caboose.json(e.description ) %>, width: 600, height: 300 },
83
+ { name: 'location' , nice_name: 'Location' , type: 'text' , value: <%= raw Caboose.json(e.location ) %>, width: 600 },
84
+ { name: 'url' , nice_name: 'URL' , type: 'text' , value: <%= raw Caboose.json(e.url ) %>, width: 600 },
85
+ { name: 'url_label' , nice_name: 'URL Label' , type: 'text' , value: <%= raw Caboose.json(e.url_label ) %>, width: 600 },
86
+ { name: 'published' , nice_name: 'Published' , type: 'checkbox' , value: <%= raw Caboose.json(e.published ) %>, width: 600 },
87
+ { name: 'image' , nice_name: 'Image' , type: 'image' , value: <%= raw Caboose.json(e.image.url(:thumb)) %>, width: 400, update_url: '/admin/calendars/<%= c.id %>/events/<%= e.id %>/image' },
88
+ { name: 'begin_date' , nice_name: 'Begin date' , type: 'date' , value: <%= raw Caboose.json(e.begin_date.strftime('%m/%d/%Y') ) %>, width: 250 , align: 'right' },
89
+ { name: 'begin_time' , nice_name: 'Begin time' , type: 'time' , value: <%= raw Caboose.json(e.begin_date.strftime('%I:%M %P') ) %>, width: 250 , fixed_placeholder: false },
90
+ { name: 'end_date' , nice_name: 'End date' , type: 'date' , value: <%= raw Caboose.json(e.end_date.strftime('%m/%d/%Y') ) %>, width: 250 , align: 'right' },
91
+ { name: 'end_time' , nice_name: 'End time' , type: 'time' , value: <%= raw Caboose.json(e.end_date.strftime('%I:%M %P') ) %>, width: 250 , fixed_placeholder: false },
79
92
  { name: 'all_day' , nice_name: 'All day' , type: 'checkbox' , value: <%= raw e.all_day ? 1 : 0 %>, width: 100, after_update: after_all_day_update },
80
93
  { name: 'repeats' , nice_name: 'Repeats' , type: 'checkbox' , value: <%= raw e.repeats ? 1 : 0 %>, width: 100, after_update: after_repeats_update }
81
94
  ],
82
- on_load: function() { modal.autosize(); console.log('Testing'); }
95
+ on_load: function() { }
83
96
  });
84
97
  new ModelBinder({
85
98
  name: 'CalendarEventGroup',
@@ -100,7 +113,7 @@ $(document).ready(function() {
100
113
  { name: 'fri' , nice_name: 'fri' , type: 'checkbox' , value: <%= raw g.fri ? 1 : 0 %>, width: 21 , fixed_placeholder: false },
101
114
  { name: 'sat' , nice_name: 'sat' , type: 'checkbox' , value: <%= raw g.sat ? 1 : 0 %>, width: 21 , fixed_placeholder: false }
102
115
  ],
103
- on_load: function() { modal.autosize(); }
116
+ on_load: function() { }
104
117
  });
105
118
  });
106
119
 
@@ -112,16 +125,16 @@ function delete_event(event_id, confirm)
112
125
  .append('Are you sure you want to delete the event? ')
113
126
  .append($('<input/>').attr('type','button').val('Yes').click(function() { delete_event(event_id, true); })).append(' ')
114
127
  .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); }));
115
- modal.autosize(p);
128
+ $("#message").html(p);
116
129
  return;
117
130
  }
118
- modal.autosize("<p class='loading'>Deleting event...</p>");
131
+ $("#message").html("<p class='loading'>Deleting event...</p>");
119
132
  $.ajax({
120
133
  url: '/admin/calendars/<%= c.id %>/events/' + event_id,
121
134
  type: 'delete',
122
135
  success: function(resp) {
123
- if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
124
- if (resp.redirect) modal.close();
136
+ if (resp.error) $("#message").html("<p class='note error'>" + resp.error + "</p>");
137
+ if (resp.redirect) window.location = resp.redirect;
125
138
  }
126
139
  });
127
140
  }
@@ -134,16 +147,16 @@ function delete_event_group(event_id, confirm)
134
147
  .append('Are you sure you want to delete the event group? ')
135
148
  .append($('<input/>').attr('type','button').val('Yes').click(function() { delete_event_group(event_id, true); })).append(' ')
136
149
  .append($('<input/>').attr('type','button').val('No').click(function() { $('#message').empty(); }));
137
- modal.autosize(p);
150
+ $("#message").html(p);
138
151
  return;
139
152
  }
140
- modal.autosize("<p class='loading'>Deleting event group...</p>");
153
+ $("#message").html("<p class='loading'>Deleting event group...</p>");
141
154
  $.ajax({
142
155
  url: '/admin/event-groups/<%= g.id %>',
143
156
  type: 'delete',
144
157
  success: function(resp) {
145
- if (resp.error) modal.autosize("<p class='note error'>" + resp.error + "</p>");
146
- if (resp.redirect) modal.close();
158
+ if (resp.error) $("#message").html("<p class='note error'>" + resp.error + "</p>");
159
+ if (resp.redirect) window.location = resp.redirect;
147
160
  }
148
161
  });
149
162
  }
@@ -155,13 +168,13 @@ function after_all_day_update()
155
168
  el.removeClass('all_day').addClass('non_all_day');
156
169
  else
157
170
  el.removeClass('non_all_day').addClass('all_day');
158
- modal.autosize();
171
+ // modal.autosize();
159
172
  }
160
173
 
161
174
  function after_repeats_update()
162
175
  {
163
176
  var el = $('#repeat_container');
164
- el.slideToggle(function() { modal.autosize(); });
177
+ el.slideToggle(function() { });
165
178
  }
166
179
 
167
180
  function after_period_update()
@@ -175,10 +188,11 @@ function after_period_update()
175
188
  $('#repeat_by_container').show();
176
189
  else
177
190
  $('#repeat_by_container').hide();
178
- modal.autosize();
191
+ // modal.autosize();
179
192
  }
180
193
 
181
194
  </script>
195
+
182
196
  <% end %>
183
197
 
184
198
  <% content_for :caboose_css do %>
@@ -190,16 +204,21 @@ function after_period_update()
190
204
  #calendarevent_<%= e.id %>_all_day_container { float: left; width: 130px; }
191
205
  #calendarevent_<%= e.id %>_repeats_container { width: 200px; }
192
206
 
193
- div.all_day #calendarevent_<%= e.id %>_begin_date_container { float: left; width: 230px; }
207
+ div#datetime_container > div > input {
208
+ display: block;
209
+ width: 100% !important;
210
+ }
211
+
212
+ div.all_day #calendarevent_<%= e.id %>_begin_date_container { float: left; width: 250px; margin-right: 10px; }
194
213
  div.all_day #calendarevent_<%= e.id %>_begin_time_container { display: none; }
195
- div.all_day #calendarevent_<%= e.id %>_end_date_container { width: 230px; }
214
+ div.all_day #calendarevent_<%= e.id %>_end_date_container { width: 250px; }
196
215
  div.all_day #calendarevent_<%= e.id %>_end_time_container { display: none; }
197
216
  div.all_day .spacer { clear: left; }
198
217
 
199
- div.non_all_day #calendarevent_<%= e.id %>_begin_date_container { float: left; width: 230px; margin-bottom: 10px; }
200
- div.non_all_day #calendarevent_<%= e.id %>_begin_time_container { width: 230px; margin-bottom: 10px; }
201
- div.non_all_day #calendarevent_<%= e.id %>_end_date_container { float: left; width: 230px; clear: left; }
202
- div.non_all_day #calendarevent_<%= e.id %>_end_time_container { float: left; width: 230px; }
218
+ div.non_all_day #calendarevent_<%= e.id %>_begin_date_container { float: left; width: 250px; margin-bottom: 10px; margin-right: 10px; }
219
+ div.non_all_day #calendarevent_<%= e.id %>_begin_time_container { width: 250px; margin-bottom: 10px; }
220
+ div.non_all_day #calendarevent_<%= e.id %>_end_date_container { float: left; width: 250px; clear: left; margin-right: 10px; }
221
+ div.non_all_day #calendarevent_<%= e.id %>_end_time_container { float: left; width: 250px; }
203
222
  div.non_all_day .spacer { clear: left; }
204
223
 
205
224
  #repeat_every { float: left; width: 110px; }
@@ -208,8 +227,8 @@ div.non_all_day .spacer { clear: left; }
208
227
  #calendareventgroup_<%= g.id %>_repeat_by { float: left; width: 100px; }
209
228
 
210
229
  #repeat_dates_container { clear: left; }
211
- #calendareventgroup_<%= g.id %>_date_start_container { float: left; width: 230px; }
212
- #calendareventgroup_<%= g.id %>_date_end_container { width: 230px; }
230
+ #calendareventgroup_<%= g.id %>_date_start_container { float: left; width: 250px; }
231
+ #calendareventgroup_<%= g.id %>_date_end_container { width: 250px; }
213
232
 
214
233
  #week_container { clear: left; padding-top: 10px; }
215
234
 
@@ -30,7 +30,11 @@ function add_event()
30
30
  data: $('#new_event_form').serialize(),
31
31
  success: function(resp) {
32
32
  if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>");
33
- if (resp.redirect) window.location = resp.redirect;
33
+ if (resp.redirect) {
34
+ modal.close();
35
+ modal = false;
36
+ window.location = resp.redirect;
37
+ }
34
38
  }
35
39
  });
36
40
  }
@@ -0,0 +1,68 @@
1
+ <%
2
+ bt = Caboose::BlockType.where(:description => 'Caboose Calendar').first
3
+ b1 = Caboose::Block.where(:block_type_id => bt.id).where(:page_id => Caboose::Page.where(:site_id => @event.calendar.site_id).pluq(:id)).first if bt && @event.calendar
4
+ b2 = b1.child('calendars_to_show') if b1
5
+ bl = Caboose::Block.where(:id => b2.id).where("value ILIKE ? OR value = ?","%#{@event.calendar_id}%","all").first if b2
6
+ pg = bl.parent.page if bl && bl.parent
7
+ %>
8
+
9
+ <div class="post-details-wrapper event">
10
+ <div class="constrain">
11
+ <div class="main-post-content event">
12
+ <% if @event.image && !@event.image.url.blank? && !@event.image.url.include?('placehold') %>
13
+ <img src="<%= @event.image.url(:large) %>" alt="<%= @event.name %>" width="300" style="display:block;margin:0 0 20px 0;" />
14
+ <% end %>
15
+ <div class="post-text">
16
+ <h2 class="post-title"><%= @event.name %></h2>
17
+ <% if !@event.location.blank? %><h4 class="location"><%= @event.location %></h4><% end %>
18
+ <% if !@event.begin_date.blank? && !@event.end_date.blank? %>
19
+ <% bd = @event.begin_date.in_time_zone("Central Time (US & Canada)") %>
20
+ <% ed = @event.end_date.in_time_zone("Central Time (US & Canada)") %>
21
+ <% if @event.all_day %>
22
+ <% if bd.strftime("%B") == ed.strftime("%B") && bd.strftime("%Y") == ed.strftime("%Y") && bd.strftime("%d") == ed.strftime("%d") %>
23
+ <p class="begin-date"><%= bd.strftime("%B %-d, %Y") %></p>
24
+ <% else %>
25
+ <p class="begin-date">Begins: <%= bd.strftime("%B %-d, %Y") %></p>
26
+ <p class="end-date">Ends: <%= ed.strftime("%B %-d, %Y") %></p>
27
+ <% end %>
28
+ <% else %>
29
+ <p class="begin-date">Begins: <%= bd.strftime("%B %-d, %Y at %l:%M%P") %></p>
30
+ <p class="end-date">Ends: <%= ed.strftime("%B %-d, %Y at %l:%M%P") %></p>
31
+ <% end %>
32
+ <% end %>
33
+ <div class='share-icons clearfix' style="margin-top:20px;">
34
+ <div class="share-buttons">
35
+ <% url = "http://" + @site.primary_domain.domain + '/calendar-events/' + @event.id.to_s %>
36
+ <a href="https://www.facebook.com/sharer/sharer.php?u=<%= url %>" target="_blank" title="Share on Facebook" class="holder" id="facebook" onclick="window.open(this.href, 'mywin',
37
+ 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><span class="icon-facebook white"></span></a>
38
+ <a href="https://twitter.com/home?status=<%= @event.name + ' @ ' + url %>" title="Share on Twitter" target="_blank" class="holder" id="twitter" onclick="window.open(this.href, 'mywin',
39
+ 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><span class="icon-twitter white"></span></a>
40
+ <a href="https://plus.google.com/share?url=<%= url %>" title="Share on Google +" target="_blank" class="holder" id="google-plus" onclick="window.open(this.href, 'mywin',
41
+ 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;"><span class="icon-google-plus white"></span></a>
42
+ <a href="mailto:?subject=<%= @event.name %>&amp;body=<%= url %>" title="Share by Email" class="holder" id="email"><span class="icon-mail white"></span></a>
43
+ </div>
44
+ </div>
45
+ <div class="post-body richtext" style="margin-bottom:30px;">
46
+ <div class="content_body">
47
+ <%== @event.description %>
48
+ </div>
49
+ </div>
50
+ <% if !@event.url.blank? %>
51
+ <a <% if @event.url.include?('http') %>target="_blank"<% end %> href="<%= @event.url %>" style="margin-right:15px;" class="btn"><%= @event.url_label.blank? ? "More Info" : @event.url_label %></a>
52
+ <% end %>
53
+ <% if pg %>
54
+ <a href="/<%= pg.uri %>" class="btn">Back to Calendar</a>
55
+ <% end %>
56
+ </div>
57
+ </div>
58
+ </div>
59
+ </div>
60
+
61
+ <% content_for :caboose_css do %>
62
+ <style>
63
+ .begin-date, .end-date {
64
+ font-weight: bold;
65
+ margin-bottom: 5px;
66
+ }
67
+ </style>
68
+ <% end %>
@@ -6,8 +6,8 @@ p.uri {
6
6
  border: #999 1px solid;
7
7
  padding: 9px 10px;
8
8
  position: absolute;
9
- top: 9px;
10
- left: 251px;
9
+ top: -44px;
10
+ left: 0;
11
11
  height: 36px;
12
12
  margin: 0;
13
13
  font-size: 14px;
@@ -36,6 +36,7 @@ pic = "http://gravatar.com/avatar/#{gravatar_id}.png?s=150" #&d=/assets/caboose/
36
36
  }
37
37
  #content2 {
38
38
  max-width: 800px;
39
+ float: left;
39
40
  }
40
41
  </style>
41
42
  <% end %>
@@ -1,3 +1,3 @@
1
1
  module Caboose
2
- VERSION = '0.9.124'
2
+ VERSION = '0.9.125'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: caboose-cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.124
4
+ version: 0.9.125
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Barry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2018-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -956,6 +956,7 @@ files:
956
956
  - app/views/caboose/blocks/admin_render_second_level.json.erb
957
957
  - app/views/caboose/blocks/tinymce.js.erb
958
958
  - app/views/caboose/calendars/admin_edit.html.erb
959
+ - app/views/caboose/calendars/admin_edit_old.html.erb
959
960
  - app/views/caboose/calendars/admin_index.html.erb
960
961
  - app/views/caboose/cart/index.html.erb
961
962
  - app/views/caboose/categories/admin_edit.html.erb
@@ -997,6 +998,7 @@ files:
997
998
  - app/views/caboose/events/admin_edit.html.erb
998
999
  - app/views/caboose/events/admin_index.html.erb
999
1000
  - app/views/caboose/events/admin_new.html.erb
1001
+ - app/views/caboose/events/show.html.erb
1000
1002
  - app/views/caboose/extras/error.html.erb
1001
1003
  - app/views/caboose/extras/error404.html.erb
1002
1004
  - app/views/caboose/extras/error_invalid_site.html.erb