Commit 539c4197f16e7efe04bf2ee0bedc316119881838
1 parent
114a2689
Exists in
master
and in
29 other branches
display content plugin : add tags attribute
Showing
2 changed files
with
25 additions
and
4 deletions
Show diff stats
plugins/display_content/lib/display_content_block.rb
| ... | ... | @@ -23,7 +23,8 @@ class DisplayContentBlock < Block |
| 23 | 23 | {:name => _('Title'), :checked => true}, |
| 24 | 24 | {:name => _('Abstract'), :checked => true}, |
| 25 | 25 | {:name => _('Body'), :checked => false}, |
| 26 | - {:name => _('Image'), :checked => false}] | |
| 26 | + {:name => _('Image'), :checked => false}, | |
| 27 | + {:name => _('Tags'), :checked => false}] | |
| 27 | 28 | |
| 28 | 29 | def self.description |
| 29 | 30 | _('Display your contents') |
| ... | ... | @@ -65,8 +66,10 @@ class DisplayContentBlock < Block |
| 65 | 66 | |
| 66 | 67 | block_title(title) + |
| 67 | 68 | content_tag('ul', docs.map {|item| |
| 69 | + debugger | |
| 68 | 70 | |
| 69 | 71 | read_more_section = '' |
| 72 | + tags_section = '' | |
| 70 | 73 | |
| 71 | 74 | sections.select { |section| |
| 72 | 75 | case section[:name] |
| ... | ... | @@ -86,13 +89,20 @@ class DisplayContentBlock < Block |
| 86 | 89 | if !image_section.blank? |
| 87 | 90 | content_sections += (display_section?(section) ? (content_tag('div', link_to( image_section, item.url ) ,:class => 'image')) : '' ) |
| 88 | 91 | end |
| 92 | + when 'Tags' | |
| 93 | + if !item.tags.empty? | |
| 94 | + tags_section = item.tags.map { |t| | |
| 95 | + content_tag('span', link_to(t, :host => item.url[:host], :port => item.url[:port], :controller => 'profile', :profile => @box.owner.identifier, :action => 'tags', :id => t.name ) ) | |
| 96 | + }.join("") | |
| 97 | + content_sections += (display_section?(section) ? (content_tag('div', tags_section, :class => 'tags')) : '') | |
| 98 | + end | |
| 89 | 99 | end |
| 90 | 100 | } |
| 91 | 101 | |
| 92 | 102 | content_sections += read_more_section if !read_more_section.blank? |
| 93 | 103 | |
| 94 | 104 | content_tag('li', content_sections) |
| 95 | - }.join("\n")) | |
| 105 | + }.join(" ")) | |
| 96 | 106 | |
| 97 | 107 | end |
| 98 | 108 | |
| ... | ... | @@ -110,7 +120,7 @@ class DisplayContentBlock < Block |
| 110 | 120 | def display_section?(section) |
| 111 | 121 | section[:checked] |
| 112 | 122 | end |
| 113 | - | |
| 123 | + | |
| 114 | 124 | protected |
| 115 | 125 | |
| 116 | 126 | def holder | ... | ... |
plugins/display_content/public/style.css
| ... | ... | @@ -20,8 +20,19 @@ |
| 20 | 20 | .block.display-content-block .lead, |
| 21 | 21 | .block.display-content-block .body, |
| 22 | 22 | .block.display-content-block .image, |
| 23 | -.block.display-content-block .read_more { | |
| 23 | +.block.display-content-block .read_more, | |
| 24 | +.block.display-content-block .tags { | |
| 24 | 25 | margin: 2px 0px 2px 0px; |
| 25 | 26 | } |
| 26 | 27 | |
| 28 | +.block.display-content-block .tags span { | |
| 29 | + margin-right: 3px; | |
| 30 | +} | |
| 27 | 31 | |
| 32 | +.block.display-content-block .tags a { | |
| 33 | + text-decoration: none; | |
| 34 | + -webkit-border-radius: 3px; | |
| 35 | + background-color: #BBB; | |
| 36 | + color: #FFF; | |
| 37 | + padding: 2px; | |
| 38 | +} | ... | ... |