tb_events 1.2.0.beta1 → 1.3.0

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
- SHA1:
3
- metadata.gz: ce1daf8729504d0663c17b5eea3fe706f86965da
4
- data.tar.gz: fa913c71926dacde2922cb5d538d64599968c512
2
+ SHA256:
3
+ metadata.gz: d8495699ef036385ff906c76c7d34b616b024c3c167f4e543d929d8cc15c95bf
4
+ data.tar.gz: c384b0864d671436b70da6aedd9877657f95d588227958fcb73569771ac3fa21
5
5
  SHA512:
6
- metadata.gz: c2f3c7f6768a50f6a29150c72cdbc13644c31c9d91dd8a4a18fecc4cef78c3ef90f251c7210ec08ea858d8490315438b5c8d8d3a1e7ad2798c73c40c4d983a61
7
- data.tar.gz: 1a9e8432f194112a8051958f4d5a6710774f46de4ad04c42ffb729ab443a4ccc143a5a38d4792f39409813b736044cacb783da08864e1964c156c2866b2f4eb0
6
+ metadata.gz: 9473623e16c4e10a2184574bf4c5fc9b5e6bc5bf2c18f725dce12dc6696b97a85761b223446ad2b341be0095cc1f04fb99e005da86bddb1a7b1781fb2cb23a7b
7
+ data.tar.gz: 441459722f410fc0aff5508b49345c359953ad722a3dabdc75f34799b8afaa7cecc6064dacc6335284dda39c4f4d5312084e4c8c7e5718a25b64ff75f02e6888
data/Rakefile CHANGED
@@ -20,9 +20,9 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
20
  rdoc.rdoc_files.include('lib/**/*.rb')
21
21
  end
22
22
 
23
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
23
+ APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
24
24
  load 'rails/tasks/engine.rake'
25
25
 
26
26
  Bundler::GemHelper.install_tasks
27
27
 
28
- require 'rake'
28
+ require 'rake'
@@ -64,7 +64,7 @@
64
64
  margin: 15px 0 0;
65
65
  }
66
66
  #spud_events_admin_calendar th,
67
- #spud_events_calendar th {
67
+ #spud_events_calendar th {
68
68
  text-align: center;
69
69
  }
70
70
  #spud_events_admin_calendar td,
@@ -83,9 +83,18 @@
83
83
  font-size: 11px;
84
84
  line-height: 11px;
85
85
  }
86
+
87
+ .not-month .calendar-day {
88
+ display: none;
89
+ }
90
+ .not-month .calendar-events {
91
+ display: none;
92
+ }
93
+
86
94
  .calendar-events-list{
87
95
  list-style: none;
88
- margin: 20px 0 0;
96
+ margin: 10px 0 0;
97
+ padding: 0;
89
98
  }
90
99
  .calendar-events-list li{
91
100
  margin: 4px;
@@ -1,10 +1,9 @@
1
1
  class Admin::CalendarEventsController < Admin::ApplicationController
2
-
3
- add_breadcrumb "Events", :admin_list_spud_calendar_events_path
4
- belongs_to_spud_app :events
2
+ add_breadcrumb 'Events', :admin_list_spud_calendar_events_path
3
+ belongs_to_app :events
5
4
 
6
5
  respond_to :html, :xml, :json
7
- respond_to :js, :only => [:index, ]
6
+ respond_to :js, only: [:index]
8
7
 
9
8
  def index
10
9
  if params[:month]
@@ -28,7 +27,7 @@ class Admin::CalendarEventsController < Admin::ApplicationController
28
27
  @calendars = SpudCalendar.all
29
28
  @current_calendar = params[:spud_calendar] ? params[:spud_calendar] : 0
30
29
 
31
- respond_with(@calendars, :include => :events)
30
+ respond_with(@calendars, include: :events)
32
31
  end
33
32
 
34
33
  def new
@@ -45,25 +44,24 @@ class Admin::CalendarEventsController < Admin::ApplicationController
45
44
  def create
46
45
  @calendar_event = SpudCalendarEvent.new(calendar_event_params)
47
46
  flash[:notice] = 'Calendar event was successfully created.' if @calendar_event.save
48
- respond_with(@calendar_event, :location => admin_list_spud_calendar_events_path)
47
+ respond_with(@calendar_event, location: admin_list_spud_calendar_events_path)
49
48
  end
50
49
 
51
50
  def update
52
51
  @calendar_event = SpudCalendarEvent.find(params[:id])
53
52
  flash[:notice] = 'Calendar event was successfully updated.' if @calendar_event.update_attributes(calendar_event_params)
54
- respond_with(@calendar_event, :location =>admin_list_spud_calendar_events_path)
53
+ respond_with(@calendar_event, location: admin_list_spud_calendar_events_path)
55
54
  end
56
55
 
57
56
  def destroy
58
57
  @calendar_event = SpudCalendarEvent.find(params[:id])
59
- @calendar_event.destroy
60
- respond_with(@calendar_event, :location => admin_list_spud_calendar_events_path)
58
+ flash[:notice] = 'Calendar event deleted successfully' if @calendar_event.destroy
59
+ respond_with(@calendar_event, location: admin_list_spud_calendar_events_path)
61
60
  end
62
61
 
63
- private
62
+ private
64
63
 
65
64
  def calendar_event_params
66
65
  params.require(:spud_calendar_event).permit(:title, :description, :start_at, :end_at, :all_day, :spud_calendar_id, :spud_calendar, :location, :address, :address_2, :city, :state, :zip)
67
66
  end
68
-
69
67
  end
@@ -1,13 +1,12 @@
1
1
  class Admin::CalendarsController < Admin::ApplicationController
2
+ add_breadcrumb 'Events', :admin_list_spud_calendar_events_path
2
3
 
3
- add_breadcrumb "Events", :admin_list_spud_calendar_events_path
4
-
5
- belongs_to_spud_app :events
4
+ belongs_to_app :events
6
5
 
7
6
  respond_to :html, :xml, :json, :js
8
7
 
9
8
  def new
10
- @page_name = "New Calendar"
9
+ @page_name = 'New Calendar'
11
10
  @calendar = SpudCalendar.new
12
11
  respond_with(@calendar)
13
12
  end
@@ -17,12 +16,12 @@ class Admin::CalendarsController < Admin::ApplicationController
17
16
  if @calendar.save
18
17
  redirect_to admin_list_spud_calendar_events_path
19
18
  else
20
- render :action => "new"
19
+ render action: 'new'
21
20
  end
22
21
  end
23
22
 
24
23
  def edit
25
- @page_name = "Edit Calendar"
24
+ @page_name = 'Edit Calendar'
26
25
  @calendar = SpudCalendar.find(params[:id])
27
26
  respond_with(@calendar)
28
27
  end
@@ -33,7 +32,7 @@ class Admin::CalendarsController < Admin::ApplicationController
33
32
  flash[:notice] = 'Calendar was successfully updated.'
34
33
  redirect_to admin_list_spud_calendar_events_path
35
34
  else
36
- render :action => "edit"
35
+ render action: 'edit'
37
36
  end
38
37
  end
39
38
 
@@ -44,14 +43,13 @@ class Admin::CalendarsController < Admin::ApplicationController
44
43
  end
45
44
  @calendar.destroy
46
45
  respond_with(@calendar) do |format|
47
- format.js { render(:nothing => true) }
46
+ format.js { render(nothing: true) }
48
47
  end
49
48
  end
50
49
 
51
- private
50
+ private
52
51
 
53
52
  def calendar_params
54
53
  params.require(:spud_calendar).permit(:title)
55
54
  end
56
-
57
55
  end
@@ -1,16 +1,14 @@
1
1
  class CalendarEventsController < ApplicationController
2
-
3
2
  respond_to :html, :json
4
3
  layout SpudEvents.config.calendar_layout
5
-
4
+
6
5
  def index
7
- @events = SpudCalendarEvent.ordered.paginate(:per_page => 10, :page => params[:page])
6
+ @events = SpudCalendarEvent.ordered.paginate(per_page: 10, page: params[:page])
8
7
  respond_with @events
9
8
  end
10
9
 
11
- def show
12
- @event = SpudCalendarEvent.find(params[:id])
10
+ def show
11
+ @event = SpudCalendarEvent.find(params[:id])
13
12
  respond_with @event
14
- end
15
-
13
+ end
16
14
  end
@@ -1,8 +1,7 @@
1
1
  class CalendarsController < ApplicationController
2
-
3
2
  respond_to :html, :json
4
3
  layout SpudEvents.config.calendar_layout
5
- before_action :get_calendar_date
4
+ before_action :calendar_date
6
5
 
7
6
  def show
8
7
  if params[:calendar] && calendar = SpudCalendar.find_by_title(params[:calendar].titleize)
@@ -14,9 +13,9 @@ class CalendarsController < ApplicationController
14
13
  respond_with @events
15
14
  end
16
15
 
17
- private
16
+ private
18
17
 
19
- def get_calendar_date
18
+ def calendar_date
20
19
  if params[:month]
21
20
  year = params[:year] ? params[:year].to_i : Date.today.year
22
21
  begin
@@ -28,5 +27,4 @@ private
28
27
  @calendar_date = Date.today
29
28
  end
30
29
  end
31
-
32
30
  end
@@ -1,15 +1,13 @@
1
1
  module Admin::CalendarsHelper
2
-
3
- def link_to_previous_admin_calendar_month(date, url_for_options={})
4
- date = date.advance(:months => -1)
2
+ def link_to_previous_admin_calendar_month(date, _url_for_options = {})
3
+ date = date.advance(months: -1)
5
4
  calendar = params[:calendar] ? params[:calendar] : nil
6
- link_to('&laquo; Previous Month'.html_safe, admin_list_spud_calendar_events_path(:month => date.month, :year => date.year, :calendar => calendar), :class => 'spud_events_calendar_link previous_calendar btn btn-sm btn-default').html_safe
5
+ link_to('&laquo; Previous Month'.html_safe, admin_list_spud_calendar_events_path(month: date.month, year: date.year, calendar: calendar), class: 'spud_events_calendar_link previous_calendar btn btn-sm btn-default').html_safe
7
6
  end
8
7
 
9
- def link_to_next_admin_calendar_month(date, url_for_options={})
10
- date = date.advance(:months => 1)
8
+ def link_to_next_admin_calendar_month(date, _url_for_options = {})
9
+ date = date.advance(months: 1)
11
10
  calendar = params[:calendar] ? params[:calendar] : nil
12
- link_to('Next Month &raquo;'.html_safe, admin_list_spud_calendar_events_path(:month => date.month, :year => date.year, :calendar => calendar), :class => 'spud_events_calendar_link next_calendar btn btn-sm btn-default pull-right').html_safe
11
+ link_to('Next Month &raquo;'.html_safe, admin_list_spud_calendar_events_path(month: date.month, year: date.year, calendar: calendar), class: 'spud_events_calendar_link next_calendar btn btn-sm btn-default pull-right').html_safe
13
12
  end
14
-
15
13
  end
@@ -1,12 +1,11 @@
1
1
  module CalendarsHelper
2
-
3
2
  # Builds a calendar for the given date
4
3
  #
5
4
  # * date: Determines the month to be displayed. Given date will have the "today" css class
6
5
  # * opts:
7
6
  # - headers: Array of weekday headers (optional)
8
7
  #
9
- def spud_calendar_for_date(date, opts={}, &block)
8
+ def spud_calendar_for_date(date, opts = {}, &block)
10
9
  events = SpudCalendarEvent.in_month_of(date)
11
10
  spud_calendar_for_events(events, date, opts, &block)
12
11
  end
@@ -18,7 +17,7 @@ module CalendarsHelper
18
17
  # * opts:
19
18
  # - headers: Array of weekday headers (optional)
20
19
  #
21
- def spud_calendar_for_identifier(identifier, date, opts={}, &block)
20
+ def spud_calendar_for_identifier(identifier, date, opts = {}, &block)
22
21
  calendar = SpudCalendar.with_identifier(identifier)
23
22
  if calendar.present?
24
23
  events = calendar.spud_calendar_events.in_month_of(date)
@@ -36,21 +35,21 @@ module CalendarsHelper
36
35
  # * opts:
37
36
  # - headers: Array of weekday headers (optional)
38
37
  #
39
- def spud_calendar_for_events(events, date, opts={}, &block)
40
- events_grouped = events.group_by(&:start_date)
38
+ def spud_calendar_for_events(events, date, opts = {}, &block)
39
+ events_array = events.to_a
41
40
  cache(['spud-calendar', date.to_s, events]) do
42
41
  concat(
43
42
  SpudEvents::CalendarBuilder.new(self, date, opts).table do |day|
44
- events = events_grouped[day] || []
43
+ events = extract_events_for_date(events_array, day)
45
44
  if block
46
45
  block.call(day, events)
47
46
  else
48
- concat content_tag(:span, day.day.to_s, :class => 'calendar-day')
47
+ concat content_tag(:span, day.day.to_s, class: 'calendar-day')
49
48
  if events.length > 0
50
- list_items = events.collect{ |event|
49
+ list_items = events.collect do |event|
51
50
  '<li>' + link_to(event.title, calendar_event_path(event)) + '</li>'
52
- }.join('')
53
- concat content_tag(:ul, raw(list_items), :class => 'events-list')
51
+ end.join('')
52
+ concat content_tag(:ul, raw(list_items), class: 'events-list')
54
53
  end
55
54
  end
56
55
  end
@@ -59,15 +58,22 @@ module CalendarsHelper
59
58
  end
60
59
 
61
60
  def link_to_previous_calendar_month(date)
62
- date = date.advance(:months => -1)
61
+ date = date.advance(months: -1)
63
62
  calendar = params[:calendar] ? params[:calendar] : nil
64
- 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
63
+ 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
65
64
  end
66
65
 
67
66
  def link_to_next_calendar_month(date)
68
- date = date.advance(:months => 1)
67
+ date = date.advance(months: 1)
69
68
  calendar = params[:calendar] ? params[:calendar] : nil
70
- 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
69
+ 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
71
70
  end
72
71
 
72
+ private
73
+
74
+ def extract_events_for_date(events, date)
75
+ events.select do |event|
76
+ date >= event.start_date && date <= event.end_date
77
+ end
78
+ end
73
79
  end
@@ -1,34 +1,32 @@
1
1
  class SpudCalendar < ActiveRecord::Base
2
- has_many :spud_calendar_events, :dependent => :destroy
2
+ has_many :spud_calendar_events, dependent: :destroy
3
3
  validates_presence_of :title
4
- validates :identifier, :presence => true, :uniqueness => true
4
+ validates :identifier, presence: true, uniqueness: true
5
5
 
6
6
  before_validation :set_identifier
7
7
 
8
8
  def self.with_identifier(identifier)
9
- where(:identifier => identifier).first
9
+ where(identifier: identifier).first
10
10
  end
11
11
 
12
12
  def color
13
- modulo = (self.id-1) % COLORS.length
14
- return COLORS[modulo]
13
+ modulo = (id - 1) % COLORS.length
14
+ COLORS[modulo]
15
15
  end
16
16
 
17
- COLORS = [
18
- '4D854B',
19
- 'f89406',
20
- 'b94a48',
21
- '3a87ad',
22
- '999999',
23
- '333333'
24
- ]
17
+ COLORS = %w(
18
+ 4D854B
19
+ f89406
20
+ b94a48
21
+ 3a87ad
22
+ 999999
23
+ 333333)
25
24
 
26
- private
25
+ private
27
26
 
28
27
  def set_identifier
29
28
  if identifier.nil? && title.present?
30
29
  self.identifier = title.parameterize.underscore
31
30
  end
32
31
  end
33
-
34
32
  end
@@ -1,3 +1,2 @@
1
- class SpudCalendarEvent < Spud::SpudCalendarEventModel
2
-
1
+ class SpudCalendarEvent < SpudEvents::CalendarEventModel
3
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
@@ -4,8 +4,8 @@
4
4
  <%= f.tb_select :spud_calendar_id, options_from_collection_for_select(SpudCalendar.all, :id, :title, @calendar_event.spud_calendar_id) %>
5
5
 
6
6
  <%= f.tb_text_field :title %>
7
- <%= f.tb_text_area :description %>
8
-
7
+ <%= f.tb_text_area :description, :style => "width:100%;", :class => 'tinymce full-width' %>
8
+
9
9
  <%= f.tb_datetime_select :start_at, :ampm => true, :minute_step => 5 %>
10
10
  <%= f.tb_datetime_select :end_at, :ampm => true, :minute_step => 5 %>
11
11
 
@@ -16,6 +16,6 @@
16
16
  <%= f.tb_text_field :state %>
17
17
  <%= f.tb_text_field :zip %>
18
18
 
19
- <%= f.tb_save_buttons 'Event', admin_list_spud_calendar_events_path %>
19
+ <%= f.tb_save_buttons 'Event', admin_list_spud_calendar_events_path, @calendar_event.id ? admin_calendar_event_path(@calendar_event) : nil %>
20
20
 
21
- <% end %>
21
+ <% end %>
@@ -1,13 +1,11 @@
1
1
  Rails.application.routes.draw do
2
-
3
2
  # Calendar
4
- get 'calendar(/:month/:year)' => "calendars#show", :as => :calendar
5
- resources :calendar_events, :only => [:index, :show], :path => '/events'
6
-
7
- namespace :admin do
8
- resources :calendar_events, :except => [:index]
9
- resources :calendars, :except => [:index]
10
- get 'events(/:month(/:year(/:calendar)))' => "calendar_events#index", :as => "list_spud_calendar_events"
11
- end
3
+ get 'calendar(/:month/:year)' => 'calendars#show', :as => :calendar
4
+ resources :calendar_events, only: [:index, :show], path: '/events'
12
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
13
11
  end
@@ -3,10 +3,10 @@ class CreateSpudCalendars < ActiveRecord::Migration
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
@@ -2,6 +2,7 @@ class RemoveColorFromSpudCalendars < ActiveRecord::Migration
2
2
  def up
3
3
  remove_column :spud_calendars, :color
4
4
  end
5
+
5
6
  def down
6
7
  add_column :spud_calendars, :color, 'binary(6)'
7
8
  end
@@ -1,9 +1,8 @@
1
1
  class SpudEvents::CalendarBuilder
2
-
3
- DEFAULT_HEADERS = %w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday]
2
+ DEFAULT_HEADERS = %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday)
4
3
  START_DAY = :sunday
5
4
 
6
- delegate :content_tag, :to => :view
5
+ delegate :content_tag, to: :view
7
6
  attr_accessor :view, :date, :callback
8
7
 
9
8
  def initialize(view, date, opts)
@@ -14,16 +13,16 @@ class SpudEvents::CalendarBuilder
14
13
 
15
14
  def table(&block)
16
15
  @callback = block
17
- content_tag :table, :class => "calendar" do
16
+ content_tag :table, class: 'calendar' do
18
17
  header + week_rows
19
18
  end
20
19
  end
21
20
 
22
- private
21
+ private
23
22
 
24
23
  def header
25
24
  content_tag :tr do
26
- @headers.map { |day| content_tag :th, day, :class => 'day-header' }.join.html_safe
25
+ @headers.map { |day| content_tag :th, day, class: 'day-header' }.join.html_safe
27
26
  end
28
27
  end
29
28
 
@@ -41,9 +40,9 @@ private
41
40
 
42
41
  def day_classes(day)
43
42
  classes = ['day-cell']
44
- classes << "today" if day == Date.today
45
- classes << "not-month" if day.month != date.month
46
- classes.empty? ? nil : classes.join(" ")
43
+ classes << 'today' if day == Date.today
44
+ classes << 'not-month' if day.month != date.month
45
+ classes.empty? ? nil : classes.join(' ')
47
46
  end
48
47
 
49
48
  def weeks
@@ -2,18 +2,22 @@ require 'tb_core'
2
2
 
3
3
  module SpudEvents
4
4
  class Engine < Rails::Engine
5
- engine_name :tb_events
5
+ engine_name :tb_events
6
6
  config.autoload_paths << "#{root}/lib"
7
7
 
8
- initializer :admin do
9
- Spud::Core.configure do |config|
10
- config.admin_applications += [{:name => "Events", :thumbnail => "spud/admin/events_thumb.png", :url => "/admin/events",:order => 10}]
11
- end
12
- end
8
+ initializer :admin do
9
+ TbCore.configure do |config|
10
+ config.admin_applications += [{ name: 'Events', thumbnail: 'spud/admin/events_thumb.png', url: '/admin/events', order: 10 }]
11
+ end
12
+ end
13
13
 
14
- initializer :assets do |config|
15
- Spud::Core.append_admin_stylesheets('admin/events/application')
16
- Spud::Core.append_admin_javascripts('admin/events/application')
17
- end
14
+ initializer :assets do |_config|
15
+ TbCore.append_admin_stylesheets('admin/events/application')
16
+ TbCore.append_admin_javascripts('admin/events/application')
17
+ end
18
+
19
+ initializer 'tb_events.assets' do
20
+ Rails.application.config.assets.precompile += ['spud/admin/events_thumb.png']
21
+ end
18
22
  end
19
23
  end
@@ -1,3 +1,3 @@
1
1
  module SpudEvents
2
- VERSION = "1.2.0.beta1"
2
+ VERSION = '1.3.0'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  module Spud
2
- module Events
3
- require 'spud_events/configuration'
4
- require 'spud_events/engine' if defined?(Rails)
5
- end
2
+ module Events
3
+ require 'spud_events/configuration'
4
+ require 'spud_events/engine' if defined?(Rails)
5
+ end
6
6
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tb_events
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.beta1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Westlake Design
8
- autorequire:
7
+ - Moser Consulting
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-30 00:00:00.000000000 Z
11
+ date: 2021-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: 5.0.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: 5.0.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: tb_core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.2'
33
+ version: '1.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.2'
40
+ version: '1.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: mysql2
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,107 +52,93 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - '='
60
- - !ruby/object:Gem::Version
61
- version: 2.8.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '='
67
- - !ruby/object:Gem::Version
68
- version: 2.8.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rspec-rails
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - '='
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: 2.8.1
61
+ version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - '='
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: 2.8.1
68
+ version: '0'
83
69
  - !ruby/object:Gem::Dependency
84
- name: shoulda
70
+ name: rails-controller-testing
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - "~>"
73
+ - - ">="
88
74
  - !ruby/object:Gem::Version
89
- version: 3.0.1
75
+ version: '0'
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - "~>"
80
+ - - ">="
95
81
  - !ruby/object:Gem::Version
96
- version: 3.0.1
82
+ version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
- name: factory_girl
84
+ name: factory_bot_rails
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - '='
87
+ - - ">="
102
88
  - !ruby/object:Gem::Version
103
- version: 2.5.0
89
+ version: '0'
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - '='
94
+ - - ">="
109
95
  - !ruby/object:Gem::Version
110
- version: 2.5.0
96
+ version: '0'
111
97
  - !ruby/object:Gem::Dependency
112
- name: mocha
98
+ name: database_cleaner
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
- - - '='
101
+ - - ">="
116
102
  - !ruby/object:Gem::Version
117
- version: 0.10.3
103
+ version: '0'
118
104
  type: :development
119
105
  prerelease: false
120
106
  version_requirements: !ruby/object:Gem::Requirement
121
107
  requirements:
122
- - - '='
108
+ - - ">="
123
109
  - !ruby/object:Gem::Version
124
- version: 0.10.3
110
+ version: '0'
125
111
  - !ruby/object:Gem::Dependency
126
- name: database_cleaner
112
+ name: simplecov
127
113
  requirement: !ruby/object:Gem::Requirement
128
114
  requirements:
129
- - - "~>"
115
+ - - ">="
130
116
  - !ruby/object:Gem::Version
131
- version: 1.0.0
117
+ version: '0'
132
118
  type: :development
133
119
  prerelease: false
134
120
  version_requirements: !ruby/object:Gem::Requirement
135
121
  requirements:
136
- - - "~>"
122
+ - - ">="
137
123
  - !ruby/object:Gem::Version
138
- version: 1.0.0
124
+ version: '0'
139
125
  - !ruby/object:Gem::Dependency
140
- name: simplecov
126
+ name: rubocop
141
127
  requirement: !ruby/object:Gem::Requirement
142
128
  requirements:
143
- - - "~>"
129
+ - - ">="
144
130
  - !ruby/object:Gem::Version
145
- version: 0.6.4
131
+ version: '0'
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
- - - "~>"
136
+ - - ">="
151
137
  - !ruby/object:Gem::Version
152
- version: 0.6.4
153
- description:
138
+ version: '0'
139
+ description:
154
140
  email:
155
- - greg@westlakedesign.com
141
+ - greg.woods@moserit.com
156
142
  executables: []
157
143
  extensions: []
158
144
  extra_rdoc_files: []
@@ -173,9 +159,9 @@ files:
173
159
  - app/helpers/admin/calendar_events_helper.rb
174
160
  - app/helpers/admin/calendars_helper.rb
175
161
  - app/helpers/calendars_helper.rb
176
- - app/models/spud/spud_calendar_event_model.rb
177
162
  - app/models/spud_calendar.rb
178
163
  - app/models/spud_calendar_event.rb
164
+ - app/models/spud_events/calendar_event_model.rb
179
165
  - app/views/admin/calendar_events/_calendar.html.erb
180
166
  - app/views/admin/calendar_events/_form.html.erb
181
167
  - app/views/admin/calendar_events/edit.html.erb
@@ -200,10 +186,10 @@ files:
200
186
  - lib/spud_events/engine.rb
201
187
  - lib/spud_events/version.rb
202
188
  - lib/tb_events.rb
203
- homepage:
189
+ homepage:
204
190
  licenses: []
205
191
  metadata: {}
206
- post_install_message:
192
+ post_install_message:
207
193
  rdoc_options: []
208
194
  require_paths:
209
195
  - lib
@@ -214,13 +200,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
214
200
  version: '0'
215
201
  required_rubygems_version: !ruby/object:Gem::Requirement
216
202
  requirements:
217
- - - ">"
203
+ - - ">="
218
204
  - !ruby/object:Gem::Version
219
- version: 1.3.1
205
+ version: '0'
220
206
  requirements: []
221
- rubyforge_project:
222
- rubygems_version: 2.4.3
223
- signing_key:
207
+ rubygems_version: 3.0.8
208
+ signing_key:
224
209
  specification_version: 4
225
210
  summary: Twice Baked Events engine
226
211
  test_files: []
@@ -1,25 +0,0 @@
1
- class Spud::SpudCalendarEventModel < 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, ->(date){ where(:start_at => date.beginning_of_month...date.end_of_month) }
9
- scope :upcoming, ->(limit=false){ where('start_at >= ?', Date.today).order('start_at asc').limit(limit) }
10
-
11
- def start_date
12
- return start_at.to_date
13
- end
14
-
15
- def days_span
16
- return (end_at.to_date - start_at.to_date).to_i + 1
17
- end
18
-
19
- def falls_on?(day)
20
- start_date = start_at.beginning_of_day.to_date
21
- end_date = end_at.end_of_day.to_date
22
- return day >= start_date && day <= end_date
23
- end
24
-
25
- end