Commit eaac9e87047d1643b535b96047d9b0692939d88b
1 parent
b2451593
Exists in
master
and in
29 other branches
add read more section
Showing
2 changed files
with
13 additions
and
19 deletions
Show diff stats
plugins/display_content/lib/display_content_block.rb
| ... | ... | @@ -49,21 +49,31 @@ class DisplayContentBlock < Block |
| 49 | 49 | |
| 50 | 50 | block_title(title) + |
| 51 | 51 | content_tag('ul', docs.map {|item| |
| 52 | + | |
| 53 | + read_more_section = '' | |
| 54 | + | |
| 52 | 55 | sections.select { |section| |
| 53 | 56 | case section[:name] |
| 54 | 57 | when 'title' |
| 55 | 58 | content_sections += (display_section?(section) ? (content_tag('div', link_to(h(item.title), item.url), :class => 'title') ) : '') |
| 56 | 59 | when 'abstract' |
| 57 | 60 | content_sections += (display_section?(section) ? (content_tag('div', item.abstract ,:class => 'lead')) : '' ) |
| 61 | + if display_section?(section) | |
| 62 | + content_sections += (display_section?(section) ? (content_tag('div', item.abstract ,:class => 'lead')) : '' ) | |
| 63 | + read_more_section = content_tag('div', link_to(_('Read more'), item.url), :class => 'read_more') | |
| 64 | + end | |
| 58 | 65 | when 'body' |
| 59 | 66 | content_sections += (display_section?(section) ? (content_tag('div', item.body ,:class => 'body')) : '' ) |
| 60 | 67 | when 'image' |
| 61 | 68 | image_section = image_tag item.image.public_filename if item.image |
| 62 | 69 | if !image_section.blank? |
| 63 | - content_sections += (display_section?(section) ? (content_tag('div', image_section ,:class => 'image')) : '' ) | |
| 70 | + content_sections += (display_section?(section) ? (content_tag('div', link_to( image_section, item.url ) ,:class => 'image')) : '' ) | |
| 64 | 71 | end |
| 65 | 72 | end |
| 66 | 73 | } |
| 74 | + | |
| 75 | + content_sections += read_more_section if !read_more_section.blank? | |
| 76 | + | |
| 67 | 77 | content_tag('li', content_sections) |
| 68 | 78 | }.join("\n")) |
| 69 | 79 | ... | ... |
plugins/display_content/public/style.css
| ... | ... | @@ -18,24 +18,8 @@ |
| 18 | 18 | .block.display-content-block .title, |
| 19 | 19 | .block.display-content-block .lead, |
| 20 | 20 | .block.display-content-block .body, |
| 21 | -.block.display-content-block .image { | |
| 21 | +.block.display-content-block .image, | |
| 22 | +.block.display-content-block .read_more { | |
| 22 | 23 | margin: 2px 0px 2px 0px; |
| 23 | 24 | } |
| 24 | 25 | |
| 25 | -.block.display-content-block .title { | |
| 26 | - //border: 1px solid green; | |
| 27 | -} | |
| 28 | - | |
| 29 | -.block.display-content-block .lead { | |
| 30 | - //border: 1px solid purple; | |
| 31 | -} | |
| 32 | - | |
| 33 | -.block.display-content-block .body { | |
| 34 | - //border: 1px solid blue; | |
| 35 | -} | |
| 36 | - | |
| 37 | -.block.display-content-block .image { | |
| 38 | - //border: 1px solid yellow; | |
| 39 | - display: table; | |
| 40 | -} | |
| 41 | - | ... | ... |