Commit 1f2f7efd6ef7d2affe4929abb21ab516b943307a
Exists in
staging
and in
1 other branch
Merge branch 'master' into staging
Showing
12 changed files
with
236 additions
and
158 deletions
Show diff stats
plugins/context_content/controllers/profile/context_content_plugin_profile_controller.rb
| ... | ... | @@ -7,9 +7,11 @@ class ContextContentPluginProfileController < ProfileController |
| 7 | 7 | contents = block.contents(profile.articles.find(params[:article_id]), p) |
| 8 | 8 | |
| 9 | 9 | if contents |
| 10 | + @page = Article.find(params[:article_id]) | |
| 11 | + | |
| 10 | 12 | render :update do |page| |
| 11 | - page.replace_html "context_content_#{block.id}", :file => "blocks/context_content", :locals => {:block => block, :contents => contents} | |
| 12 | - page.replace_html "context_content_more_#{block.id}", :partial => 'blocks/more', :locals => {:block => block, :contents => contents, :article_id => params[:article_id] } | |
| 13 | + page.replace_html "context_content_#{block.id}", :file => "blocks/context_content", :locals => {:block => block} | |
| 14 | + page.replace_html "context_content_more_#{block.id}", :file => 'blocks/footers/context_content', :locals => {:block => block} | |
| 13 | 15 | end |
| 14 | 16 | else |
| 15 | 17 | render :text => "invalid page", :status => 500 | ... | ... |
plugins/context_content/lib/context_content_block_helper.rb
0 → 100644
| ... | ... | @@ -0,0 +1,11 @@ |
| 1 | +module ContextContentBlockHelper | |
| 2 | + def content_image(content) | |
| 3 | + if content.image? | |
| 4 | + image_tag(content.public_filename(:thumb)) | |
| 5 | + else | |
| 6 | + extra_class = content.uploaded_file? ? "extension-#{content.extension}" : '' | |
| 7 | + klasses = [content.icon_name].flatten.map{|name| 'icon-'+name}.join(' ') | |
| 8 | + content_tag 'div', '', :class => "context-icon #{klasses} #{extra_class}" | |
| 9 | + end | |
| 10 | + end | |
| 11 | +end | ... | ... |
plugins/context_content/lib/context_content_plugin/context_content_block.rb
| ... | ... | @@ -43,19 +43,6 @@ class ContextContentPlugin::ContextContentBlock < Block |
| 43 | 43 | settings[:types] = new_types.reject(&:blank?) |
| 44 | 44 | end |
| 45 | 45 | |
| 46 | - def content_image(content) | |
| 47 | - block = self | |
| 48 | - proc do | |
| 49 | - if content.image? | |
| 50 | - image_tag(content.public_filename(:thumb)) | |
| 51 | - else | |
| 52 | - extra_class = content.uploaded_file? ? "extension-#{content.extension}" : '' | |
| 53 | - klasses = [content.icon_name].flatten.map{|name| 'icon-'+name}.join(' ') | |
| 54 | - content_tag 'div', '', :class => "context-icon #{klasses} #{extra_class}" | |
| 55 | - end | |
| 56 | - end | |
| 57 | - end | |
| 58 | - | |
| 59 | 46 | def contents(page, p=1) |
| 60 | 47 | return @children unless @children.blank? |
| 61 | 48 | if page |
| ... | ... | @@ -71,33 +58,6 @@ class ContextContentPlugin::ContextContentBlock < Block |
| 71 | 58 | contents.first.parent.name |
| 72 | 59 | end |
| 73 | 60 | |
| 74 | - def footer | |
| 75 | - block = self | |
| 76 | - proc do | |
| 77 | - contents = block.contents(@page) | |
| 78 | - if contents | |
| 79 | - content_tag('div', | |
| 80 | - render(:partial => 'blocks/more', :locals => {:block => block, :contents => contents, :article_id => @page.id}), :id => "context_content_more_#{block.id}", :class => "more_button") | |
| 81 | - else | |
| 82 | - '' | |
| 83 | - end | |
| 84 | - end | |
| 85 | - end | |
| 86 | - | |
| 87 | - def content(args={}) | |
| 88 | - block = self | |
| 89 | - ret = proc do | |
| 90 | - contents = block.contents(@page) | |
| 91 | - parent_title = block.parent_title(contents) | |
| 92 | - if contents.present? | |
| 93 | - render(:file => 'blocks/context_content', :locals => {:block => block, :contents => contents, :parent_title => parent_title}) | |
| 94 | - else | |
| 95 | - '' | |
| 96 | - end | |
| 97 | - end | |
| 98 | - ret | |
| 99 | - end | |
| 100 | - | |
| 101 | 61 | def cacheable? |
| 102 | 62 | false |
| 103 | 63 | end | ... | ... |
plugins/context_content/test/unit/context_content_block_helper_test.rb
0 → 100644
| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | +require 'test_helper' | |
| 2 | + | |
| 3 | +class ContextContentBlockHelperTest < ActionView::TestCase | |
| 4 | + include ContextContentBlockHelper | |
| 5 | + | |
| 6 | + should 'display thumbnail for image content' do | |
| 7 | + content = UploadedFile.new(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
| 8 | + content = FilePresenter.for(content) | |
| 9 | + expects(:image_tag).once | |
| 10 | + content_image(content) | |
| 11 | + end | |
| 12 | + | |
| 13 | + should 'display div as content image for content that is not a image' do | |
| 14 | + content = fast_create(Folder) | |
| 15 | + content = FilePresenter.for(content) | |
| 16 | + expects(:content_tag).once | |
| 17 | + content_image(content) | |
| 18 | + end | |
| 19 | + | |
| 20 | + should 'display div with extension class for uploaded file that is not an image' do | |
| 21 | + content = UploadedFile.new(:uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')) | |
| 22 | + content = FilePresenter.for(content) | |
| 23 | + expects(:content_tag).with('div', '', :class => "context-icon icon-text icon-text-plain extension-txt").once | |
| 24 | + content_image(content) | |
| 25 | + end | |
| 26 | + | |
| 27 | +end | ... | ... |
plugins/context_content/test/unit/context_content_block_test.rb
| ... | ... | @@ -20,17 +20,6 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
| 20 | 20 | assert_equal nil, @block.contents(nil) |
| 21 | 21 | end |
| 22 | 22 | |
| 23 | - should 'render nothing if it has no content to show' do | |
| 24 | - assert_equal '', instance_eval(&@block.content) | |
| 25 | - end | |
| 26 | - | |
| 27 | - should 'render context content block view' do | |
| 28 | - @page = fast_create(Folder) | |
| 29 | - article = fast_create(TinyMceArticle, :parent_id => @page.id) | |
| 30 | - expects(:render).with(:file => 'blocks/context_content', :locals => {:block => @block, :contents => [article], :parent_title => @page.name}) | |
| 31 | - instance_eval(&@block.content) | |
| 32 | - end | |
| 33 | - | |
| 34 | 23 | should 'return children of page' do |
| 35 | 24 | folder = fast_create(Folder) |
| 36 | 25 | article = fast_create(TinyMceArticle, :parent_id => folder.id) |
| ... | ... | @@ -134,34 +123,56 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
| 134 | 123 | assert_equal [UploadedFile, Event, TinyMceArticle, TextileArticle, RawHTMLArticle, Folder, Blog, Forum, Gallery, RssFeed, SomePluginContent], @block.available_content_types |
| 135 | 124 | end |
| 136 | 125 | |
| 137 | - should 'display thumbnail for image content' do | |
| 138 | - content = UploadedFile.new(:uploaded_data => fixture_file_upload('/files/rails.png', 'image/png')) | |
| 139 | - content = FilePresenter.for(content) | |
| 140 | - expects(:image_tag).once | |
| 141 | - instance_eval(&@block.content_image(content)) | |
| 126 | + should 'return box owner on profile method call' do | |
| 127 | + profile = fast_create(Community) | |
| 128 | + box = Box.create!(:owner => profile) | |
| 129 | + block = ContextContentPlugin::ContextContentBlock.create!(:box_id => box.id) | |
| 130 | + assert_equal profile, block.profile | |
| 131 | + end | |
| 132 | + | |
| 133 | + should 'not be cacheable' do | |
| 134 | + refute @block.cacheable? | |
| 135 | + end | |
| 136 | + | |
| 137 | +end | |
| 138 | + | |
| 139 | +require 'boxes_helper' | |
| 140 | + | |
| 141 | +class ContextContentBlockViewTest < ActionView::TestCase | |
| 142 | + include BoxesHelper | |
| 143 | + | |
| 144 | + def setup | |
| 145 | + Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | |
| 146 | + @block = ContextContentPlugin::ContextContentBlock.create! | |
| 147 | + @block.types = ['TinyMceArticle'] | |
| 142 | 148 | end |
| 143 | 149 | |
| 144 | - should 'display div as content image for content that is not a image' do | |
| 145 | - content = fast_create(Folder) | |
| 146 | - content = FilePresenter.for(content) | |
| 147 | - expects(:content_tag).once | |
| 148 | - instance_eval(&@block.content_image(content)) | |
| 150 | + should 'render nothing if it has no content to show' do | |
| 151 | + assert_equal "\n", render_block_content(@block) | |
| 149 | 152 | end |
| 150 | 153 | |
| 151 | - should 'display div with extension class for uploaded file that is not a image' do | |
| 152 | - content = UploadedFile.new(:uploaded_data => fixture_file_upload('/files/test.txt', 'text/plain')) | |
| 153 | - content = FilePresenter.for(content) | |
| 154 | - expects(:content_tag).with('div', '', :class => "context-icon icon-text icon-text-plain extension-txt").once | |
| 155 | - instance_eval(&@block.content_image(content)) | |
| 154 | + should 'render context content block view' do | |
| 155 | + @page = fast_create(Folder) | |
| 156 | + article = fast_create(TinyMceArticle, :parent_id => @page.id) | |
| 157 | + contents = [article] | |
| 158 | + @block.use_parent_title = true | |
| 159 | + | |
| 160 | + article.expects(:view_url).returns('http://test.noosfero.plugins') | |
| 161 | + @block.expects(:contents).with(@page).returns(contents) | |
| 162 | + @block.expects(:parent_title).with(contents).returns(@page.name) | |
| 163 | + ActionView::Base.any_instance.expects(:block_title).with(@page.name, @block.subtitle).returns("") | |
| 164 | + | |
| 165 | + render_block_content(@block) | |
| 156 | 166 | end |
| 157 | 167 | |
| 158 | 168 | should 'do not display pagination links if page is nil' do |
| 159 | 169 | @page = nil |
| 160 | - assert_equal '', instance_eval(&@block.footer) | |
| 170 | + | |
| 171 | + assert_equal "\n", render_block_content(@block) | |
| 161 | 172 | end |
| 162 | 173 | |
| 163 | 174 | should 'do not display pagination links if it has until one page' do |
| 164 | - assert_equal '', instance_eval(&@block.footer) | |
| 175 | + assert_equal "\n", render_block_content(@block) | |
| 165 | 176 | end |
| 166 | 177 | |
| 167 | 178 | should 'display pagination links if it has more than one page' do |
| ... | ... | @@ -170,20 +181,14 @@ class ContextContentBlockTest < ActiveSupport::TestCase |
| 170 | 181 | article1 = fast_create(TinyMceArticle, :parent_id => @page.id) |
| 171 | 182 | article2 = fast_create(TinyMceArticle, :parent_id => @page.id) |
| 172 | 183 | article3 = fast_create(TinyMceArticle, :parent_id => @page.id) |
| 173 | - expects(:content_tag).once | |
| 174 | - expects(:render).with(has_entry(:partial => 'blocks/more')) | |
| 175 | - instance_eval(&@block.footer) | |
| 176 | - end | |
| 184 | + contents = [article1, article2, article3] | |
| 185 | + contents.each do |article| | |
| 186 | + article.expects(:view_url).returns('http://test.noosfero.plugins') | |
| 187 | + end | |
| 177 | 188 | |
| 178 | - should 'return box owner on profile method call' do | |
| 179 | - profile = fast_create(Community) | |
| 180 | - box = Box.create!(:owner => profile) | |
| 181 | - block = ContextContentPlugin::ContextContentBlock.create!(:box_id => box.id) | |
| 182 | - assert_equal profile, block.profile | |
| 183 | - end | |
| 189 | + ActionView::Base.any_instance.expects(:block_title).returns("") | |
| 190 | + @block.expects(:contents).with(@page).returns(contents) | |
| 184 | 191 | |
| 185 | - should 'not be cacheable' do | |
| 186 | - refute @block.cacheable? | |
| 192 | + render_block_content(@block) | |
| 187 | 193 | end |
| 188 | - | |
| 189 | 194 | end | ... | ... |
plugins/context_content/views/blocks/_more.html.erb
| ... | ... | @@ -1,4 +0,0 @@ |
| 1 | -<% if contents.total_pages > 1 %> | |
| 2 | - <%= link_to_remote(nil, :url => {:profile => block.owner.identifier, :id => block.id, :controller => 'context_content_plugin_profile', :action => 'view_content', :page => contents.previous_page, :article_id => article_id }, :html => {:class => "button icon-button icon-left #{contents.previous_page ? '':'disabled'}".strip}, :condition => "#{!contents.previous_page.nil?}", :success => "jQuery('#context_content_#{block.id}').effect('slide', {direction: 'left'});" )%> | |
| 3 | - <%= link_to_remote(nil, :url => {:profile => block.owner.identifier, :id => block.id, :controller => 'context_content_plugin_profile', :action => 'view_content', :page => contents.next_page, :article_id => article_id }, :html => {:class => "button icon-button icon-right #{contents.next_page ? '':'disabled'}".strip}, :condition => "#{!contents.next_page.nil?}", :success => "jQuery('#context_content_#{block.id}').effect('slide', {direction: 'right'});" )%> | |
| 4 | -<% end %> |
plugins/context_content/views/blocks/context_content.html.erb
| 1 | -<% if block.use_parent_title %> | |
| 2 | - <%= block_title(parent_title, block.subtitle) %> | |
| 3 | -<% else %> | |
| 4 | - <%= block_title(block.title, block.subtitle) %> | |
| 5 | -<% end %> | |
| 1 | +<% extend ContextContentBlockHelper %> | |
| 6 | 2 | |
| 7 | -<div class='contents' id='<%="context_content_#{block.id}"%>'> | |
| 8 | - <% contents.each do |content| %> | |
| 9 | - <% content = FilePresenter.for(content) %> | |
| 10 | - <span class="item"> | |
| 11 | - <a href="<%= url_for(content.view_url) %>"> | |
| 12 | - <div class="image"> | |
| 13 | - <%= instance_eval(&block.content_image(content)) if block.show_image %> | |
| 14 | - </div> | |
| 15 | - <% if block.show_name %> | |
| 16 | - <div class="name"><%= content.name %></div> | |
| 17 | - <% end %> | |
| 18 | - </a> | |
| 19 | - </span> | |
| 3 | +<% contents = block.contents(@page) | |
| 4 | + unless contents.blank? %> | |
| 5 | + <% if block.use_parent_title %> | |
| 6 | + <%= block_title(block.parent_title(contents), block.subtitle) %> | |
| 7 | + <% else %> | |
| 8 | + <%= block_title(block.title, block.subtitle) %> | |
| 20 | 9 | <% end %> |
| 21 | -</div> | |
| 10 | + | |
| 11 | + <div class='contents' id='<%="context_content_#{block.id}"%>'> | |
| 12 | + <% contents.each do |content| %> | |
| 13 | + <% content = FilePresenter.for(content) %> | |
| 14 | + <span class="item"> | |
| 15 | + <a href="<%= url_for(content.view_url) %>"> | |
| 16 | + <div class="image"> | |
| 17 | + <%= content_image(content) if block.show_image %> | |
| 18 | + </div> | |
| 19 | + <% if block.show_name %> | |
| 20 | + <div class="name"><%= content.name %></div> | |
| 21 | + <% end %> | |
| 22 | + </a> | |
| 23 | + </span> | |
| 24 | + <% end %> | |
| 25 | + </div> | |
| 26 | +<% end %> | ... | ... |
plugins/context_content/views/blocks/footers/context_content.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,9 @@ |
| 1 | +<% contents = block.contents(@page) | |
| 2 | + unless contents.blank? %> | |
| 3 | + <div id="context_content_more_<%= block.id %>" class="more_button"> | |
| 4 | + <% if contents.total_pages > 1 %> | |
| 5 | + <%= link_to_remote(nil, :url => {:profile => block.owner.identifier, :id => block.id, :controller => 'context_content_plugin_profile', :action => 'view_content', :page => contents.previous_page, :article_id => @page.id }, :html => {:class => "button icon-button icon-left #{contents.previous_page ? '':'disabled'}".strip}, :condition => "#{!contents.previous_page.nil?}", :success => "jQuery('#context_content_#{block.id}').effect('slide', {direction: 'left'});" )%> | |
| 6 | + <%= link_to_remote(nil, :url => {:profile => block.owner.identifier, :id => block.id, :controller => 'context_content_plugin_profile', :action => 'view_content', :page => contents.next_page, :article_id => @page.id }, :html => {:class => "button icon-button icon-right #{contents.next_page ? '':'disabled'}".strip}, :condition => "#{!contents.next_page.nil?}", :success => "jQuery('#context_content_#{block.id}').effect('slide', {direction: 'right'});" )%> | |
| 7 | + <% end %> | |
| 8 | + </div> | |
| 9 | +<% end %> | ... | ... |
plugins/recent_content/lib/recent_content_block.rb
| ... | ... | @@ -44,13 +44,6 @@ class RecentContentBlock < Block |
| 44 | 44 | |
| 45 | 45 | include DatesHelper |
| 46 | 46 | |
| 47 | - def content(args={}) | |
| 48 | - block = self | |
| 49 | - proc do | |
| 50 | - render :file => 'blocks/recent_content_block', :locals => {:root => block.root, :block => block} | |
| 51 | - end | |
| 52 | - end | |
| 53 | - | |
| 54 | 47 | def mode?(attr) |
| 55 | 48 | attr == self.presentation_mode |
| 56 | 49 | end | ... | ... |
plugins/recent_content/test/unit/recent_content_block_test.rb
| ... | ... | @@ -73,3 +73,73 @@ class RecentContentBlockTest < ActiveSupport::TestCase |
| 73 | 73 | end |
| 74 | 74 | |
| 75 | 75 | end |
| 76 | + | |
| 77 | +require 'boxes_helper' | |
| 78 | + | |
| 79 | +class RecentContentBlockViewTest < ActionView::TestCase | |
| 80 | + include BoxesHelper | |
| 81 | + | |
| 82 | + should 'show the alert when the block has no root' do | |
| 83 | + block = RecentContentBlock.new | |
| 84 | + | |
| 85 | + block.expects(:root).returns(nil) | |
| 86 | + | |
| 87 | + content = render_block_content(block) | |
| 88 | + | |
| 89 | + assert_match /#{_('This is the recent content block. Please edit it to show the content you want.')}/, content | |
| 90 | + end | |
| 91 | + | |
| 92 | + should 'show the title and the child titles when the block has a root and is set to title only mode' do | |
| 93 | + profile = create_user('testuser').person | |
| 94 | + | |
| 95 | + root = fast_create(Blog, :name => 'test-blog', :profile_id => profile.id) | |
| 96 | + | |
| 97 | + block = RecentContentBlock.new | |
| 98 | + block.stubs(:holder).returns(profile) | |
| 99 | + block.selected_folder = root.id | |
| 100 | + block.presentation_mode = 'title_only' | |
| 101 | + | |
| 102 | + ActionView::Base.any_instance.expects(:block_title).returns("Block Title") | |
| 103 | + ActionView::Base.any_instance.expects(:profile).returns(profile) | |
| 104 | + | |
| 105 | + content = render_block_content(block) | |
| 106 | + | |
| 107 | + assert_match /Block Title/, content | |
| 108 | + end | |
| 109 | + | |
| 110 | + should 'show the title and the child titles and abstracts when the block has a root and is set to title and abstract mode' do | |
| 111 | + profile = create_user('testuser').person | |
| 112 | + | |
| 113 | + root = fast_create(Blog, :name => 'test-blog', :profile_id => profile.id) | |
| 114 | + | |
| 115 | + block = RecentContentBlock.new | |
| 116 | + block.stubs(:holder).returns(profile) | |
| 117 | + block.selected_folder = root.id | |
| 118 | + block.presentation_mode = 'title_and_abstract' | |
| 119 | + | |
| 120 | + ActionView::Base.any_instance.expects(:block_title).returns("Block Title") | |
| 121 | + ActionView::Base.any_instance.expects(:profile).returns(profile) | |
| 122 | + | |
| 123 | + content = render_block_content(block) | |
| 124 | + | |
| 125 | + assert_match /Block Title/, content | |
| 126 | + end | |
| 127 | + | |
| 128 | + should 'show the title and the child full content when the block has a root and has no mode set' do | |
| 129 | + profile = create_user('testuser').person | |
| 130 | + | |
| 131 | + root = fast_create(Blog, :name => 'test-blog', :profile_id => profile.id) | |
| 132 | + | |
| 133 | + block = RecentContentBlock.new | |
| 134 | + block.stubs(:holder).returns(profile) | |
| 135 | + block.selected_folder = root.id | |
| 136 | + block.presentation_mode = '' | |
| 137 | + | |
| 138 | + ActionView::Base.any_instance.expects(:block_title).returns("Block Title") | |
| 139 | + ActionView::Base.any_instance.expects(:profile).returns(profile) | |
| 140 | + | |
| 141 | + content = render_block_content(block) | |
| 142 | + | |
| 143 | + assert_match /Block Title/, content | |
| 144 | + end | |
| 145 | +end | ... | ... |
plugins/recent_content/views/blocks/recent_content.html.erb
0 → 100644
| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | +<% unless block.root.nil? %> | |
| 2 | + <div id="recent-content-block"> | |
| 3 | + <% children = block.articles_of_folder(block.root, block.total_items)%> | |
| 4 | + <div class="recent-content"> | |
| 5 | + <%= block_title(block.title.blank? ? c_("Recent content") : block.title, block.subtitle ) %> | |
| 6 | + <% if block.show_blog_picture and !block.root.image.nil? %> | |
| 7 | + <div class="recent-content-cover"> | |
| 8 | + <%= image_tag(block.root.image.public_filename(:big)) %> | |
| 9 | + </div> | |
| 10 | + <% end %> | |
| 11 | + </div> | |
| 12 | + <% if block.mode?('title_only') %> | |
| 13 | + <div class="recent-content-title"> | |
| 14 | + <ul> | |
| 15 | + <% children.each do |item| %> | |
| 16 | + <li> <%= link_to(h(item.title), item.url)%></li> | |
| 17 | + <% end %> | |
| 18 | + </ul> | |
| 19 | + </div> | |
| 20 | + <% elsif block.mode?('title_and_abstract') %> | |
| 21 | + <div class="recent-content-abstract"> | |
| 22 | + <% children.each do |item| %> | |
| 23 | + <h2><%= link_to(item.title,item.url, :class => 'post-title')%></h2> | |
| 24 | + <span class="post-date"><%= show_date(item.published_at, true)%></span> | |
| 25 | + <div class="headline"><%=item.lead%></div> | |
| 26 | + <p class="highlighted-news-read-more"><%= link_to(_('Read more'), item.url) %></p> | |
| 27 | + <% end %> | |
| 28 | + </div> | |
| 29 | + <% else %> | |
| 30 | + <div class="recent-content-full"> | |
| 31 | + <% children.each do |item| %> | |
| 32 | + <h2><%= link_to(item.title,item.url, :class => 'post-title')%></h2> | |
| 33 | + <span class="post-date"><%= show_date(item.published_at, true)%></span> | |
| 34 | + <div class="headline"><%=item.body%></div> | |
| 35 | + <p class="highlighted-news-read-more"><%= link_to(_('Read more'), item.url) %></p> | |
| 36 | + <% end %> | |
| 37 | + </div> | |
| 38 | + <% end %> | |
| 39 | + <%= link_to _('View All'), :profile => profile.identifier, :controller => 'content_viewer', :action => 'view_page', :page => block.root.path %> | |
| 40 | + </div> | |
| 41 | +<% else %> | |
| 42 | + <span class="alert-block"> | |
| 43 | + <%= _('This is the recent content block. Please edit it to show the content you want.') %> | |
| 44 | + </span> | |
| 45 | +<% end %> | ... | ... |
plugins/recent_content/views/blocks/recent_content_block.html.erb
| ... | ... | @@ -1,45 +0,0 @@ |
| 1 | -<% unless root.nil? %> | |
| 2 | - <div id="recent-content-block"> | |
| 3 | - <% children = block.articles_of_folder(root, block.total_items)%> | |
| 4 | - <div class="recent-content"> | |
| 5 | - <%= block_title(block.title.blank? ? c_("Recent content") : block.title, block.subtitle ) %> | |
| 6 | - <% if block.show_blog_picture and !root.image.nil? %> | |
| 7 | - <div class="recent-content-cover"> | |
| 8 | - <%= image_tag(root.image.public_filename(:big)) %> | |
| 9 | - </div> | |
| 10 | - <% end %> | |
| 11 | - </div> | |
| 12 | - <% if block.mode?('title_only') %> | |
| 13 | - <div class="recent-content-title"> | |
| 14 | - <ul> | |
| 15 | - <% children.each do |item| %> | |
| 16 | - <li> <%= link_to(h(item.title), item.url)%></li> | |
| 17 | - <% end %> | |
| 18 | - </ul> | |
| 19 | - </div> | |
| 20 | - <% elsif block.mode?('title_and_abstract') %> | |
| 21 | - <div class="recent-content-abstract"> | |
| 22 | - <% children.each do |item| %> | |
| 23 | - <h2><%= link_to(item.title,item.url, :class => 'post-title')%></h2> | |
| 24 | - <span class="post-date"><%= show_date(item.published_at, true)%></span> | |
| 25 | - <div class="headline"><%=item.lead%></div> | |
| 26 | - <p class="highlighted-news-read-more"><%= link_to(_('Read more'), item.url) %></p> | |
| 27 | - <% end %> | |
| 28 | - </div> | |
| 29 | - <% else %> | |
| 30 | - <div class="recent-content-full"> | |
| 31 | - <% children.each do |item| %> | |
| 32 | - <h2><%= link_to(item.title,item.url, :class => 'post-title')%></h2> | |
| 33 | - <span class="post-date"><%= show_date(item.published_at, true)%></span> | |
| 34 | - <div class="headline"><%=item.body%></div> | |
| 35 | - <p class="highlighted-news-read-more"><%= link_to(_('Read more'), item.url) %></p> | |
| 36 | - <% end %> | |
| 37 | - </div> | |
| 38 | - <% end %> | |
| 39 | - <%= link_to _('View All'), :profile => profile.identifier, :controller => 'content_viewer', :action => 'view_page', :page => block.root.path %> | |
| 40 | - </div> | |
| 41 | -<% else %> | |
| 42 | - <span class="alert-block"> | |
| 43 | - <%= _('This is the recent content block. Please edit it to show the content you want.') %> | |
| 44 | - </span> | |
| 45 | -<% end %> |