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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e642f680ea5441076624a829e2e672a1cbb57f8b2ffffcf161dd658ae8b5b17c
4
- data.tar.gz: 39caf7b4c9a72da1e11e8b21c12fb2fd8c7928ef86d18a572afaa6a0d9709d0c
3
+ metadata.gz: b981b7c9ef328bf21adf9ced3ea7f53cdacdbd70ee70006f66e01fd676634d14
4
+ data.tar.gz: d9b6a5bcc147cd5155766a42e647654013c6c81c6bfdcdf1b1e4f3360659a0d5
5
5
  SHA512:
6
- metadata.gz: ae67297856bc7d27e71ab6740c9b73b7e033d24a5cd7f3b5d9d3f4cc032fa0e7f36f1b5f63375529aa954af4f6a34be0385cbdf5d2d8abeabfe997aaff44bbf2
7
- data.tar.gz: 05126f7fe63a2027f731f56138bffd965aebf46e0943da182b2d35cb337f6df860a0e097bc1293522ce4256706ae429fd944071aa0543516ed16641ca7ecba26
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.6.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.3.0)
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 (:vertical, :horizontal, default: :vertical)
76
- - horizontal_height_px default: 300
77
- - split_by_type (model function to call in case of bucketung f.ex.`:event_type`, default: false)
78
- - px_per_minute default: 0.65
79
- - display_bucket_title (model function to call in case of bucketung f.ex.`:event_type_name`, default: false)
80
- - bucket_title_size default: 20
81
- - grid_width default: 20px
82
- - display_grid default: true
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="z-index:20;width:<%=events_size[event][0]%>%;top:<%=events_size[event][3]%>px;left:<%=events_size[event][1]%>%;height:<%=events_size[event][2]%>px">
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)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SimpleCalendar
4
4
  module Timeslot
5
- VERSION = "0.6.0"
5
+ VERSION = "0.7.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_calendar-timeslot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kim Laplume