simple_calendar 2.2.5 → 2.2.6

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,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b59a6e0877e1ff3b71901bc01ba95dc961d03313
4
- data.tar.gz: c2e415e9f1a24e92f970d50cc6119e8becd37615
3
+ metadata.gz: d48c34ef8c59455fb303e967c9974f5fe8f8cd8e
4
+ data.tar.gz: ddb4c3b79eed4ce5c40b699720e81e7008f1e4f5
5
5
  SHA512:
6
- metadata.gz: 1baea65b91560b3d247c717dccc9daac1d789a214b7df9db56adb94d9d68877dfaf66e3e8f2023c7db92b93b443c594f0b7be7cdc6cf378f2276b983989a33e6
7
- data.tar.gz: 410701770d8ff9cc6f66132037f37a79e34dc61afc420049fc333f448cfe2ec37a06c3ba71994f893da14d3e3ea589bd300edd6386f6081a30f03e765b8f1857
6
+ metadata.gz: f62df456ab1f6cd88d39c47ca837da47e5fdc8e25c5ec3c509fa31181bc60a4fd8eb361debadd006b97bf98a891af7bf2734383a4e032994fd7d24c6eae6d30d
7
+ data.tar.gz: 10dfbc74095af375642fcda64b032f153d3284257bd71531bb0c3c73a0b13da819fc2a857318e89cf4cb5afd195fa3ae0703cf147abb9e26caf9647d921eff3d
data/README.md CHANGED
@@ -45,6 +45,8 @@ method.
45
45
  <% end %>
46
46
  ```
47
47
 
48
+ To show the day of the month instead of the date, use `<%= date.day %>`
49
+
48
50
  ### Week Calendar
49
51
 
50
52
  You can generate a week calendar with the `week_calendar` method.
@@ -110,17 +112,26 @@ $ rails g scaffold Meeting name start_time:datetime
110
112
  $ rails g scaffold Meeting name start_time:datetime end_time:datetime
111
113
  ```
112
114
 
113
- By default it uses `start_time` as the attribute name. Optionally the `end_time`
114
- attribute can be used which enables multi-day event rendering.
115
-
116
- **If you'd like to use another attribute other than start_time or end_time, just
117
- pass it in as the `attribute` or `end_attribute` options respectively**
115
+ By default it uses `start_time` as the attribute name.
116
+ **If you'd like to use another attribute other than start_time, just
117
+ pass it in as the `attribute`**
118
118
 
119
119
  ```erb
120
120
  <%= month_calendar(attribute: :starts_at) do |date| %>
121
121
  <%= date %>
122
122
  <% end %>
123
123
  ```
124
+
125
+ Optionally the `end_time` attribute can be used which enables multi-day event rendering.
126
+
127
+ **Just pass in the `attribute` and `end_attribute` options respectively**
128
+
129
+ ```erb
130
+ <%= month_calendar(attribute: :start_date, end_attribute: :end_date) do |date| %>
131
+ <%= date %>
132
+ <% end %>
133
+ ```
134
+
124
135
  **If you already have a model with a start time attribute called something other than `start_time` or accesses it through a relationship, you can alias the attribute by defining a `start_time` method in the my_model.rb file and not have to specify it separately as in the above example**
125
136
  ```ruby
126
137
  class MyModel
@@ -319,7 +330,7 @@ The main method you'll need to implement is the `date_range` so that
319
330
  your calendar can have a custom length.
320
331
 
321
332
  ```ruby
322
- class SimpleCalendar::BusinessWeekCalendar
333
+ class SimpleCalendar::BusinessWeekCalendar < SimpleCalendar::Calendar
323
334
  private
324
335
 
325
336
  def date_range
@@ -333,7 +344,7 @@ end
333
344
  To render this in the view, you can do:
334
345
 
335
346
  ```erb
336
- <%= SimpleCalendar::BusinessWeekCalendar.new(self).render do |date| %>
347
+ <%= SimpleCalendar::BusinessWeekCalendar.new(self, {}).render do |date| %>
337
348
  <%= date %>
338
349
  <% end %>
339
350
  ```
@@ -10,9 +10,13 @@ module SimpleCalendar
10
10
  @view_context = view_context
11
11
  @options = opts
12
12
 
13
+ # Next and previous view links should use the same params as the current view
13
14
  @params = @view_context.respond_to?(:params) ? @view_context.params : Hash.new
14
15
  @params = @params.to_unsafe_h if @params.respond_to?(:to_unsafe_h)
15
16
  @params = @params.with_indifferent_access.except(*PARAM_KEY_BLACKLIST)
17
+
18
+ # Add in any additonal params the user passed in
19
+ @params.merge!(@options.fetch(:params, {}))
16
20
  end
17
21
 
18
22
  def render(&block)
@@ -1,3 +1,3 @@
1
1
  module SimpleCalendar
2
- VERSION = "2.2.5"
2
+ VERSION = "2.2.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-06 00:00:00.000000000 Z
11
+ date: 2017-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails