Module: CreativeCommonsRails::ActionViewHelpers
- Defined in:
- lib/creative_commons_rails/action_view_helpers.rb
Instance Method Summary collapse
-
#cc_license_tags(type, options = {}) ⇒ Object
generates an image/link to the desired CC license.
Instance Method Details
#cc_license_tags(type, options = {}) ⇒ Object
generates an image/link to the desired CC license
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/creative_commons_rails/action_view_helpers.rb', line 7 def (type, = {}) # merge options with defaults and convert to correct data types = .merge() [:version] = "%.1f" % [:version] [:jurisdiction] = [:jurisdiction].to_sym [:size] = [:size].to_sym # get license data (exception raised if not found) l = LicenseInfo.find({type: type}.merge()) html = "" html << link_to(l.deed_url, rel: 'license') do image_tag(l.icon_url([:size]), alt: l.translated_title, style: "border-width:0") end html << "<br />" html << I18n.t(:license_notice, license_title: link_to(l.translated_title, l.deed_url, rel: 'license')) html.html_safe end |