diff --git a/app/views/cms/_textile_article.rhtml b/app/views/cms/_textile_article.rhtml
index b15f79d..9a2c3b3 100644
--- a/app/views/cms/_textile_article.rhtml
+++ b/app/views/cms/_textile_article.rhtml
@@ -4,5 +4,15 @@
<%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64')) %>
-<%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 64)) %>
+
+<%= button_to_function :edit, _("Lead"), nil, :id => "lead-link", :style => "margin-left: 0px;" %>
+
+
<%= highlighted.first_paragraph %>
+ <%= show_date(highlighted.published_at, true) %> +<%= !highlighted.abstract.blank? ? highlighted.abstract : highlighted.first_paragraph %>
<%= link_to(_('Read more'), highlighted.url) %>
diff --git a/public/javascripts/article.js b/public/javascripts/article.js new file mode 100644 index 0000000..c73cdbc --- /dev/null +++ b/public/javascripts/article.js @@ -0,0 +1,8 @@ +(function($) { + $("#lead-link").click(function(){ + if($('#article-lead').css('display') == 'none') + $('#article-lead').slideDown(); + else + $('#article-lead').slideUp(); + }) +})(jQuery) diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 491d5f8..028f508 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -1005,6 +1005,11 @@ code input { font-weight: normal; } +#article-lead { + margin-top: 10px; + display: none; +} + /* * * Comments * * */ .comments { } diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb index dc73f67..885a877 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -53,6 +53,29 @@ all_fixtures assert_tag :tag => 'div', :attributes => { :id => 'portal-news' } #, :descendant => {:tag => 'form', :attributes => {:action => '/account/activation_question'}} end + should 'display the news leads if there is any' do + env = Environment.default + env.enable('use_portal_community') + c = fast_create(Community) + a1 = TextileArticle.create!(:name => "Article 1", + :profile => c, + :abstract => "This is the article1 lead.", + :body => "This is the article1 body.", + :highlighted => true) + a2 = TextileArticle.create!(:name => "Article 2", + :profile => c, + :body => "This is the article2 body.", + :highlighted => true) + env.portal_community = c + env.save! + + + get :index + assert_tag :tag => 'p', :content => a1.abstract + assert_no_tag :tag => 'p', :content => a1.body + assert_tag :tag => 'p', :content => a2.body + end + should 'display block in index page if it\'s configured to display on homepage and its an environment block' do env = Environment.default box = Box.create(:owner_type => 'Environment', :owner_id => env.id) -- libgit2 0.21.2