diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb
index 58cdf5f..589217b 100644
--- a/app/helpers/boxes_helper.rb
+++ b/app/helpers/boxes_helper.rb
@@ -4,11 +4,13 @@ module BoxesHelper
if @controller.send(:boxes_editor?) && @controller.send(:uses_design_blocks?)
content + display_boxes_editor(@controller.boxes_holder)
else
+ maybe_display_custom_element(@controller.boxes_holder, :custom_header_expanded, :id => 'profile-header') +
if @controller.send(:uses_design_blocks?)
display_boxes(@controller.boxes_holder, content)
else
content_tag('div', content, :class => 'no-boxes')
- end
+ end +
+ maybe_display_custom_element(@controller.boxes_holder, :custom_footer_expanded, :id => 'profile-footer')
end
end
@@ -35,9 +37,7 @@ module BoxesHelper
content = boxes.reverse.map { |item| display_box(item, main_content) }.join("\n")
content = main_content if (content.blank?)
- maybe_display_custom_element(holder, :custom_header_expanded, :id => 'profile-header') +
- content_tag('div', content, :class => 'boxes', :id => 'boxes' ) +
- maybe_display_custom_element(holder, :custom_footer_expanded, :id => 'profile-footer')
+ content_tag('div', content, :class => 'boxes', :id => 'boxes' )
end
def maybe_display_custom_element(holder, element, options = {})
diff --git a/app/views/events/events.rhtml b/app/views/events/events.rhtml
index a169bd1..e7ab2f1 100644
--- a/app/views/events/events.rhtml
+++ b/app/views/events/events.rhtml
@@ -1,5 +1,11 @@
-<%= button :back, _('Back to %s') % profile.name, profile.public_profile_url %>
-
-
<%= _("%s's events") % profile.name %>
+
+
+ <%= button :back, _('Back to %s') % profile.name, profile.public_profile_url %>
+ <% if user && user.has_permission?('post_content', profile) %>
+ <%= button :new, _('New event'), myprofile_url(:controller => 'cms', :action => 'new', :type => 'Event') %>
+ <% end %>
+
+ <%= _("%s's events") % profile.name %>
+
<%= render :partial => 'agenda' %>
diff --git a/app/views/search/events.rhtml b/app/views/search/events.rhtml
index a7584d0..9da66f4 100644
--- a/app/views/search/events.rhtml
+++ b/app/views/search/events.rhtml
@@ -1,6 +1,7 @@
+ <%= _("%s's events") % @environment.name %>
<% if @category %>
- <%= @category.name %>
+ :<%= @category.name %>
<% end %>
diff --git a/features/events.feature b/features/events.feature
index 9c60a30..1484a69 100644
--- a/features/events.feature
+++ b/features/events.feature
@@ -149,3 +149,24 @@ Feature: events
Scenario: warn when there is no events
When I am on /profile/josesilva/events/2020/12/1
Then I should see "No events for this date"
+
+ Scenario: provide button to create new event
+ Given I am logged in as "josesilva"
+ When I am on /profile/josesilva/events/2020/12/1
+ Then I should see "New event" link
+
+ Scenario: not provide button to create new event if I am not logged
+ When I am on /profile/josesilva/events/2020/12/1
+ Then I should not see "New event" link
+
+ Scenario: not provide button to create new event if I haven't permission
+ Given the following users
+ | login |
+ | fudencio |
+ Given I am logged in as "josesilva"
+ When I am on /profile/fudencio/events/2020/12/1
+ Then I should not see "New events" link
+
+ Scenario: display environment name in global agenda
+ When I am on /assets/events
+ Then I should see "Colivre.net's events"
diff --git a/public/stylesheets/controller_events.css b/public/stylesheets/controller_events.css
index 3b9d890..2c9859e 100644
--- a/public/stylesheets/controller_events.css
+++ b/public/stylesheets/controller_events.css
@@ -28,6 +28,9 @@
#agenda .agenda-calendar .calendar-day-out span {
display: none;
}
+#agenda .agenda-calendar .calendar-day a {
+ font-weight: bold;
+}
#agenda .agenda-calendar td {
text-align: center;
padding: 0px;
@@ -44,15 +47,27 @@
float: left;
width: 50%;
}
+.msie #agenda .agenda-calendar .previous-month,
+.msie #agenda .agenda-calendar .next-month {
+ width: 49%;
+}
#agenda .agenda-calendar .previous-month {
}
#agenda .agenda-calendar .next-month {
border-left: 1px solid #BFC2BC;
}
#agenda .selected {
- background: #ff9;
+ background: gray;
+ font-weight: bold;
font-style: normal;
}
+#agenda .selected a,
+#agenda .selected span {
+ color: white;
+}
+#agenda .calendar-day-out.selected {
+ background: none;
+}
#agenda td {
vertical-align: middle;
}
@@ -78,11 +93,19 @@
height: 90%;
}
-body.noosfero #content .no-boxes a.button.icon-back {
- float: left;
+#content .no-boxes h1 #toolbar {
position: absolute;
+ left: 0;
+ font-variant: normal;
+ font-weight: normal;
+}
+#content .no-boxes h1 {
+ position: relative;
+}
+
+#content .no-boxes h1 #toolbar a.button {
border: none;
- opacity: 0.5;
+ opacity: 0.6;
}
#agenda #events-of-the-day .select-a-day {
diff --git a/test/unit/boxes_helper_test.rb b/test/unit/boxes_helper_test.rb
index e585093..7adb36a 100644
--- a/test/unit/boxes_helper_test.rb
+++ b/test/unit/boxes_helper_test.rb
@@ -5,13 +5,20 @@ class BoxesHelperTest < Test::Unit::TestCase
include BoxesHelper
include ActionView::Helpers::TagHelper
+ def setup
+ @controller = mock
+ @controller.stubs(:boxes_editor?).returns(false)
+ @controller.stubs(:uses_design_blocks?).returns(true)
+ end
+
should 'include profile-specific header' do
holder = mock
holder.stubs(:boxes).returns([])
holder.stubs(:boxes_limit).returns(0)
holder.stubs(:custom_header_expanded).returns('my custom header')
+ @controller.stubs(:boxes_holder).returns(holder)
- assert_tag_in_string display_boxes(holder, 'main content'), :tag => "div", :attributes => { :id => 'profile-header' }, :content => 'my custom header'
+ assert_tag_in_string insert_boxes('main content'), :tag => "div", :attributes => { :id => 'profile-header' }, :content => 'my custom header'
end
should 'include profile-specific footer' do
@@ -19,8 +26,9 @@ class BoxesHelperTest < Test::Unit::TestCase
holder.stubs(:boxes).returns([])
holder.stubs(:boxes_limit).returns(0)
holder.stubs(:custom_footer_expanded).returns('my custom footer')
+ @controller.stubs(:boxes_holder).returns(holder)
- assert_tag_in_string display_boxes(holder, 'main content'), :tag => "div", :attributes => { :id => 'profile-footer' }, :content => 'my custom footer'
+ assert_tag_in_string insert_boxes('main content'), :tag => "div", :attributes => { :id => 'profile-footer' }, :content => 'my custom footer'
end
def create_user_with_blocks
@@ -55,4 +63,26 @@ class BoxesHelperTest < Test::Unit::TestCase
display_box_content(box, '')
end
+ should 'include profile-specific header without side boxes' do
+ @controller.stubs(:uses_design_blocks?).returns(false)
+ holder = mock
+ holder.stubs(:boxes).returns([])
+ holder.stubs(:boxes_limit).returns(0)
+ holder.stubs(:custom_header_expanded).returns('my custom header')
+ @controller.stubs(:boxes_holder).returns(holder)
+
+ assert_tag_in_string insert_boxes('main content'), :tag => "div", :attributes => { :id => 'profile-header' }, :content => 'my custom header'
+ end
+
+ should 'include profile-specific footer without side boxes' do
+ @controller.stubs(:uses_design_blocks?).returns(false)
+ holder = mock
+ holder.stubs(:boxes).returns([])
+ holder.stubs(:boxes_limit).returns(0)
+ holder.stubs(:custom_footer_expanded).returns('my custom footer')
+ @controller.stubs(:boxes_holder).returns(holder)
+
+ assert_tag_in_string insert_boxes('main content'), :tag => "div", :attributes => { :id => 'profile-footer' }, :content => 'my custom footer'
+ end
+
end
--
libgit2 0.21.2