diff --git a/app/controllers/admin/environment_design_controller.rb b/app/controllers/admin/environment_design_controller.rb index 782c90a..2bd2c6d 100644 --- a/app/controllers/admin/environment_design_controller.rb +++ b/app/controllers/admin/environment_design_controller.rb @@ -3,7 +3,7 @@ class EnvironmentDesignController < BoxOrganizerController protect 'edit_environment_design', :environment def available_blocks - @available_blocks ||= [ LoginBlock, EnvironmentStatisticsBlock, RecentDocumentsBlock, EnterprisesBlock, CommunitiesBlock, PeopleBlock, SellersSearchBlock, LinkListBlock, FeedReaderBlock ] + @available_blocks ||= [ LoginBlock, EnvironmentStatisticsBlock, RecentDocumentsBlock, EnterprisesBlock, CommunitiesBlock, PeopleBlock, SellersSearchBlock, LinkListBlock, FeedReaderBlock, SlideshowBlock ] end end diff --git a/app/helpers/blog_helper.rb b/app/helpers/blog_helper.rb index 218126c..227340b 100644 --- a/app/helpers/blog_helper.rb +++ b/app/helpers/blog_helper.rb @@ -24,14 +24,18 @@ module BlogHelper artic_len = articles.length articles.each_with_index{ |art,i| css_add = [ 'position-'+(i+1).to_s() ] + position = (i%2 == 0) ? 'odd-post' : 'even-post' if art.published? || (user==art.profile) css_add << 'first' if i == 0 css_add << 'last' if i == (artic_len-1) css_add << 'not-published' if !art.published? + css_add << position + '-inner' content << content_tag('div', + content_tag('div', display_post(art) + '
', :class => 'blog-post ' + css_add.join(' '), - :id => "post-#{art.id}") + :id => "post-#{art.id}"), :class => position + ) end } content.join("\n
\n") + (pagination or '') diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb index ef35141..da7bd41 100644 --- a/app/helpers/boxes_helper.rb +++ b/app/helpers/boxes_helper.rb @@ -8,7 +8,13 @@ module BoxesHelper if @controller.send(:uses_design_blocks?) display_boxes(@controller.boxes_holder, content) else - content_tag('div', content, :class => 'no-boxes') + content_tag('div', + content_tag('div', + content_tag('div', content, :class => 'no-boxes-inner-2'), + :class => 'no-boxes-inner-1' + ), + :class => 'no-boxes' + ) end + maybe_display_custom_element(@controller.boxes_holder, :custom_footer_expanded, :id => 'profile-footer') end @@ -95,8 +101,13 @@ module BoxesHelper end box_decorator.block_target(block.box, block) + - content_tag('div', result + footer_content + box_decorator.block_edit_buttons(block), - options) + + content_tag('div', + content_tag('div', + content_tag('div', + result + footer_content + box_decorator.block_edit_buttons(block), + :class => 'block-inner-2'), + :class => 'block-inner-1'), + options) + box_decorator.block_handle(block) end diff --git a/app/helpers/language_helper.rb b/app/helpers/language_helper.rb index 29e69d7..5b185d7 100644 --- a/app/helpers/language_helper.rb +++ b/app/helpers/language_helper.rb @@ -20,6 +20,7 @@ module LanguageHelper def language_chooser(options = {}) current = language + separator = options[:separator] || ' — ' if options[:element] == 'dropdown' select_tag('lang', @@ -34,7 +35,7 @@ module LanguageHelper else link_to(name, params.merge(:lang => code), :rel => 'nofollow') end - end.join(' — ') + end.join(separator) content_tag('div', languages, :id => 'language-chooser', :help => _('The language you choose here is the language used for options, buttons, etc. It does not affect the language of the content created by other users.')) end end diff --git a/app/views/home/index.rhtml b/app/views/home/index.rhtml index d476348..4b32e4a 100644 --- a/app/views/home/index.rhtml +++ b/app/views/home/index.rhtml @@ -8,15 +8,17 @@
<% @highlighted_news.each_with_index do |highlighted, index| %>
-

<%= link_to(highlighted.title, highlighted.url, :class => 'post-title') %>

-

-

<%= highlighted.first_paragraph %>

-

- <%= link_to(_('Read more'), highlighted.url) %> -

-
+
+

<%= link_to(highlighted.title, highlighted.url, :class => 'post-title') %>

+

+

<%= highlighted.first_paragraph %>

+

+ <%= link_to(_('Read more'), highlighted.url) %> +

+
+
- <% end%> + <% end %>
@@ -28,7 +30,7 @@ <%= show_date(news.published_at, true) %> <%= link_to(news.title, news.url, :class => 'post-title' ) %> - <% end%> + <% end %> @@ -36,14 +38,18 @@ <% @area_news.each_with_index do |folder, i| %> <% content_tag(:div, :class => ["news-area", ['even', 'odd'][i%2]].join(' ')) do %> -

<%= link_to folder.title, folder.url %>

- - <%= link_to _('View more'), folder.url, :class => 'news-see-more' %> - <%end %> + <% content_tag(:div, :class => 'news-area-inner-1') do %> + <% content_tag(:div, :class => 'news-area-inner-2') do %> +

<%= link_to folder.title, folder.url %>

+ + <%= link_to _('View more'), folder.url, :class => 'news-see-more' %> + <% end %> + <% end %> + <% end %> <% end %> <% end %> <% else %> diff --git a/test/functional/environment_design_controller_test.rb b/test/functional/environment_design_controller_test.rb index 8718b7e..3050732 100644 --- a/test/functional/environment_design_controller_test.rb +++ b/test/functional/environment_design_controller_test.rb @@ -27,6 +27,10 @@ class EnvironmentDesignControllerTest < Test::Unit::TestCase assert_includes @controller.available_blocks, LinkListBlock end + should 'SlideshowBlock be available' do + assert_includes @controller.available_blocks, SlideshowBlock + end + should 'be able to edit LinkListBlock' do login_as(create_admin_user(Environment.default)) l = LinkListBlock.create!(:links => [{:name => 'link 1', :address => '/address_1'}]) diff --git a/test/unit/blog_helper_test.rb b/test/unit/blog_helper_test.rb index 39a18c1..47aca19 100644 --- a/test/unit/blog_helper_test.rb +++ b/test/unit/blog_helper_test.rb @@ -21,7 +21,8 @@ class BlogHelperTest < Test::Unit::TestCase blog.children << published_post = TextileArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => true) expects(:display_post).with(anything).returns('POST') - expects(:content_tag).with('div', "POST
", :class => 'blog-post position-1 first last', :id => "post-#{published_post.id}").returns('RESULT') + expects(:content_tag).with('div', "POST
", :class => 'blog-post position-1 first last odd-post-inner', :id => "post-#{published_post.id}").returns('POST') + expects(:content_tag).with('div', 'POST', {:class => 'odd-post'}).returns('RESULT') assert_equal 'RESULT', list_posts(profile, blog.posts) end @@ -30,8 +31,8 @@ class BlogHelperTest < Test::Unit::TestCase blog.children << unpublished_post = TextileArticle.create!(:name => 'Post', :profile => profile, :parent => blog, :published => false) expects(:display_post).with(anything).returns('POST') - expects(:content_tag).with('div', "POST
", :class => 'blog-post position-1 first last not-published', :id => "post-#{unpublished_post.id}").returns('RESULT') - + expects(:content_tag).with('div', "POST
", :class => 'blog-post position-1 first last not-published odd-post-inner', :id => "post-#{unpublished_post.id}").returns('POST') + expects(:content_tag).with('div', 'POST', {:class => 'odd-post'}).returns('RESULT') assert_equal 'RESULT', list_posts(profile, blog.posts) end @@ -41,12 +42,29 @@ class BlogHelperTest < Test::Unit::TestCase blog.children << published_post = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => blog, :published => true) expects(:display_post).with(anything).returns('POST') - expects(:content_tag).with('div', "POST
", has_entries(:id => "post-#{published_post.id}")).returns('RESULT') expects(:content_tag).with('div', "POST
", has_entries(:id => "post-#{unpublished_post.id}")).never - + expects(:content_tag).with('div', "POST
", has_entries(:id => "post-#{published_post.id}")).returns('POST') + expects(:content_tag).with('div', 'POST', {:class => 'odd-post'}).returns('RESULT') assert_equal 'RESULT', list_posts(nil, blog.posts) end + should 'list even/odd posts with a different class' do + blog.children << older_post = TextileArticle.create!(:name => 'First post', :profile => profile, :parent => blog, :published => true) + + blog.children << newer_post = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => blog, :published => true) + + expects(:display_post).with(anything).returns('POST').times(2) + + expects(:content_tag).with('div', "POST
", :class => 'blog-post position-1 first odd-post-inner', :id => "post-#{newer_post.id}").returns('POST 1') + expects(:content_tag).with('div', "POST 1", :class => 'odd-post').returns('ODD-POST') + + expects(:content_tag).with('div', "POST
", :class => 'blog-post position-2 last even-post-inner', :id => "post-#{older_post.id}").returns('POST 2') + expects(:content_tag).with('div', "POST 2", :class => 'even-post').returns('EVEN-POST') + + assert_equal "ODD-POST\n
\nEVEN-POST", list_posts(nil, blog.posts) + end + + should 'display post' do blog.children << article = TextileArticle.create!(:name => 'Second post', :profile => profile, :parent => blog, :published => true) expects(:article_title).with(article).returns('TITLE') -- libgit2 0.21.2