From f82f19554c4c69e12e01f48535bb48302090a7ce Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavacanti Date: Wed, 8 Apr 2015 11:03:39 -0300 Subject: [PATCH] Add new layout template with 4 boxes --- app/models/environment.rb | 6 +++--- app/models/profile.rb | 2 +- features/change_appearance.feature | 20 ++++++++++++++++++++ features/step_definitions/noosfero_steps.rb | 2 +- public/designs/templates/lefttopright/config.yml | 4 ++++ public/designs/templates/lefttopright/stylesheets/style.css | 39 +++++++++++++++++++++++++++++++++++++++ public/designs/templates/lefttopright/thumbnail.png | Bin 0 -> 3096 bytes public/designs/templates/lefttopright/thumbnail.svg | 434 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public/images/blocks/4.png | Bin 0 -> 1168 bytes public/images/blocks/4.svg | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public/stylesheets/application.css | 3 +++ test/unit/enterprise_test.rb | 4 ++-- 12 files changed, 590 insertions(+), 7 deletions(-) create mode 100644 features/change_appearance.feature create mode 100644 public/designs/templates/lefttopright/config.yml create mode 100644 public/designs/templates/lefttopright/stylesheets/style.css create mode 100644 public/designs/templates/lefttopright/thumbnail.png create mode 100644 public/designs/templates/lefttopright/thumbnail.svg create mode 100644 public/images/blocks/4.png create mode 100644 public/images/blocks/4.svg diff --git a/app/models/environment.rb b/app/models/environment.rb index 1d15d31..e7f593d 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -172,7 +172,7 @@ class Environment < ActiveRecord::Base acts_as_having_boxes after_create do |env| - 3.times do + 4.times do env.boxes << Box.new end @@ -737,8 +737,8 @@ class Environment < ActiveRecord::Base end def is_default_template?(template) - is_default = template == community_default_template - is_default = is_default || template == person_default_template + is_default = template == community_default_template + is_default = is_default || template == person_default_template is_default = is_default || template == enterprise_default_template is_default end diff --git a/app/models/profile.rb b/app/models/profile.rb index 8c46c74..419553f 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -362,7 +362,7 @@ class Profile < ActiveRecord::Base if template apply_template(template, :copy_articles => false) else - 3.times do + 4.times do self.boxes << Box.new end diff --git a/features/change_appearance.feature b/features/change_appearance.feature new file mode 100644 index 0000000..7f07cab --- /dev/null +++ b/features/change_appearance.feature @@ -0,0 +1,20 @@ +Feature: Change appearance + As a user + I want to change the appearance of my profile page + + Background: + Given the following users + | login | name | + | joaosilva | Joao Silva | + + Scenario: Change appearance from default(3 boxes) to Left Top and Right(4 boxes) + Given I am logged in as "joaosilva" + And I go to joaosilva's control panel + And I follow "Edit sideboxes" + And I should not see an element ".box-4" + And I go to joaosilva's control panel + And I follow "Edit Appearance" + And I follow "Left Top and Right" + And I go to joaosilva's control panel + And I follow "Edit sideboxes" + And I should see an element ".box-4" diff --git a/features/step_definitions/noosfero_steps.rb b/features/step_definitions/noosfero_steps.rb index 3316640..2f2460d 100644 --- a/features/step_definitions/noosfero_steps.rb +++ b/features/step_definitions/noosfero_steps.rb @@ -94,7 +94,7 @@ Given /^the following blocks$/ do |table| owner.boxes<< Box.new owner.boxes.first.blocks << MainBlock.new end - box_id = owner.boxes.last.id + box_id = owner.boxes[-2].id klass.constantize.create!(item.merge(:box_id => box_id)) end end diff --git a/public/designs/templates/lefttopright/config.yml b/public/designs/templates/lefttopright/config.yml new file mode 100644 index 0000000..fd5baa2 --- /dev/null +++ b/public/designs/templates/lefttopright/config.yml @@ -0,0 +1,4 @@ +name: "Top and Side Bars" +title: "1 max colum at left, 1 min colum at right, 1 top line" +description: "A template with 1 colum in left, 1 colum in right and 1 line in top" +number_of_boxes: 4 diff --git a/public/designs/templates/lefttopright/stylesheets/style.css b/public/designs/templates/lefttopright/stylesheets/style.css new file mode 100644 index 0000000..5c460a5 --- /dev/null +++ b/public/designs/templates/lefttopright/stylesheets/style.css @@ -0,0 +1,39 @@ +#boxes { + display: table; + width: 100%; +} + +.box-1 { + width: 59%; + float: right; + margin-right: 5px +} + +.box-3 { + position: relative; + float: left; + width: 20%; +} + +.box-2 { + position: relative; + float: right; + width: 20%; +} + +.box-4 { + float: right; + width: 79.5%; +} + +#profile-activity ul, +#profile-network ul, +#profile-wall ul { + width: 460px; +} +#profile-activity ul.comment-replies, +#profile-network ul.comment-replies, +#profile-wall ul.comment-replies { + width: auto; +} + diff --git a/public/designs/templates/lefttopright/thumbnail.png b/public/designs/templates/lefttopright/thumbnail.png new file mode 100644 index 0000000..43d6b95 Binary files /dev/null and b/public/designs/templates/lefttopright/thumbnail.png differ diff --git a/public/designs/templates/lefttopright/thumbnail.svg b/public/designs/templates/lefttopright/thumbnail.svg new file mode 100644 index 0000000..d846060 --- /dev/null +++ b/public/designs/templates/lefttopright/thumbnail.svg @@ -0,0 +1,434 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/images/blocks/4.png b/public/images/blocks/4.png new file mode 100644 index 0000000..e629239 Binary files /dev/null and b/public/images/blocks/4.png differ diff --git a/public/images/blocks/4.svg b/public/images/blocks/4.svg new file mode 100644 index 0000000..82b8104 --- /dev/null +++ b/public/images/blocks/4.svg @@ -0,0 +1,83 @@ + + + + + + + + + + image/svg+xml + + + + + + + + 4 + + diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index ed847c8..820900c 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1842,6 +1842,9 @@ a.button.disabled, input.disabled { #box-organizer div.box-3 { background-image: url(../images/blocks/3.png); } +#box-organizer div.box-4 { + background-image: url(../images/blocks/4.png); +} #box-organizer .block { cursor: move; } diff --git a/test/unit/enterprise_test.rb b/test/unit/enterprise_test.rb index 6e9d6fc..04a549a 100644 --- a/test/unit/enterprise_test.rb +++ b/test/unit/enterprise_test.rb @@ -188,7 +188,7 @@ class EnterpriseTest < ActiveSupport::TestCase inactive_template.save! active_template = create(Enterprise, :name => 'enteprise template', :identifier => 'enterprise_template') - assert_equal 3, active_template.boxes.size + assert_equal 4, active_template.boxes.size e = Environment.default e.inactive_enterprise_template = inactive_template @@ -400,7 +400,7 @@ class EnterpriseTest < ActiveSupport::TestCase e.save! ent = create(Enterprise, :name => 'test enteprise', :identifier => 'test_ent') - assert_equal 3, ent.boxes.size + assert_equal 4, ent.boxes.size end should 'collect the highlighted products with image' do -- libgit2 0.21.2