simple_calendar 1.1.4 → 1.1.5
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 +4 -4
- data/README.md +6 -0
- data/lib/simple_calendar/version.rb +1 -1
- data/lib/simple_calendar/week_calendar.rb +22 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7f7a64081a152d2de429dcccfa3fc41f87cf8653
|
|
4
|
+
data.tar.gz: 750684fef64d82960c570d366190e6641c0c96ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
|
@@ -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
|
+
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-
|
|
11
|
+
date: 2014-07-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|