lfzawacki/musical-artifacts

View on GitHub
app/views/artifacts/_license.html.haml

Summary

Maintainability
Test Coverage
.license

  - if ['public', 'cc-sample', 'copyleft', 'falv13', 'wtfpl'].include? artifact.license.short_name
    = render "licenses/image_only_license", artifact: artifact, small: small

  - elsif ['various', 'gray'].include? artifact.license.short_name
    = render "licenses/text_only_license", artifact: artifact, small: small

  - else
    = render "licenses/#{artifact.license.license_type}", artifact: artifact, small: small

  - if !artifact.license.free
    .label.label-non-free
      - url = t("licenses.non_free.#{artifact.license.translation_short_name}", default: '')

      - if url.present?
        = link_to url, rel: 'nofollow', target: '_blank' do
          %i.fa.fa-lock
          = t('licenses.non_free_text')
      - else
        %i.fa.fa-lock
        = t('licenses.non_free_text')

  - if artifact.extra_license_text.present?
    .license-text
      %strong
        = t("licenses.extra_text")

      = artifact.extra_license_text_html