lfzawacki/musical-artifacts

View on GitHub
app/views/licenses/_cc.html.haml

Summary

Maintainability
Test Coverage
- name = artifact.license.short_name
- link = t("licenses.link.cc", type: name)
- img = image_tag(artifact.license.image_url(small))

- parts = artifact.license.name_parts.map do |part|
  - t("licenses.#{small ? 'small_' : ''}name_parts.#{part}")

- number = artifact.license.cc_license_number

- license_translation = if number == 3
  - "licenses.text.cc_3"
- else
  - "licenses.text.cc"

- text = t(license_translation, parts: parts.join('-'))

- if small
  = link_to img, artifacts_path(license: artifact.license.short_name)
  = link_to text, artifacts_path(license: artifact.license.short_name)

- else
  = link_to img, link

  .license-terms
    = link_to text, link
    %br

    - artifact.license.name_parts.each do |part|
      %span.label.license-label.label-default= t("licenses.parts.#{part}")