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;" %> + +
+ <%= labelled_form_field(_('Lead'), text_area(:article, 'abstract', :cols => 64, :rows => 10)) %> +
+
+ <%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 64)) %> +
+ +<%= javascript_include_tag 'article'%> diff --git a/app/views/cms/_tiny_mce_article.rhtml b/app/views/cms/_tiny_mce_article.rhtml index 26216b5..b752bdd 100644 --- a/app/views/cms/_tiny_mce_article.rhtml +++ b/app/views/cms/_tiny_mce_article.rhtml @@ -11,6 +11,16 @@ <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64')) %> <% end %> - <%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 40, :style => 'width:100%')) %> +
+ <%= button_to_function :edit, _("Lead"), nil, :id => "lead-link", :style => "margin-left: 0px;" %> + +
+ <%= labelled_form_field(_('Lead'), text_area(:article, 'abstract', :style => 'width: 100%; height: 300px;')) %> +
+
+ <%= labelled_form_field(_('Text'), text_area(:article, 'body', :style => 'width:100%')) %> +
+ +<%= javascript_include_tag 'article' %> diff --git a/app/views/home/index.rhtml b/app/views/home/index.rhtml index 4b32e4a..61239ee 100644 --- a/app/views/home/index.rhtml +++ b/app/views/home/index.rhtml @@ -10,8 +10,8 @@

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

-

-

<%= highlighted.first_paragraph %>

+ +

<%= !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