simple_calendar 1.1.4 → 1.1.5

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: 79b8594840b9e18fdf52c8c4fb78cc9010be8e38
4
- data.tar.gz: ded158c9f803340a257b9ea3a00702d8dd0b4f55
3
+ metadata.gz: 7f7a64081a152d2de429dcccfa3fc41f87cf8653
4
+ data.tar.gz: 750684fef64d82960c570d366190e6641c0c96ce
5
5
  SHA512:
6
- metadata.gz: 25a41a24e87bc41f7cbb68297b64a57b17e8267ba15b5b5cd36b4ea2b37a1b7997d7c6f08575c1d7c8ca563bd8703b5769ca0891d300031d927bd36ea7607c74
7
- data.tar.gz: 0728743caa642b7a3d057ce182bcf86e49410e56d17624683bc03642a44b6c74f91bc98dc072603cbf2eafb4f9e35e622c5ded6a5471f2c7aac7a36799213597
6
+ metadata.gz: b0a9596ed759fb06e21f9f5ce0614e8d446533869f034873b0328ab111df54aa28d820b9a127ac30bbc4576503a1c833a4e18b08641b81335fe312f0b1b3811b
7
+ data.tar.gz: 60c46c14dc99e633a591e2a54062b3bb2c6c72dc1af6bafa2f172723234f9744407498e88b13faa98a716aa17be972957efd8ff554d72037c8574afcd167a6fa
data/README.md CHANGED
@@ -72,6 +72,12 @@ creating calendars with events.
72
72
  The first step is to add the following to your model. We'll be using a
73
73
  model called Event, but you can add this to any model or Ruby object.
74
74
 
75
+ Here's an example model:
76
+
77
+ ```bash
78
+ rails g scaffold Event name starts_at:datetime
79
+ ```
80
+
75
81
  We use the `has_calendar` method to tell simple_calendar how to filter
76
82
  and sort the events on the different calendar days. This should be the
77
83
  start date/time of your event. By default it uses `starts_at` as the
@@ -1,3 +1,3 @@
1
1
  module SimpleCalendar
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
@@ -10,6 +10,20 @@ module SimpleCalendar
10
10
  end
11
11
  end
12
12
 
13
+ def default_title
14
+ ->(start_date) { content_tag :span,
15
+ if month_name(@date_range.last) == month_name(start_date)
16
+ month_name(start_date) .
17
+ concat year_number(start_date)
18
+ else
19
+ month_name(start_date) .
20
+ concat " into " .
21
+ concat month_name(@date_range.last) .
22
+ concat year_number @date_range.last
23
+ end
24
+ }
25
+ end
26
+
13
27
  def default_previous_link
14
28
  ->(param, date_range) { link_to raw("«"), param => date_range.first - (((options.fetch(:number_of_weeks, 1) - 1) * 7) + 1).days }
15
29
  end
@@ -17,6 +31,14 @@ module SimpleCalendar
17
31
  def default_next_link
18
32
  ->(param, date_range) { link_to raw("»"), param => date_range.last + 1.day }
19
33
  end
34
+
35
+ def month_name(date)
36
+ "#{I18n.t("date.month_names")[date.month]}"
37
+ end
38
+
39
+ def year_number(date)
40
+ " #{date.year}"
41
+ end
20
42
  end
21
43
  end
22
44
 
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: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Oliver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-03 00:00:00.000000000 Z
11
+ date: 2014-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails