calendrier 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,6 +25,8 @@ module Calendrier
25
25
  def render(header, content)
26
26
  display = @options[:display]
27
27
  title = @options[:title] || ''
28
+ cell_date_format = @options[:cell_date_format] || (display == :month ? '%A' : :default)
29
+ time_slot_title = @options[:time_slot_title] || ''
28
30
 
29
31
  @context.content_tag(:div, nil, :class => "calendar #{display.to_s}") do
30
32
  cal = @context.content_tag(:span, title)
@@ -32,13 +34,14 @@ module Calendrier
32
34
 
33
35
  unless header.nil?
34
36
  thead = @context.content_tag(:thead, nil) do
35
- ths = "".html_safe
36
- ths << @context.content_tag(:th, 'Horaires') if display == :week
37
- header.each do |cell_date|
38
- ths << @context.content_tag(:th, I18n.l(cell_date)) if display == :week
39
- ths << @context.content_tag(:th, I18n.l(cell_date, :format => '%A')) if display == :month
37
+ @context.content_tag(:tr, nil) do
38
+ ths = "".html_safe
39
+ ths << @context.content_tag(:th, time_slot_title) if display == :week
40
+ header.each do |cell_date|
41
+ ths << @context.content_tag(:th, I18n.l(cell_date, :format => cell_date_format))
42
+ end
43
+ ths
40
44
  end
41
- ths
42
45
  end
43
46
  end
44
47
 
@@ -48,7 +51,7 @@ module Calendrier
48
51
  content.each_with_index do |row, index|
49
52
  trs << @context.content_tag(:tr, nil) do
50
53
  tds = "".html_safe
51
- tds << @context.content_tag(:td, index) if display == :week
54
+ tds << @context.content_tag(:td, "#{index}h") if display == :week
52
55
  row.collect do |cell|
53
56
  cell_content = "".html_safe
54
57
  cell_time = cell[:time]
@@ -11,6 +11,12 @@ module Calendrier
11
11
  sorted_events_do(events_by_date, cell_begin_time, cell_end_time) { |event| yield event }
12
12
  end
13
13
 
14
+ def get_cell_sorted_events(events_by_date, cell_begin_time, cell_end_time)
15
+ events = []
16
+ sorted_events_do(events_by_date, cell_begin_time, cell_end_time) { |event| events << event }
17
+ events
18
+ end
19
+
14
20
  protected
15
21
 
16
22
  def sorted_events_do(events_by_date, cell_begin_time, cell_end_time, &block)
@@ -1,3 +1,3 @@
1
1
  module Calendrier
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -19,7 +19,7 @@ describe Calendrier::CalendrierBuilder do
19
19
  # preparing array for the week of the 25th of may 2012
20
20
  @days_of_may_weekly = []
21
21
  24.times do |hour_idx|
22
- @days_of_may_weekly << (hour_idx).to_s
22
+ @days_of_may_weekly << "#{(hour_idx).to_s}h"
23
23
  7.times do |day_idx|
24
24
  @days_of_may_weekly << ''
25
25
  end
@@ -81,7 +81,7 @@ describe Calendrier::CalendrierBuilder do
81
81
  html_doc = Nokogiri::HTML(cal.html_safe)
82
82
  calendar_lines = html_doc.css('div.calendar tr')
83
83
  calendar_lines_count = html_doc.css('div.calendar tr').count
84
- calendar_lines_count.must_equal 5
84
+ calendar_lines_count.must_equal 6
85
85
  end
86
86
 
87
87
  it "should have the right amount of columns for monthly calendar" do
@@ -109,7 +109,7 @@ describe Calendrier::CalendrierBuilder do
109
109
  cal = generate_calendar(:week)
110
110
  html_doc = Nokogiri::HTML(cal.html_safe)
111
111
  calendar_lines_count = html_doc.css('div.calendar tr').count
112
- calendar_lines_count.must_equal 24
112
+ calendar_lines_count.must_equal 25
113
113
  end
114
114
 
115
115
  it "should have the right amount of columns for monthly calendar" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calendrier
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: