Commit 539c4197f16e7efe04bf2ee0bedc316119881838
1 parent
114a2689
Exists in
master
and in
28 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,7 +23,8 @@ class DisplayContentBlock < Block | ||
23 | {:name => _('Title'), :checked => true}, | 23 | {:name => _('Title'), :checked => true}, |
24 | {:name => _('Abstract'), :checked => true}, | 24 | {:name => _('Abstract'), :checked => true}, |
25 | {:name => _('Body'), :checked => false}, | 25 | {:name => _('Body'), :checked => false}, |
26 | - {:name => _('Image'), :checked => false}] | 26 | + {:name => _('Image'), :checked => false}, |
27 | + {:name => _('Tags'), :checked => false}] | ||
27 | 28 | ||
28 | def self.description | 29 | def self.description |
29 | _('Display your contents') | 30 | _('Display your contents') |
@@ -65,8 +66,10 @@ class DisplayContentBlock < Block | @@ -65,8 +66,10 @@ class DisplayContentBlock < Block | ||
65 | 66 | ||
66 | block_title(title) + | 67 | block_title(title) + |
67 | content_tag('ul', docs.map {|item| | 68 | content_tag('ul', docs.map {|item| |
69 | + debugger | ||
68 | 70 | ||
69 | read_more_section = '' | 71 | read_more_section = '' |
72 | + tags_section = '' | ||
70 | 73 | ||
71 | sections.select { |section| | 74 | sections.select { |section| |
72 | case section[:name] | 75 | case section[:name] |
@@ -86,13 +89,20 @@ class DisplayContentBlock < Block | @@ -86,13 +89,20 @@ class DisplayContentBlock < Block | ||
86 | if !image_section.blank? | 89 | if !image_section.blank? |
87 | content_sections += (display_section?(section) ? (content_tag('div', link_to( image_section, item.url ) ,:class => 'image')) : '' ) | 90 | content_sections += (display_section?(section) ? (content_tag('div', link_to( image_section, item.url ) ,:class => 'image')) : '' ) |
88 | end | 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 | end | 99 | end |
90 | } | 100 | } |
91 | 101 | ||
92 | content_sections += read_more_section if !read_more_section.blank? | 102 | content_sections += read_more_section if !read_more_section.blank? |
93 | 103 | ||
94 | content_tag('li', content_sections) | 104 | content_tag('li', content_sections) |
95 | - }.join("\n")) | 105 | + }.join(" ")) |
96 | 106 | ||
97 | end | 107 | end |
98 | 108 | ||
@@ -110,7 +120,7 @@ class DisplayContentBlock < Block | @@ -110,7 +120,7 @@ class DisplayContentBlock < Block | ||
110 | def display_section?(section) | 120 | def display_section?(section) |
111 | section[:checked] | 121 | section[:checked] |
112 | end | 122 | end |
113 | - | 123 | + |
114 | protected | 124 | protected |
115 | 125 | ||
116 | def holder | 126 | def holder |
plugins/display_content/public/style.css
@@ -20,8 +20,19 @@ | @@ -20,8 +20,19 @@ | ||
20 | .block.display-content-block .lead, | 20 | .block.display-content-block .lead, |
21 | .block.display-content-block .body, | 21 | .block.display-content-block .body, |
22 | .block.display-content-block .image, | 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 | margin: 2px 0px 2px 0px; | 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 | +} |