ecm_calendar_helper 0.0.2 → 0.0.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3e5f21214725193d52d1c15380ed1c03c04b8e6
|
4
|
+
data.tar.gz: 15278f09109d889796d8c3f91eddf1628230c0b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a05e3299d4059ab13376b008a7b8f1745cb7406c541ef4ceec4f4012c3eec063a22e90a07f2844ab90d82329bed3e645df8bd239a84346bc9c6a39f0f7fe659
|
7
|
+
data.tar.gz: ac222cd53b256fea99960dc1562aa81e9b1797824dacafdeb7c695474aeae3da6b60e4c4cd0a1bbd5ee7bbcc286ec8dbd38d565d9d3bcffa5630a8f1972fea5e
|
@@ -31,29 +31,15 @@ module Ecm
|
|
31
31
|
end
|
32
32
|
|
33
33
|
days_by_week = {}
|
34
|
-
|
35
|
-
|
36
|
-
(beginning_of_month..end_of_month).each_with_index do |day, index|
|
37
|
-
days_in_week[day] = elements.find_all { |e| e.send(options[:date_method]).to_date == day.to_date } || {}
|
38
|
-
|
39
|
-
if day.wday == last_day_of_week
|
40
|
-
(7 - days_in_week.size).times do |i|
|
41
|
-
days_in_week[0 - i] = {}
|
42
|
-
end
|
43
|
-
week = (day + 1.day).cweek
|
44
|
-
end
|
34
|
+
first_day = beginning_of_month.beginning_of_week
|
35
|
+
last_day = end_of_month.end_of_week
|
45
36
|
|
46
|
-
|
47
|
-
|
48
|
-
days_in_week = {}
|
49
|
-
end
|
50
|
-
|
51
|
-
if index == end_of_month.day - 1
|
52
|
-
(7 - days_in_week.size).times do |i|
|
53
|
-
days_in_week[days_in_week.size - i] = {}
|
54
|
-
end
|
55
|
-
end
|
37
|
+
days = (first_day..last_day).each_with_object({}).with_index do |(day, memo), index|
|
38
|
+
memo[day.to_date] = elements.find_all { |e| e.send(options[:date_method]).to_date == day.to_date } || {}
|
56
39
|
end
|
40
|
+
|
41
|
+
days_by_week = days.each_with_object({}) { |(k, v), m| (m[k.cweek] ||= {})[k] = v }
|
42
|
+
|
57
43
|
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 }
|
58
44
|
end
|
59
45
|
|
@@ -3,27 +3,23 @@
|
|
3
3
|
- localized_day_names.each do |day|
|
4
4
|
.column.calendar-weekday-name
|
5
5
|
%h1= day
|
6
|
+
|
6
7
|
- days_by_week.each do |week, days|
|
7
|
-
.flex-row
|
8
|
+
.flex-row{ class: "week-#{week}" }
|
8
9
|
- days_count = 0
|
9
|
-
- days.
|
10
|
-
-
|
11
|
-
- if day
|
12
|
-
|
13
|
-
-
|
14
|
-
|
15
|
-
-
|
16
|
-
|
17
|
-
|
18
|
-
.
|
19
|
-
%
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
= link_to(element.send(display_method), element)
|
26
|
-
- else
|
27
|
-
= element.send(display_method)
|
28
|
-
- (7 - days_count).times do
|
29
|
-
.column
|
10
|
+
- days.each do |day, elements|
|
11
|
+
- td_classes = ['calendar-day']
|
12
|
+
- td_classes << 'active today' if day == Time.zone.now.to_date
|
13
|
+
- td_classes << 'with-elements' if elements.any?
|
14
|
+
- td_classes << 'not-actual-month' if day.month != Time.zone.now.month
|
15
|
+
.column{ class: td_classes.join(" ") }
|
16
|
+
.calendar-day-container
|
17
|
+
%h1.calendar-day-title= day.day
|
18
|
+
%div.calendar-entries
|
19
|
+
- elements.each do |element|
|
20
|
+
%div.calendar-day-content
|
21
|
+
%span.calendar-item.calendar-item-default
|
22
|
+
- if link_elements
|
23
|
+
= link_to(element.send(display_method), element)
|
24
|
+
- else
|
25
|
+
= element.send(display_method)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecm_calendar_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Vasquez Angel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
82
82
|
version: '0'
|
83
83
|
requirements: []
|
84
84
|
rubyforge_project:
|
85
|
-
rubygems_version: 2.
|
85
|
+
rubygems_version: 2.6.11
|
86
86
|
signing_key:
|
87
87
|
specification_version: 4
|
88
88
|
summary: Rails calendar helper.
|