ecm_calendar_helper 0.0.1.pre → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/README.rdoc +53 -1
  3. data/app/assets/javascripts/ecm/calendar_helper/application.js +2 -0
  4. data/app/assets/javascripts/ecm/calendar_helper/application/remote_calendar.js.coffee +5 -0
  5. data/app/assets/javascripts/ecm_calendar_helper.js +1 -0
  6. data/app/assets/stylesheets/ecm/calendar_helper/application.css +3 -0
  7. data/app/assets/stylesheets/ecm/calendar_helper/application/basic.css +37 -0
  8. data/app/assets/stylesheets/ecm/calendar_helper/application/bootstrap-extensions.css +17 -0
  9. data/app/assets/stylesheets/ecm/calendar_helper/application/calendar-pagination.css +3 -0
  10. data/app/assets/stylesheets/ecm_calendar_helper.css +3 -0
  11. data/app/concerns/ecm/calendar_helper/controller/calendar_concern.rb +92 -0
  12. data/app/helpers/ecm/calendar_helper.rb +44 -61
  13. data/app/views/ecm/calendar_helper/_month_calendar.haml +33 -0
  14. data/app/views/ecm/calendar_helper/_month_calendar_pagination.haml +11 -0
  15. data/app/views/ecm/calendar_helper/calendar_concern/_calendar.html.haml +2 -0
  16. data/app/views/ecm/calendar_helper/calendar_concern/index.html.haml +1 -0
  17. data/app/views/ecm/calendar_helper/calendar_concern/index.js.erb +1 -0
  18. data/config/initializers/assets.rb +1 -0
  19. data/config/locales/de.yml +10 -0
  20. data/config/locales/en.yml +10 -0
  21. data/lib/ecm/calendar_helper/version.rb +1 -1
  22. data/lib/generators/ecm/calendar_helper/controller/controller_generator.rb +49 -0
  23. data/lib/generators/ecm/calendar_helper/controller/templates/controller.rb +18 -0
  24. data/lib/generators/ecm/calendar_helper/controller/templates/initializer.rb +42 -0
  25. data/lib/generators/ecm/calendar_helper/controller/templates/routes.source +5 -0
  26. data/lib/generators/ecm/calendar_helper/controller/templates/views/_calendar.html.haml +2 -0
  27. data/lib/generators/ecm/calendar_helper/controller/templates/views/index.html.haml +1 -0
  28. data/lib/generators/ecm/calendar_helper/controller/templates/views/index.js.erb +1 -0
  29. metadata +72 -55
  30. data/config/locales/ecm.calendar_helper.de.yml +0 -2
  31. data/config/locales/ecm.calendar_helper.en.yml +0 -2
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 48bf233bf496766d066d102bd8fb3d231fa0191d868ac3e35e97c476c30c88c9
4
+ data.tar.gz: 74eddf8f6ace7fdcff04ee11ad529cbbfdd744d0967fa69c91af30d341428cfa
5
+ SHA512:
6
+ metadata.gz: 25973c97453e42f50231cb152acba8b0dfda1f51d8699b5b9bbf09c76035d05f4882b1f991fc6c6af6339cf8fa1b2680be5a0d2f34afe6c166ce3dd7d03170d0
7
+ data.tar.gz: 465edb3be330a537661f91c23debed74906538986bf7922d7e9dab30a8a059e07eab29a36a6cbc7bd209d2008db014f6ab7223f7458b3b625e29c25c16567e39
@@ -1,3 +1,55 @@
1
1
  = EcmCalendarHelper
2
2
 
3
- This project rocks and uses MIT-LICENSE.
3
+ This project rocks and uses MIT-LICENSE.
4
+
5
+ == Installation
6
+
7
+ Add it to your Gemfile.
8
+
9
+ # Gemfile
10
+ gem 'ecm_calendar_helper'
11
+
12
+ == Usage
13
+
14
+ Add the helper to your controller:
15
+
16
+ # app/controllers/application_controller.rb
17
+ class ApplicationController < ActionController::Base
18
+ helper Ecm::CalendarHelper
19
+ end
20
+
21
+ # app/controllers/reservations_controller.rb
22
+ class ApplicationController < ActionController::Base
23
+ before_action :initialize_calendar
24
+
25
+ private
26
+
27
+ def initialize_calendar
28
+ @year = params[:year] ||= Time.zone.now.year
29
+ @month = params[:month] ||= Time.zone.now.month
30
+
31
+ @date = Date.strptime("#{@month}-#{@year}", "%m-%Y")
32
+
33
+ @collection = Reservation.in_month(@date).all
34
+ end
35
+ end
36
+
37
+ Render the calendar:
38
+
39
+ # i.e.app/views/reservations/index.html.haml
40
+ = month_calendar @date, @collection, display_method: :name, start_day: :monday
41
+
42
+ == Pagination
43
+
44
+ Add routes for nice year and month params:
45
+
46
+ # config/routes.rb
47
+ Rails.application.routes.draw do
48
+ resources :reservations do
49
+ get "(/:year/:month)", action: :index, on: :collection
50
+ end
51
+ end
52
+
53
+ == Remote rendering
54
+
55
+ @TODO
@@ -0,0 +1,2 @@
1
+ //= require_self
2
+ //= require_tree ./application
@@ -0,0 +1,5 @@
1
+ $ ->
2
+ $('[data-calendar]').each ->
3
+ url = $(this).attr('data-calendar')
4
+ $.ajax(url: url).done (html) ->
5
+ $(this).append html
@@ -0,0 +1 @@
1
+ //= require ecm/calendar_helper/application
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require_tree ./application
3
+ */
@@ -0,0 +1,37 @@
1
+ @media screen and (max-width: 991px) {
2
+ .calendar .calendar-weekday {
3
+ display: none;
4
+ }
5
+ }
6
+
7
+ @media screen and (min-width: 991px) {
8
+ .calendar .calendar-day-container {
9
+ height: 7vw;
10
+ }
11
+ }
12
+
13
+ .calendar-item {
14
+ border: 1px solid transparent;
15
+ border-radius: 4px;
16
+ display: block;
17
+ padding: 4px;
18
+ }
19
+
20
+ .calendar-item {
21
+ text-decoration: none
22
+ }
23
+
24
+ .calendar-item a, .calendar-item a:hover {
25
+ color: white;
26
+
27
+ }
28
+
29
+ .calendar-item a:hover {
30
+ text-decoration: none;
31
+ }
32
+
33
+ .calendar-item-default {
34
+ border-color: darkgrey;
35
+ background-color: grey;
36
+ color: white;
37
+ }
@@ -0,0 +1,17 @@
1
+ .flex-row {
2
+ display: flex;
3
+ flex-direction: row;
4
+ flex-wrap: wrap;
5
+ margin: 0 -5px;
6
+ }
7
+
8
+ .flex-row .column {
9
+ flex-basis: 100%;
10
+ padding: 0 5px;
11
+ }
12
+
13
+ @media screen and (min-width: 992px) {
14
+ .flex-row .column {
15
+ flex: 1;
16
+ }
17
+ }
@@ -0,0 +1,3 @@
1
+ .calendar-pagination {
2
+ margin-bottom: 20px;
3
+ }
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require ./ecm/calendar_helper/application
3
+ */
@@ -0,0 +1,92 @@
1
+ module Ecm
2
+ module CalendarHelper
3
+ module Controller
4
+ # == Usage:
5
+ #
6
+ # Add javascripts:
7
+ #
8
+ # # app/assets/javascripts/application.js
9
+ # //= require ecm_calendar_helper
10
+ #
11
+ # Add stylesheets:
12
+ #
13
+ # # app/assets/stylesheets/application.css
14
+ # /*
15
+ # *= require ecm_calendar_helper
16
+ # */
17
+ #
18
+ # Add routes:
19
+ #
20
+ # # config/routes.rb
21
+ # Rails.application.routes.draw do
22
+ # resources :calendars, only: [:index], constraints: ->(r) { r.xhr? } do
23
+ # get "(/:year/:month)", action: :index, on: :collection
24
+ # end
25
+ # end
26
+ #
27
+ # Add controller:
28
+ #
29
+ # # app/controllers/calendars_controller.rb
30
+ # class CalendarsController < ApplicationController
31
+ # include EcmCalendarHelper::Controller::CalendarConcern
32
+ #
33
+ # private
34
+ #
35
+ # def load_collection_for_calendar
36
+ # @collection = Posts.for_calendar.in_month(@date).all
37
+ # end
38
+ # end
39
+ #
40
+ # Add views:
41
+ #
42
+ # Copy Ecm::CalendarHelper::Engine.root.join('app/views/ecm/calendar_helper/calendar_concern/*') => app/views/calendars/
43
+ #
44
+ # Render the calendar somewhere in your views:
45
+ #
46
+ # # app/views/*.html.haml
47
+ # #calendar{ data: { calendar: calendars_url } }
48
+ #
49
+ #
50
+ module CalendarConcern
51
+ extend ActiveSupport::Concern
52
+
53
+ included do
54
+ before_action :initialize_calendar_date, only: [:index]
55
+ before_action :load_collection_for_calendar, only: [:index]
56
+
57
+ helper Ecm::CalendarHelper
58
+ helper_method :calendar_options
59
+ end
60
+
61
+ def index
62
+ if request.xhr?
63
+ render layout: nil
64
+ else
65
+ render
66
+ end
67
+ end
68
+
69
+ private
70
+
71
+ def initialize_calendar_date
72
+ @year = params[:year] ||= Time.zone.now.year
73
+ @month = params[:month] ||= Time.zone.now.month
74
+
75
+ @date = Date.strptime("#{@month}-#{@year}", "%m-%Y")
76
+ end
77
+
78
+ def load_collection_for_calendar
79
+ raise 'not implemented'
80
+ end
81
+
82
+ def calendar_options
83
+ default_calendar_options
84
+ end
85
+
86
+ def default_calendar_options
87
+ {}
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
@@ -1,16 +1,30 @@
1
1
  module Ecm
2
2
  module CalendarHelper
3
3
  # renders a calendar table
4
+ #
5
+ # Example with elements that span more than 1 day:
6
+ #
7
+ # = month_calendar @date, @reservations, start_date_method: :start_at, end_date_method: :end_at
8
+ #
9
+ # Example of using a lamda as display method:
10
+ #
11
+ # = month_calendar(display_method: ->(context, resource) { context.link_to(resource.booker.human, resource.booker) })
12
+ #
4
13
  def month_calendar(date = Time.zone.now.to_date, elements = [], options = {})
5
- # default options
6
- options.reverse_merge! :date_method => :start_at, :display_method => :to_s, :link_elements => true, :start_day => :sunday
14
+ options.reverse_merge! :date_method => :start_at, :display_method => :to_s, :link_elements => true, :start_day => :sunday, start_date_method: nil, end_date_method: nil
15
+
16
+ display_method = options.delete(:display_method)
17
+ link_elements = options.delete(:link_elements)
18
+
19
+ start_date_method = options.delete(:start_date_method)
20
+ end_date_method = options.delete(:end_date_method)
7
21
 
8
22
  # calculate beginning and end of month
9
23
  beginning_of_month = date.beginning_of_month.to_date
10
24
  end_of_month = date.end_of_month.to_date
11
25
 
12
26
  # Get localized day names
13
- localized_day_names = I18n.t('date.day_names').dup
27
+ localized_day_names = I18n.t('date.abbr_day_names').dup
14
28
 
15
29
  # Shift day names to suite start day
16
30
  english_day_names = [:sunday, :monday, :tuesday, :wednesday, :thursday, :friday, :saturday]
@@ -20,75 +34,44 @@ module Ecm
20
34
 
21
35
  # Get the offset of start day
22
36
  offset = english_day_names.index(options[:start_day])
37
+ last_day_of_week = Time.zone.now.end_of_week.wday
23
38
 
24
39
 
25
40
  # Change calendar heading if offset is not 0 (offset 0 means sunday is the first day of the week)
26
41
  offset.times do
27
42
  localized_day_names.push(localized_day_names.shift)
28
43
  end
29
-
30
- content_tag(:table, :class => 'calendar') do
31
- table = ''
32
-
33
- table << content_tag(:tr, localized_day_names.collect { |day| content_tag(:th, day) }.join("").html_safe)
34
- table << content_tag(:tr) do
35
- table_content = ''
36
-
37
- (beginning_of_month..end_of_month).each do |d|
38
- if d == beginning_of_month
39
- column_offset = d.wday - offset
40
- column_offset += 7 if column_offset < 0
41
- column_offset.times do
42
- table_content << content_tag(:td, nil, :class => 'offset')
43
- end
44
- end
45
-
46
- if d.wday == (0 + offset)
47
- table_content << "</tr><tr>"
48
- end
49
-
50
- # Create content for day
51
- day_content = "#{d.day}<br/ >".html_safe
52
- elements_for_day = elements.find_all { |e| e.send(options[:date_method]).to_date == d.to_date }
53
- if options[:link_elements]
54
- elements_for_day.collect! { |e| content_tag(:div, link_to(e.send(options[:display_method]), e), :class => 'calendar_entry') }
55
- else
56
- elements_for_day.collect! { |e| content_tag(:div, e.send(options[:display_method]), :class => 'calendar_entry') }
57
- end
58
-
59
- day_content << elements_for_day.join("").html_safe
60
-
61
- # css classes for day td
62
- if d == Time.zone.now.to_date
63
- day_css_classes = 'calendar_day today'
64
- else
65
- day_css_classes = 'calendar_day'
66
- end
67
-
68
- table_content << content_tag(:td, day_content, :class => day_css_classes)
44
+
45
+ days_by_week = {}
46
+ first_day = beginning_of_month.beginning_of_week
47
+ last_day = end_of_month.end_of_week
48
+
49
+ days = (first_day..last_day).each_with_object({}).with_index do |(day, memo), index|
50
+ memo[day.to_date] = elements.find_all do |e|
51
+ if start_date_method.present? && end_date_method.present?
52
+ day.to_date.between?(e.send(start_date_method), e.send(end_date_method))
53
+ else
54
+ e.send(options[:date_method]).to_date == day.to_date
69
55
  end
70
-
71
- table_content.html_safe
72
- end
73
-
74
- table.html_safe
56
+ end || {}
75
57
  end
58
+
59
+ days_by_week = days.each_with_object({}) { |(k, v), m| (m[k.cweek] ||= {})[k] = v }
60
+
61
+ render partial: 'ecm/calendar_helper/month_calendar', locals: { localized_day_names: localized_day_names, days_by_week: days_by_week, display_method: display_method, link_elements: link_elements }
76
62
  end
77
63
 
78
- def month_calendar_pagination(date)
79
- actual_month = Time.zone.now.beginning_of_month.to_date
80
-
64
+ def month_calendar_pagination(date, options = {})
65
+ options.reverse_merge!(show_today_link: true, remote: false)
66
+
67
+ show_today_link = options.delete(:show_today_link)
68
+ remote = options.delete(:remote)
69
+
70
+ actual_month = Time.zone.now.beginning_of_month.to_date
81
71
  previous_month = date.beginning_of_month.to_date - 1.month
82
- next_month = date.beginning_of_month.to_date + 1.months
83
-
84
- content_tag(:div, :class => 'calendar_pagination') do
85
- [
86
- link_to('Heute', url_for(:month => actual_month.month, :year => actual_month.year)),
87
- link_to("<", url_for(:month => previous_month.month, :year => previous_month.year)),
88
- link_to(">", url_for(:month => next_month.month, :year => next_month.year)),
89
- I18n.l(date, :format => :month_with_year),
90
- ].join(" | ").html_safe
91
- end
72
+ next_month = date.beginning_of_month.to_date + 1.months
73
+
74
+ render partial: 'ecm/calendar_helper/month_calendar_pagination', locals: { actual_month: actual_month, previous_month: previous_month, next_month: next_month, show_today_link: show_today_link, date: date, remote: remote }
92
75
  end
93
76
  end
94
77
  end
@@ -0,0 +1,33 @@
1
+ .calendar
2
+ .flex-row.calendar-weekday-names
3
+ - localized_day_names.each do |day|
4
+ .column
5
+ .calendar-weekday
6
+ .column.calendar-weekday-name-container.border.mb-3.p-2
7
+ %h1= day
8
+
9
+ - days_by_week.each do |week, days|
10
+ .flex-row{ class: "week-#{week}" }
11
+ - days_count = 0
12
+ - days.each do |day, elements|
13
+ - td_classes = ['calendar-day']
14
+ - td_classes << 'active today' if day == Time.zone.now.to_date
15
+ - td_classes << 'with-elements' if elements.any?
16
+ - td_classes << 'not-actual-month' if day.month != Time.zone.now.month
17
+ .column{ class: td_classes.join(" ") }
18
+ .calendar-day-container.border.mb-3.p-2
19
+ %h1.calendar-day-title= day.day
20
+ %div.calendar-entries
21
+ - elements.each do |element|
22
+ %div.calendar-day-content
23
+ %span.calendar-item.calendar-item-default
24
+ - if display_method.nil?
25
+ - label = nil
26
+ - elsif display_method.respond_to?(:call)
27
+ - label = display_method.call(self, element)
28
+ - elsif element.respond_to?(display_method)
29
+ - label = element.send(display_method)
30
+ - if link_elements
31
+ = link_to(label, element)
32
+ - else
33
+ = label
@@ -0,0 +1,11 @@
1
+ .calendar-pagination.text-center
2
+ - if show_today_link
3
+ = link_to(url_for(month: actual_month.month, year: actual_month.year), class: 'btn btn-default btn-link calendar-pagination-today', remote: remote) do
4
+ = t('.today')
5
+ .btn-group
6
+ = link_to(url_for(month: previous_month.month, year: previous_month.year), class: 'btn btn-primary calendar-pagination-back', remote: remote) do
7
+ = t('.previous')
8
+ = button_tag(type: 'button', class: 'btn btn-disabled calendar-pagination-actual') do
9
+ = I18n.l(date, format: :month_with_year)
10
+ = link_to(url_for(month: next_month.month, year: next_month.year), class: 'btn btn-primary calendar-pagination-next', remote: remote) do
11
+ = t('.next')
@@ -0,0 +1,2 @@
1
+ = month_calendar_pagination(date, remote: request.xhr?)
2
+ = month_calendar date, collection, options
@@ -0,0 +1 @@
1
+ = render partial: 'calendar', locals: { date: @date, collection: @collection, options: calendar_options }
@@ -0,0 +1 @@
1
+ $('#bookings-calendar').html("<%= escape_javascript(render(partial: 'calendar', locals: { date: @date, collection: @collection, options: calendar_options })) %>");
@@ -0,0 +1 @@
1
+ Rails.application.config.assets.precompile += %w(ecm_calendar_helper.css ecm_calendar_helper.js)
@@ -0,0 +1,10 @@
1
+ de:
2
+ date:
3
+ formats:
4
+ month_with_year: '%B %Y'
5
+ ecm:
6
+ calendar_helper:
7
+ month_calendar_pagination:
8
+ today: Heute
9
+ previous: Zurück
10
+ next: Vorwärts
@@ -0,0 +1,10 @@
1
+ en:
2
+ date:
3
+ formats:
4
+ month_with_year: '%B %Y'
5
+ ecm:
6
+ calendar_helper:
7
+ month_calendar_pagination:
8
+ today: Today
9
+ previous: Previous
10
+ next: Next
@@ -1,5 +1,5 @@
1
1
  module Ecm
2
2
  module CalendarHelper
3
- VERSION = "0.0.1.pre"
3
+ VERSION = "1.0.1"
4
4
  end
5
5
  end
@@ -0,0 +1,49 @@
1
+ module Ecm
2
+ module CalendarHelper
3
+ module Generators
4
+ class ControllerGenerator < Rails::Generators::Base
5
+ desc 'Generates a calendar controller (with views)'
6
+
7
+ source_root File.expand_path('../templates', __FILE__)
8
+
9
+ attr_reader :base_controller_class_name
10
+ attr_reader :controller_class_name
11
+
12
+ def initialize(*args)
13
+ super
14
+ @base_controller_class_name = ENV.fetch('BASE_CONTROLLER_CLASS_NAME') { '::FrontendController' }
15
+ @controller_class_name = ENV.fetch('CONTROLLER_CLASS_NAME') { 'CalendarsController' }
16
+ end
17
+
18
+ def generate_routes
19
+ route File.read(File.join(File.expand_path('../templates', __FILE__), 'routes.source'))
20
+ end
21
+
22
+ def generate_controller
23
+ binding.pry
24
+ template 'controller.rb', "app/controllers/#{controller_path_name}.rb"
25
+ end
26
+
27
+ def generate_views
28
+ template 'views/index.html.haml', "app/views/#{view_path}/index.html.haml"
29
+ template 'views/index.js.erb', "app/views/#{view_path}/index.js.erb"
30
+ template 'views/_calendar.html.haml', "app/views/#{view_path}/_calendar.html.haml"
31
+ end
32
+
33
+ private
34
+
35
+ def controller_path_name
36
+ @controller_class_name.underscore
37
+ end
38
+
39
+ def view_path
40
+ @controller_class_name.underscore.gsub('_controller', '')
41
+ end
42
+
43
+ def route_name
44
+ @controller_class_name.demodulize.underscore.pluralize
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,18 @@
1
+ class <%= controller_class_name %> < <%= base_controller_class_name %>
2
+ include Ecm::CalendarHelper::Controller::CalendarConcern
3
+
4
+ private
5
+
6
+ def load_collection_for_calendar
7
+ @collection = {}
8
+ end
9
+
10
+ # def calendar_options
11
+ # default_calendar_options.merge(
12
+ # display_method: nil,
13
+ # start_day: :monday,
14
+ # start_date_method: :start_at,
15
+ # end_date_method: :end_at
16
+ # )
17
+ # end
18
+ end
@@ -0,0 +1,42 @@
1
+ Ecm::Blog.configure do |config|
2
+ # Set the base controller for the page controller
3
+ #
4
+ # Default: config.base_controller = '<%= base_controller_class_name %>'
5
+ #
6
+ config.base_controller = '<%= base_controller_class_name %>'
7
+
8
+ # Class to use for creators and updaters.
9
+ #
10
+ # default: config.creator_class_name = 'User'
11
+ #
12
+ config.creator_class_name = 'User'
13
+
14
+ # Set the page title for the posts index page. Useful for when you use
15
+ # the blog posts index as main app root page.
16
+ #
17
+ # example: config.posts_index_page_title_proc = ->(view) { view.t('.welcome') }
18
+ #
19
+ # default: config.posts_index_page_title_proc = ->(view) { view.resource_class.model_name.human(count: :other) }
20
+ #
21
+ config.posts_index_page_title_proc = ->(view) { view.resource_class.model_name.human(count: :other) }
22
+
23
+ # Set options that will be passed to the paginate call.
24
+ #
25
+ # example for bootstrap 3 (You will need to add the bootstrap3-kaminari-views gem to your Gemfile):
26
+ #
27
+ # config.pagination_options_proc = ->(view) { { theme: 'twitter-bootstrap-3' }
28
+ #
29
+ # example for bootstrap 4 (You will need to add the bootstrap4-kaminari-views gem to your Gemfile):
30
+ #
31
+ # config.pagination_options_proc = ->(view) { { theme: 'twitter-bootstrap-4' }
32
+ #
33
+ # default: config.pagination_options_proc = ->(view) { { theme: 'twitter-bootstrap-4', pagination_class: 'justify-content-center' } }
34
+ #
35
+ config.pagination_options_proc = ->(view) { { theme: 'twitter-bootstrap-4', pagination_class: 'justify-content-center' } }
36
+
37
+ # Options for rendering the ActiveStorage preview picture in the posts index view.
38
+ #
39
+ # Default: config.preview_picture_asset_variant_options = { resize: '320x240' }
40
+ #
41
+ config.preview_picture_asset_variant_options = { resize: '320x240' }
42
+ end
@@ -0,0 +1,5 @@
1
+
2
+
3
+ <%= whitespace_from_nesting %>resources :<%= route_name %>, only: [:index], constraints: ->(r) { r.xhr? } do
4
+ <%= whitespace_from_nesting %> get "(/:year/:month)", action: :index, on: :collection
5
+ <%= whitespace_from_nesting %>end
@@ -0,0 +1,2 @@
1
+ = month_calendar_pagination(date, remote: request.xhr?)
2
+ = month_calendar date, collection, options
@@ -0,0 +1 @@
1
+ = render partial: 'calendar', locals: { date: @date, collection: @collection, options: calendar_options }
@@ -0,0 +1 @@
1
+ $('#bookings-calendar').html("<%%= escape_javascript(render(partial: 'calendar', locals: { date: @date, collection: @collection, options: calendar_options })) %>");
metadata CHANGED
@@ -1,85 +1,102 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ecm_calendar_helper
3
- version: !ruby/object:Gem::Version
4
- prerelease: 6
5
- version: 0.0.1.pre
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.1
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - Roberto Vasquez Angel
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2012-07-22 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
11
+ date: 2020-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
16
14
  name: rails
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ~>
22
- - !ruby/object:Gem::Version
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
23
19
  version: 3.2.6
24
20
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: sqlite3
28
21
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
30
- none: false
31
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.2.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: sqlite3
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
32
31
  - - ">="
33
- - !ruby/object:Gem::Version
34
- version: "0"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
35
34
  type: :development
36
- version_requirements: *id002
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
37
41
  description: Rails calendar helper.
38
- email:
42
+ email:
39
43
  - roberto@vasquez-angel.de
40
44
  executables: []
41
-
42
45
  extensions: []
43
-
44
46
  extra_rdoc_files: []
45
-
46
- files:
47
+ files:
48
+ - MIT-LICENSE
49
+ - README.rdoc
50
+ - Rakefile
51
+ - app/assets/javascripts/ecm/calendar_helper/application.js
52
+ - app/assets/javascripts/ecm/calendar_helper/application/remote_calendar.js.coffee
53
+ - app/assets/javascripts/ecm_calendar_helper.js
54
+ - app/assets/stylesheets/ecm/calendar_helper/application.css
55
+ - app/assets/stylesheets/ecm/calendar_helper/application/basic.css
56
+ - app/assets/stylesheets/ecm/calendar_helper/application/bootstrap-extensions.css
57
+ - app/assets/stylesheets/ecm/calendar_helper/application/calendar-pagination.css
58
+ - app/assets/stylesheets/ecm_calendar_helper.css
59
+ - app/concerns/ecm/calendar_helper/controller/calendar_concern.rb
47
60
  - app/helpers/ecm/calendar_helper.rb
48
- - config/locales/ecm.calendar_helper.de.yml
49
- - config/locales/ecm.calendar_helper.en.yml
50
- - lib/ecm_calendar_helper.rb
51
- - lib/tasks/ecm_calendar_helper_tasks.rake
61
+ - app/views/ecm/calendar_helper/_month_calendar.haml
62
+ - app/views/ecm/calendar_helper/_month_calendar_pagination.haml
63
+ - app/views/ecm/calendar_helper/calendar_concern/_calendar.html.haml
64
+ - app/views/ecm/calendar_helper/calendar_concern/index.html.haml
65
+ - app/views/ecm/calendar_helper/calendar_concern/index.js.erb
66
+ - config/initializers/assets.rb
67
+ - config/locales/de.yml
68
+ - config/locales/en.yml
52
69
  - lib/ecm/calendar_helper/engine.rb
53
70
  - lib/ecm/calendar_helper/version.rb
54
- - MIT-LICENSE
55
- - Rakefile
56
- - README.rdoc
71
+ - lib/ecm_calendar_helper.rb
72
+ - lib/generators/ecm/calendar_helper/controller/controller_generator.rb
73
+ - lib/generators/ecm/calendar_helper/controller/templates/controller.rb
74
+ - lib/generators/ecm/calendar_helper/controller/templates/initializer.rb
75
+ - lib/generators/ecm/calendar_helper/controller/templates/routes.source
76
+ - lib/generators/ecm/calendar_helper/controller/templates/views/_calendar.html.haml
77
+ - lib/generators/ecm/calendar_helper/controller/templates/views/index.html.haml
78
+ - lib/generators/ecm/calendar_helper/controller/templates/views/index.js.erb
79
+ - lib/tasks/ecm_calendar_helper_tasks.rake
57
80
  homepage: https://github.com/robotex82/ecm_calendar_helper.git
58
81
  licenses: []
59
-
82
+ metadata: {}
60
83
  post_install_message:
61
84
  rdoc_options: []
62
-
63
- require_paths:
85
+ require_paths:
64
86
  - lib
65
- required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
- requirements:
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ required_rubygems_version: !ruby/object:Gem::Requirement
93
+ requirements:
68
94
  - - ">="
69
- - !ruby/object:Gem::Version
70
- version: "0"
71
- required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
- requirements:
74
- - - ">"
75
- - !ruby/object:Gem::Version
76
- version: 1.3.1
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
77
97
  requirements: []
78
-
79
- rubyforge_project:
80
- rubygems_version: 1.8.24
98
+ rubygems_version: 3.1.4
81
99
  signing_key:
82
- specification_version: 3
100
+ specification_version: 4
83
101
  summary: Rails calendar helper.
84
102
  test_files: []
85
-
@@ -1,2 +0,0 @@
1
- ---
2
- de:
@@ -1,2 +0,0 @@
1
- ---
2
- en: