carendar 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -0
- data/app/helpers/carendar/carendar.rb +0 -0
- data/app/helpers/carendar/carendar_helper +1 -0
- data/app/helpers/carendar/carendar_helper.rb +7 -0
- data/app/views/carendar/_carendar.html.erb +16 -0
- data/lib/carendar/version.rb +1 -1
- data/screenshot.jpg +0 -0
- metadata +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d470d2f36812c93ddcbb2f9a9618854e83515b42
|
4
|
+
data.tar.gz: c2b26a5d02a38aee6f21e68b7eb3eba83f4db270
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1bcb6b6255bdc80976b226f3ea2f89589aa17aafa1f0020676cc21c38b20425fb87e79e06555ef8bebcd35837e61870855f4bf2ab4f7efe102dbec9a598b90d2
|
7
|
+
data.tar.gz: a758e2fa0ae553200592ca12b997cef43ea065ec85e37c956b4e1eb3cdeaed98f7cc57bdc702290703f57410d0f4b7153da0e3ef06bb970f49244a564bfd9cd2
|
data/README.md
CHANGED
@@ -20,8 +20,46 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
+
|
24
|
+
First you have to create a `Calendar` object containing all calendar items.
|
25
|
+
|
23
26
|
Carendar::Calendar.new(first_day, last_day, array_of_item_hashes)
|
24
27
|
|
28
|
+
This can be constructed from a simple array of hashes, where each item is represented by hash with the keys
|
29
|
+
`starts_at`, ends_at, options`.
|
30
|
+
|
31
|
+
Styling is provided via sass mixin. You have to at least include the `carendar` mixin to get
|
32
|
+
the layout.
|
33
|
+
Custom styling is easily done by selecting the child classes of your calendar class.
|
34
|
+
|
35
|
+
|
36
|
+
@import 'carendar'
|
37
|
+
|
38
|
+
.carendar
|
39
|
+
+carendar(500px, 5)
|
40
|
+
.day
|
41
|
+
border-left: 1px solid #EEE
|
42
|
+
border-top: 1px solid #EEE
|
43
|
+
|
44
|
+
> div
|
45
|
+
background-color: #EEE
|
46
|
+
text-align: center
|
47
|
+
font-size: 10pt
|
48
|
+
color: #999
|
49
|
+
|
50
|
+
.item
|
51
|
+
border: 1px solid #DDD
|
52
|
+
background-color: #EEE
|
53
|
+
font-size: 8pt
|
54
|
+
z-index: 5
|
55
|
+
&:hover
|
56
|
+
z-index: 10
|
57
|
+
|
58
|
+
|
59
|
+
&.important
|
60
|
+
background-color: #FEE
|
61
|
+
|
62
|
+
|
25
63
|
Example:
|
26
64
|
|
27
65
|
r = Random.new
|
@@ -42,6 +80,14 @@ Example:
|
|
42
80
|
end
|
43
81
|
@calendar = Carendar::Calendar.new(DateTime.now.beginning_of_week, DateTime.now.end_of_week + 1.week, ungrouped_items)
|
44
82
|
|
83
|
+
Rendering in the template is called with the `carendar`-helper, with the previously constructed calendar object.
|
84
|
+
|
85
|
+
<%= carender(@calender) %>
|
86
|
+
|
87
|
+
## Screenshot
|
88
|
+
|
89
|
+
![screenshot of sample calendar rendering](https://raw.githubusercontent.com/axelerator/carendar/master/screenshot.jpg)
|
90
|
+
|
45
91
|
|
46
92
|
## Contributing
|
47
93
|
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
module Carendar
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<ol class="carendar week">
|
2
|
+
<%- calendar.days.each do |day| %>
|
3
|
+
<li class="day">
|
4
|
+
<div class="dayName"><%= l(day.day.to_date, format: :short) %> </div>
|
5
|
+
<ol class="items">
|
6
|
+
<%- day.items.each do |i| %>
|
7
|
+
<%= content_tag 'li', {data: {start: i.start_min , duration: i.duration, offset_left: i.offset_left, offset_right: i.offset_right}, class: ['item'] + Array.wrap(i.options[:class])} do %>
|
8
|
+
|
9
|
+
<div class="title"><%=i.options[:title]%></div>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
</ol>
|
13
|
+
</li>
|
14
|
+
<% end %>
|
15
|
+
</ol>
|
16
|
+
|
data/lib/carendar/version.rb
CHANGED
data/screenshot.jpg
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carendar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Axel Tetzlaff
|
@@ -52,9 +52,14 @@ files:
|
|
52
52
|
- README.md
|
53
53
|
- Rakefile
|
54
54
|
- app/assets/stylesheets/_carendar.sass
|
55
|
+
- app/helpers/carendar/carendar.rb
|
56
|
+
- app/helpers/carendar/carendar_helper
|
57
|
+
- app/helpers/carendar/carendar_helper.rb
|
58
|
+
- app/views/carendar/_carendar.html.erb
|
55
59
|
- carendar.gemspec
|
56
60
|
- lib/carendar.rb
|
57
61
|
- lib/carendar/version.rb
|
62
|
+
- screenshot.jpg
|
58
63
|
homepage: ''
|
59
64
|
licenses:
|
60
65
|
- MIT
|