cal_months_rails3 1.0.1 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 28754ba3ac4c756df88b1f26b7162237e656df31
4
- data.tar.gz: d19711faf88ad84aa2c59dcb46a14937f9ab6565
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NjJmZjUwYjgwNjU2YjBkYTc2M2JjNmQyNDkwOTUyMWE0NDhkYzhmNQ==
5
+ data.tar.gz: !binary |-
6
+ MjZiZWUxNjYyMDMwMjMxNjIyY2VhOGYxMGI5Yzk4YzI4NjM3YWZmNA==
5
7
  SHA512:
6
- metadata.gz: b3458225133f51c2fe63745e6577ff646bed3c40252080d64a1e8ef0a9fedcd4c4e22b17396a8edcf1bc9870b966517d9598e3c104edf92c224935cffe307f93
7
- data.tar.gz: ccd96a735b0ad0250f8df4438659ed4655e70f6637876e8af89a526776691de7840beea873b231f98ff4ae2fd364068f1ce5c18c47b30d419a49984951689dc2
8
+ metadata.gz: !binary |-
9
+ ZDFkMzU1NjZiYzMzNGMyMmIxNzAwMzY0MmI3YWJhYTk5M2IzMDlmYmY4Zjc2
10
+ YTdmZjhjODQ4YWZkNGYzNWMzMDU1OTExYWIzMDAwMWIyNGJiYmJmMjQxMjI5
11
+ ZDZkMzAxNWFhMmQyMzYyZjQzYjM1Zjg0OWIwODFjZGUxMjUyMGQ=
12
+ data.tar.gz: !binary |-
13
+ ZGY1YzNkZmMxYjc2NGMxZGQ1ZjQ0NDM0ZDU1MTYyOTU1NjJhYmQ1OTA5YjU3
14
+ ZDlmZTYwODMwNDRlZTc4YzhkYzQyMjZkN2MzNzFlZjlkN2M3M2ZhODRiMjJi
15
+ M2Q2N2VhN2E4OWE0MDQxNWE4YTgzODNkZTA3Y2JiZDNiYmE5NTI=
@@ -13,13 +13,13 @@ $calendar-width: 550px
13
13
  $calendar-height: $calendar-width * 375 / 550
14
14
 
15
15
  $day-size: $calendar-width / 2 / 10 * 8 / 7 - 4
16
- $date-size: $calendar-height * 56 / 100
16
+ $date-size: $calendar-height * 200 / 375
17
17
 
18
- $big-font-size: $calendar-height * 70 / 375
19
- $large-font-size: $calendar-height * 24 / 375
20
- $medium-font-size: $calendar-height * 20 / 375
21
- $normal-font-size: $calendar-height * 16 / 375
22
- $small-font-size: $calendar-height * 12 / 375
18
+ $big-font-size: $calendar-height * 70 / 375
19
+ $large-font-size: $calendar-height * 24 / 375
20
+ $medium-font-size: $calendar-height * 20 / 375
21
+ $normal-font-size: $calendar-height * 16 / 375
22
+ $small-font-size: $calendar-height * 12 / 375
23
23
 
24
24
  $large-vertical-padding: $calendar-height * 45 / 375
25
25
  $medium-vertical-padding: $calendar-height * 15 / 375
@@ -65,29 +65,38 @@ class CalMonth < ActiveRecord::Base
65
65
  events.delete_if { |event| event[:end_datetime] < Time.zone.now }
66
66
  end
67
67
 
68
+ def next_cal_month
69
+ CalMonth.fetch_month(*next_month_array)
70
+ end
71
+
72
+ def prev_cal_month
73
+ CalMonth.fetch_month(*prev_month_array)
74
+ end
68
75
 
69
76
  def to_a
70
77
  [year, month]
71
78
  end
72
79
 
73
80
  def next_month_array
74
- n_year = year
75
- n_month = month + 1
76
- if n_month == 13
77
- n_year += 1
78
- n_month = 1
79
- end
80
- [n_year, n_month]
81
+ next_month = to_date + 1.month
82
+ [next_month.year, next_month.month]
81
83
  end
82
84
 
83
85
  def prev_month_array
84
- n_year = year
85
- n_month = month - 1
86
- if n_month == 0
87
- n_year -= 1
88
- n_month = 12
89
- end
90
- [n_year, n_month]
86
+ prev_month = to_date - 1.month
87
+ [prev_month.year, prev_month.month]
88
+ end
89
+
90
+ def next_month_key
91
+ key_from_array(next_month_array)
92
+ end
93
+
94
+ def prev_month_key
95
+ key_from_array(prev_month_array)
96
+ end
97
+
98
+ def key
99
+ key_from_array(to_a)
91
100
  end
92
101
 
93
102
  def to_date
@@ -168,4 +177,9 @@ class CalMonth < ActiveRecord::Base
168
177
  errors[:base] << "Unique month required. If you are reading this, there is a bug in the creation or updating of CalMonth models."
169
178
  end
170
179
  end
180
+
181
+ def key_from_array(array)
182
+ app_name = Rails.application.class.to_s.split('::').first
183
+ "_#{app_name}_month_#{array.join('_')}"
184
+ end
171
185
  end
data/cal_months.gemspec CHANGED
@@ -7,7 +7,7 @@ files.push('LICENSE')
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = 'cal_months_rails3'
10
- s.version = '1.0.1'
10
+ s.version = '1.1.1'
11
11
  s.date = "#{Time.now.strftime("%Y-%m-%d")}"
12
12
  s.homepage = 'https://github.com/jphager2/cal_months'
13
13
  s.summary = 'icalendar integration'
Binary file
Binary file
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cal_months_rails3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - jphager2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: icalendar
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.2'
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
26
  version: '2.2'
27
27
  description: A nice extension for quickly incorporating icalendar imports with default
@@ -46,6 +46,8 @@ files:
46
46
  - app/views/cal_months/show_current_event.js.erb
47
47
  - cal_months-1.0.0.gem
48
48
  - cal_months.gemspec
49
+ - cal_months_rails3-1.0.1.gem
50
+ - cal_months_rails3-1.1.0.gem
49
51
  - config/locales/cal_months_cs.yml
50
52
  - config/locales/cal_months_en.yml
51
53
  - db/migrate/create_cal_events.rb
@@ -62,17 +64,17 @@ require_paths:
62
64
  - lib
63
65
  required_ruby_version: !ruby/object:Gem::Requirement
64
66
  requirements:
65
- - - ">="
67
+ - - ! '>='
66
68
  - !ruby/object:Gem::Version
67
69
  version: '0'
68
70
  required_rubygems_version: !ruby/object:Gem::Requirement
69
71
  requirements:
70
- - - ">="
72
+ - - ! '>='
71
73
  - !ruby/object:Gem::Version
72
74
  version: '0'
73
75
  requirements: []
74
76
  rubyforge_project:
75
- rubygems_version: 2.2.2
77
+ rubygems_version: 2.4.3
76
78
  signing_key:
77
79
  specification_version: 4
78
80
  summary: icalendar integration