Adds a tab for the media section
# File vendor/plugins/ubiquo_media/lib/ubiquo_media/extensions/helper.rb, line 6
6: def media_tab(navtab)
7: navtab.add_tab do |tab|
8: tab.text = I18n.t("ubiquo.media.media")
9: tab.title = I18n.t("ubiquo.media.media_title")
10: tab.highlights_on({:controller => "ubiquo/assets"})
11: tab.link = ubiquo_assets_path
12: end if ubiquo_config_call(:assets_permit, {:context => :ubiquo_media})
13: end
Return the thumbnail url for a given asset
# File vendor/plugins/ubiquo_media/lib/ubiquo_media/extensions/helper.rb, line 16
16: def thumbnail_url(asset)
17: if asset.asset_type.key == "image"
18: asset.resource.url(:thumb)
19: else
20: types_icons = Ubiquo::Config.context(:ubiquo_media).get(:asset_types_icons)
21: "/images/ubiquo/#{types_icons[asset.asset_type.key.to_sym]}"
22: end
23: end
Returns html containing a list of links to documents
instance: ActiveRecord that has the media_attachment field: name of the media_attachment field title: list title
# File vendor/plugins/ubiquo_media/lib/ubiquo_media/extensions/helper.rb, line 47
47: def ubiquo_show_media_attachment_docs instance, field, title
48: html = content_tag(:dt, title)
49: html += content_tag(:dd) do
50: content_tag(:ul, :class => 'attachment') do
51: instance.send(field).map do |asset|
52: content_tag(:li) do
53: link_to asset.name, url_for_media_attachment(asset)
54: end
55: end.join
56: end
57: end
58: end
Returns html containing a list of displayed images
instance: ActiveRecord that has the media_attachment field: name of the media_attachment field title: list title
# File vendor/plugins/ubiquo_media/lib/ubiquo_media/extensions/helper.rb, line 29
29: def ubiquo_show_media_attachment_images instance, field, title
30: html = content_tag(:dt, title)
31: html += content_tag(:dd, :class => 'images') do
32: content_tag(:ul) do
33: instance.send(field).map do |asset|
34: content_tag(:li) do
35: content_tag(:span, image_tag(url_for_media_attachment(asset))) +
36: content_tag(:p, instance.name_for_asset(:field, asset))
37: end
38: end.join
39: end + tag(:br, :style => 'clear:both')
40: end
41: end
Disabled; run with $DEBUG to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.