simple_calendar-timeslot 0.6.0 → 0.7.0
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/CHANGELOG.md +7 -0
- data/Gemfile.lock +2 -2
- data/README.md +10 -8
- data/app/assets/stylesheets/simple_calendar-timeslot.css +3 -1
- data/app/views/simple_calendar/timeslot/_timeslot_calendar.html.erb +7 -1
- data/lib/simple_calendar/timeslot/timeslot_calendar.rb +11 -0
- data/lib/simple_calendar/timeslot/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b981b7c9ef328bf21adf9ced3ea7f53cdacdbd70ee70006f66e01fd676634d14
|
4
|
+
data.tar.gz: d9b6a5bcc147cd5155766a42e647654013c6c81c6bfdcdf1b1e4f3360659a0d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87c70e2c3cca879480f6ed87e7ce5d1adbcd2095e17aad0e30fdf3b1dea00a1b1461d676c81c2108010af619c488b9bbb067ab53f43678a63a584fbfb4220546
|
7
|
+
data.tar.gz: fe7d528e2b333e7ecbae96626aeb74ca4e0d58c857c5fdb1ec1101535dc0a6f54d7cb3c9d37ecc825d130266bbc8bd35ac49d4bb631cf7ebd85a9d34556b6a8e
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.7.0] - 2021-11-15
|
4
|
+
### Added
|
5
|
+
- new option to display a current time indicator line (based on Time.zone.now), that is invisible unless styled, the css-class is
|
6
|
+
`current_time_indicator`
|
7
|
+
### Fixed
|
8
|
+
- minor z-index inconsistencies for event rendering
|
9
|
+
|
3
10
|
## [0.6.0] - 2021-11-15
|
4
11
|
### Added
|
5
12
|
- Added option horizontal_scroll_split to view helper, which defaults to false. This option affects
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
simple_calendar-timeslot (0.
|
4
|
+
simple_calendar-timeslot (0.7.0)
|
5
5
|
simple_calendar (~> 2.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -159,7 +159,7 @@ GEM
|
|
159
159
|
sprockets (4.0.2)
|
160
160
|
concurrent-ruby (~> 1.0)
|
161
161
|
rack (> 1, < 3)
|
162
|
-
sprockets-rails (3.
|
162
|
+
sprockets-rails (3.4.0)
|
163
163
|
actionpack (>= 5.2)
|
164
164
|
activesupport (>= 5.2)
|
165
165
|
sprockets (>= 3.0.0)
|
data/README.md
CHANGED
@@ -72,14 +72,16 @@ as `attribute: :my_start_time` and `end_attribute: :my_end_time`.
|
|
72
72
|
```
|
73
73
|
|
74
74
|
Shortversion in the meantime:
|
75
|
-
- orientation (
|
76
|
-
-
|
77
|
-
-
|
78
|
-
-
|
79
|
-
-
|
80
|
-
-
|
81
|
-
-
|
82
|
-
-
|
75
|
+
- `orientation` (`:vertical`, `:horizontal`, default: :vertical)
|
76
|
+
- `px_per_minute` (defines size of calendar, default: 0.65)
|
77
|
+
- `horizontal_height_px` default: 300
|
78
|
+
- `horizonzal_scroll_split` (scroll days separately or together, default: false)
|
79
|
+
- `split_by_type` (model function to call in case of bucketing f.ex.`:event_type`, default: false)
|
80
|
+
- `display_bucket_title` (model function to call in case of bucketing f.ex.`:event_type_name`, default: false)
|
81
|
+
- `bucket_title_size` default: 20
|
82
|
+
- `grid_width` default: 20px
|
83
|
+
- `display_grid` default: true
|
84
|
+
- `current_time_indicator` (display a stylable div across the timeline that display the current time, css-class: `current_time_indicator`, default: false)
|
83
85
|
|
84
86
|
## Development
|
85
87
|
|
@@ -33,7 +33,6 @@
|
|
33
33
|
.timeslot-calendar .day-content-horizontal-inner {
|
34
34
|
position: relative;
|
35
35
|
}
|
36
|
-
|
37
36
|
.timeslot-calendar .hour-indicator-col-vertical {
|
38
37
|
display: flex;
|
39
38
|
flex: 1 1 0;
|
@@ -93,6 +92,9 @@
|
|
93
92
|
z-index: 1;
|
94
93
|
box-sizing: border-box;
|
95
94
|
}
|
95
|
+
.timeslot-calendar .current_time_indicator {
|
96
|
+
position: absolute;
|
97
|
+
}
|
96
98
|
/*--- Event example style ----*/
|
97
99
|
.timeslot-event {
|
98
100
|
width: 100%;
|
@@ -31,6 +31,9 @@
|
|
31
31
|
<% end %>
|
32
32
|
</div>
|
33
33
|
<% end %>
|
34
|
+
<% if calendar.display_current_time_indicator %>
|
35
|
+
<div class="current_time_indicator" style="top:<%=calendar.current_time_offset %>px;left:0;right:0;height:0;"></div>
|
36
|
+
<% end %>
|
34
37
|
<% events = sorted_events.fetch(day, []) %>
|
35
38
|
<% buckets = calendar.split_into_buckets(events) %>
|
36
39
|
<div class="buckets-wrapper" style="left:<%=calendar.grid_width%>;right:0">
|
@@ -46,7 +49,7 @@
|
|
46
49
|
<div class="events-wrapper">
|
47
50
|
<% events_size = calendar.slot_events(bucket, day) %>
|
48
51
|
<% bucket.each do |event| %>
|
49
|
-
<div class="event-wrapper" style="
|
52
|
+
<div class="event-wrapper" style="width:<%=events_size[event][0]%>%;top:<%=events_size[event][3]%>px;left:<%=events_size[event][1]%>%;height:<%=events_size[event][2]%>px">
|
50
53
|
<% if defined?(Haml) && respond_to?(:block_is_haml?) && block_is_haml?(passed_block) %>
|
51
54
|
<% capture_haml(event, &passed_block) %>
|
52
55
|
<% else %>
|
@@ -94,6 +97,9 @@
|
|
94
97
|
<% end %>
|
95
98
|
</div>
|
96
99
|
<% end %>
|
100
|
+
<% if calendar.display_current_time_indicator && !calendar.horizontal_scroll_split %>
|
101
|
+
<div class="current_time_indicator" style="left:<%=calendar.current_time_offset %>px;top:0;bottom:0;width:0;"></div>
|
102
|
+
<% end %>
|
97
103
|
<% events = sorted_events.fetch(day, []) %>
|
98
104
|
<% buckets = calendar.split_into_buckets(events) %>
|
99
105
|
<div class="buckets-wrapper" style="top:<%=calendar.grid_width%>;bottom:0">
|
@@ -54,6 +54,10 @@ module SimpleCalendar
|
|
54
54
|
@options.fetch(:horizontal_scroll_split, false)
|
55
55
|
end
|
56
56
|
|
57
|
+
def display_current_time_indicator
|
58
|
+
@options.fetch(:display_current_time_indicator, false)
|
59
|
+
end
|
60
|
+
|
57
61
|
def height
|
58
62
|
#h = (24 - TimeslotCalendar::FIRST_HOUR_SLOT) * 60 * px_per_minute
|
59
63
|
h = 24 * 60 * px_per_minute
|
@@ -123,6 +127,13 @@ module SimpleCalendar
|
|
123
127
|
r
|
124
128
|
end
|
125
129
|
|
130
|
+
def current_time_offset
|
131
|
+
now = Time.zone.now
|
132
|
+
offset = (now.hour * 60 + now.min) * px_per_minute
|
133
|
+
offset = offset + bucket_title_size if display_bucket_title
|
134
|
+
offset
|
135
|
+
end
|
136
|
+
|
126
137
|
private
|
127
138
|
|
128
139
|
def pack_events(r, columns)
|