Commit c67611254034f27809fc8a7637a4b6b87bca3fc4
Committed by
Antonio Terceiro
1 parent
44ccfb3f
Exists in
master
and in
29 other branches
More improvements to agenda
- Button to create new event - Displaying header and footer even without side boxes - Display links to events in bold - Fixing previous and next month boxes on IE - Display environment name in header of global agenda (ActionItem1255)
Showing
6 changed files
with
95 additions
and
14 deletions
Show diff stats
app/helpers/boxes_helper.rb
@@ -4,11 +4,13 @@ module BoxesHelper | @@ -4,11 +4,13 @@ module BoxesHelper | ||
4 | if @controller.send(:boxes_editor?) && @controller.send(:uses_design_blocks?) | 4 | if @controller.send(:boxes_editor?) && @controller.send(:uses_design_blocks?) |
5 | content + display_boxes_editor(@controller.boxes_holder) | 5 | content + display_boxes_editor(@controller.boxes_holder) |
6 | else | 6 | else |
7 | + maybe_display_custom_element(@controller.boxes_holder, :custom_header_expanded, :id => 'profile-header') + | ||
7 | if @controller.send(:uses_design_blocks?) | 8 | if @controller.send(:uses_design_blocks?) |
8 | display_boxes(@controller.boxes_holder, content) | 9 | display_boxes(@controller.boxes_holder, content) |
9 | else | 10 | else |
10 | content_tag('div', content, :class => 'no-boxes') | 11 | content_tag('div', content, :class => 'no-boxes') |
11 | - end | 12 | + end + |
13 | + maybe_display_custom_element(@controller.boxes_holder, :custom_footer_expanded, :id => 'profile-footer') | ||
12 | end | 14 | end |
13 | end | 15 | end |
14 | 16 | ||
@@ -35,9 +37,7 @@ module BoxesHelper | @@ -35,9 +37,7 @@ module BoxesHelper | ||
35 | content = boxes.reverse.map { |item| display_box(item, main_content) }.join("\n") | 37 | content = boxes.reverse.map { |item| display_box(item, main_content) }.join("\n") |
36 | content = main_content if (content.blank?) | 38 | content = main_content if (content.blank?) |
37 | 39 | ||
38 | - maybe_display_custom_element(holder, :custom_header_expanded, :id => 'profile-header') + | ||
39 | - content_tag('div', content, :class => 'boxes', :id => 'boxes' ) + | ||
40 | - maybe_display_custom_element(holder, :custom_footer_expanded, :id => 'profile-footer') | 40 | + content_tag('div', content, :class => 'boxes', :id => 'boxes' ) |
41 | end | 41 | end |
42 | 42 | ||
43 | def maybe_display_custom_element(holder, element, options = {}) | 43 | def maybe_display_custom_element(holder, element, options = {}) |
app/views/events/events.rhtml
1 | -<%= button :back, _('Back to %s') % profile.name, profile.public_profile_url %> | ||
2 | - | ||
3 | -<h1><%= _("%s's events") % profile.name %></h1> | 1 | +<h1> |
2 | + <div id='toolbar'> | ||
3 | + <%= button :back, _('Back to %s') % profile.name, profile.public_profile_url %> | ||
4 | + <% if user && user.has_permission?('post_content', profile) %> | ||
5 | + <%= button :new, _('New event'), myprofile_url(:controller => 'cms', :action => 'new', :type => 'Event') %> | ||
6 | + <% end %> | ||
7 | + </div> | ||
8 | + <%= _("%s's events") % profile.name %> | ||
9 | +</h1> | ||
4 | 10 | ||
5 | <%= render :partial => 'agenda' %> | 11 | <%= render :partial => 'agenda' %> |
app/views/search/events.rhtml
features/events.feature
@@ -149,3 +149,24 @@ Feature: events | @@ -149,3 +149,24 @@ Feature: events | ||
149 | Scenario: warn when there is no events | 149 | Scenario: warn when there is no events |
150 | When I am on /profile/josesilva/events/2020/12/1 | 150 | When I am on /profile/josesilva/events/2020/12/1 |
151 | Then I should see "No events for this date" | 151 | Then I should see "No events for this date" |
152 | + | ||
153 | + Scenario: provide button to create new event | ||
154 | + Given I am logged in as "josesilva" | ||
155 | + When I am on /profile/josesilva/events/2020/12/1 | ||
156 | + Then I should see "New event" link | ||
157 | + | ||
158 | + Scenario: not provide button to create new event if I am not logged | ||
159 | + When I am on /profile/josesilva/events/2020/12/1 | ||
160 | + Then I should not see "New event" link | ||
161 | + | ||
162 | + Scenario: not provide button to create new event if I haven't permission | ||
163 | + Given the following users | ||
164 | + | login | | ||
165 | + | fudencio | | ||
166 | + Given I am logged in as "josesilva" | ||
167 | + When I am on /profile/fudencio/events/2020/12/1 | ||
168 | + Then I should not see "New events" link | ||
169 | + | ||
170 | + Scenario: display environment name in global agenda | ||
171 | + When I am on /assets/events | ||
172 | + Then I should see "Colivre.net's events" |
public/stylesheets/controller_events.css
@@ -28,6 +28,9 @@ | @@ -28,6 +28,9 @@ | ||
28 | #agenda .agenda-calendar .calendar-day-out span { | 28 | #agenda .agenda-calendar .calendar-day-out span { |
29 | display: none; | 29 | display: none; |
30 | } | 30 | } |
31 | +#agenda .agenda-calendar .calendar-day a { | ||
32 | + font-weight: bold; | ||
33 | +} | ||
31 | #agenda .agenda-calendar td { | 34 | #agenda .agenda-calendar td { |
32 | text-align: center; | 35 | text-align: center; |
33 | padding: 0px; | 36 | padding: 0px; |
@@ -44,15 +47,27 @@ | @@ -44,15 +47,27 @@ | ||
44 | float: left; | 47 | float: left; |
45 | width: 50%; | 48 | width: 50%; |
46 | } | 49 | } |
50 | +.msie #agenda .agenda-calendar .previous-month, | ||
51 | +.msie #agenda .agenda-calendar .next-month { | ||
52 | + width: 49%; | ||
53 | +} | ||
47 | #agenda .agenda-calendar .previous-month { | 54 | #agenda .agenda-calendar .previous-month { |
48 | } | 55 | } |
49 | #agenda .agenda-calendar .next-month { | 56 | #agenda .agenda-calendar .next-month { |
50 | border-left: 1px solid #BFC2BC; | 57 | border-left: 1px solid #BFC2BC; |
51 | } | 58 | } |
52 | #agenda .selected { | 59 | #agenda .selected { |
53 | - background: #ff9; | 60 | + background: gray; |
61 | + font-weight: bold; | ||
54 | font-style: normal; | 62 | font-style: normal; |
55 | } | 63 | } |
64 | +#agenda .selected a, | ||
65 | +#agenda .selected span { | ||
66 | + color: white; | ||
67 | +} | ||
68 | +#agenda .calendar-day-out.selected { | ||
69 | + background: none; | ||
70 | +} | ||
56 | #agenda td { | 71 | #agenda td { |
57 | vertical-align: middle; | 72 | vertical-align: middle; |
58 | } | 73 | } |
@@ -78,11 +93,19 @@ | @@ -78,11 +93,19 @@ | ||
78 | height: 90%; | 93 | height: 90%; |
79 | } | 94 | } |
80 | 95 | ||
81 | -body.noosfero #content .no-boxes a.button.icon-back { | ||
82 | - float: left; | 96 | +#content .no-boxes h1 #toolbar { |
83 | position: absolute; | 97 | position: absolute; |
98 | + left: 0; | ||
99 | + font-variant: normal; | ||
100 | + font-weight: normal; | ||
101 | +} | ||
102 | +#content .no-boxes h1 { | ||
103 | + position: relative; | ||
104 | +} | ||
105 | + | ||
106 | +#content .no-boxes h1 #toolbar a.button { | ||
84 | border: none; | 107 | border: none; |
85 | - opacity: 0.5; | 108 | + opacity: 0.6; |
86 | } | 109 | } |
87 | 110 | ||
88 | #agenda #events-of-the-day .select-a-day { | 111 | #agenda #events-of-the-day .select-a-day { |
test/unit/boxes_helper_test.rb
@@ -5,13 +5,20 @@ class BoxesHelperTest < Test::Unit::TestCase | @@ -5,13 +5,20 @@ class BoxesHelperTest < Test::Unit::TestCase | ||
5 | include BoxesHelper | 5 | include BoxesHelper |
6 | include ActionView::Helpers::TagHelper | 6 | include ActionView::Helpers::TagHelper |
7 | 7 | ||
8 | + def setup | ||
9 | + @controller = mock | ||
10 | + @controller.stubs(:boxes_editor?).returns(false) | ||
11 | + @controller.stubs(:uses_design_blocks?).returns(true) | ||
12 | + end | ||
13 | + | ||
8 | should 'include profile-specific header' do | 14 | should 'include profile-specific header' do |
9 | holder = mock | 15 | holder = mock |
10 | holder.stubs(:boxes).returns([]) | 16 | holder.stubs(:boxes).returns([]) |
11 | holder.stubs(:boxes_limit).returns(0) | 17 | holder.stubs(:boxes_limit).returns(0) |
12 | holder.stubs(:custom_header_expanded).returns('my custom header') | 18 | holder.stubs(:custom_header_expanded).returns('my custom header') |
19 | + @controller.stubs(:boxes_holder).returns(holder) | ||
13 | 20 | ||
14 | - assert_tag_in_string display_boxes(holder, 'main content'), :tag => "div", :attributes => { :id => 'profile-header' }, :content => 'my custom header' | 21 | + assert_tag_in_string insert_boxes('main content'), :tag => "div", :attributes => { :id => 'profile-header' }, :content => 'my custom header' |
15 | end | 22 | end |
16 | 23 | ||
17 | should 'include profile-specific footer' do | 24 | should 'include profile-specific footer' do |
@@ -19,8 +26,9 @@ class BoxesHelperTest < Test::Unit::TestCase | @@ -19,8 +26,9 @@ class BoxesHelperTest < Test::Unit::TestCase | ||
19 | holder.stubs(:boxes).returns([]) | 26 | holder.stubs(:boxes).returns([]) |
20 | holder.stubs(:boxes_limit).returns(0) | 27 | holder.stubs(:boxes_limit).returns(0) |
21 | holder.stubs(:custom_footer_expanded).returns('my custom footer') | 28 | holder.stubs(:custom_footer_expanded).returns('my custom footer') |
29 | + @controller.stubs(:boxes_holder).returns(holder) | ||
22 | 30 | ||
23 | - assert_tag_in_string display_boxes(holder, 'main content'), :tag => "div", :attributes => { :id => 'profile-footer' }, :content => 'my custom footer' | 31 | + assert_tag_in_string insert_boxes('main content'), :tag => "div", :attributes => { :id => 'profile-footer' }, :content => 'my custom footer' |
24 | end | 32 | end |
25 | 33 | ||
26 | def create_user_with_blocks | 34 | def create_user_with_blocks |
@@ -55,4 +63,26 @@ class BoxesHelperTest < Test::Unit::TestCase | @@ -55,4 +63,26 @@ class BoxesHelperTest < Test::Unit::TestCase | ||
55 | display_box_content(box, '') | 63 | display_box_content(box, '') |
56 | end | 64 | end |
57 | 65 | ||
66 | + should 'include profile-specific header without side boxes' do | ||
67 | + @controller.stubs(:uses_design_blocks?).returns(false) | ||
68 | + holder = mock | ||
69 | + holder.stubs(:boxes).returns([]) | ||
70 | + holder.stubs(:boxes_limit).returns(0) | ||
71 | + holder.stubs(:custom_header_expanded).returns('my custom header') | ||
72 | + @controller.stubs(:boxes_holder).returns(holder) | ||
73 | + | ||
74 | + assert_tag_in_string insert_boxes('main content'), :tag => "div", :attributes => { :id => 'profile-header' }, :content => 'my custom header' | ||
75 | + end | ||
76 | + | ||
77 | + should 'include profile-specific footer without side boxes' do | ||
78 | + @controller.stubs(:uses_design_blocks?).returns(false) | ||
79 | + holder = mock | ||
80 | + holder.stubs(:boxes).returns([]) | ||
81 | + holder.stubs(:boxes_limit).returns(0) | ||
82 | + holder.stubs(:custom_footer_expanded).returns('my custom footer') | ||
83 | + @controller.stubs(:boxes_holder).returns(holder) | ||
84 | + | ||
85 | + assert_tag_in_string insert_boxes('main content'), :tag => "div", :attributes => { :id => 'profile-footer' }, :content => 'my custom footer' | ||
86 | + end | ||
87 | + | ||
58 | end | 88 | end |