app/views/media_resources/_relations.html.haml

Summary

Maintainability
Test Coverage
.ui-container.bright.rounded-right.rounded-bottom.pal
  .row
    .col4of6
      %h2.title-m
        = find_and_preserve @description.split("\n").join('<br>')

    .col2of6
      - if @self.user == current_user
        %a.primary-button.right{:title => _("Visualize relationship between items as a graph"), :href => "/visualization/my_component_with/#{@self.id}" }
          %i.icon-vis-graph.mid
          = _("Show connections")

-# Parent Sets
.ui-container.midtone-darker.bordered-bottom.bordered-top.relationships-wrapper
  .ui-resources-holder{id: "set-relations-parents"}
    .ui-resources-header.mbn
      %h2.title-l.ui-resource-title.mtl.mll
        = _("Übergeordnete Sets")
        %span.ui-counter= _("(#{@parents.count})")
        - if @parents.count > 0
          %a.strong{:href => '?type=parents'} 
            = _("Show all")

    = render :partial => "media_resources/list",
             :locals => {:media_resources => @parents.first(12),
                         :layout => 'grid horizontal',
                         :no_content_msg => "Keine übergeordneten Sets",
                         :with_actions => false}
  
-# Self & Sibblings
.ui-container.bright.relationships-wrapper.relationships-this-wrapper{ class: @is_set ? 'pointing-bottom' : 'rounded-bottom' }

  -# Self
  .ui-container.bright.pointing-right.relationships-this.bordered-right{ class: @is_set ? '' : 'rounded-bottom-left' }
    .pointing-top
      #set-relations-self.ui-resources-holder
        .ui-resources-header.mbn
          %h2.title-l.ui-resource-title.mtl.mll
            - if @is_set
              = _("Aktuelles Set")
            - else
              = _("Aktueller Eintrag")

        = render :partial => "media_resources/list",
                 :locals => {:media_resources => [@self],
                             :layout => 'grid horizontal',
                             :with_actions => false}

  -# Siblings
  .ui-container.midtone.relationships-siblings{ class: @is_set ? '' : 'rounded-bottom-right' }
    .ui-resources-holder{id: "set-relations-siblings"}
      .ui-resources-header.mbn
        %h2.title-l.ui-resource-title.mtl.mll
          = _("Benachbarte Sets")
          %span.ui-counter= _("(#{@siblings.count})")
          - if @siblings.count > 0
            %a.strong{:href => '?type=siblings'} 
              = _("Show all")

      = render :partial => "media_resources/list",
               :locals => {:media_resources => @siblings.first(12),
                           :layout => 'grid horizontal',
                           :no_content_msg => "Keine benachbarten Sets",
                           :with_actions => false}

-# Children Sets
- if @is_set
  .ui-container.midtone-darker.relationships-wrapper.bordered-top
    .ui-resources-holder{id: "set-relations-children"}
      .ui-resources-header.mbn
        %h2.title-l.ui-resource-title.mtl.mll
          = _("Untergeordnete Sets")
          %span.ui-counter= _("(#{@children.count})")
          - if @children.count > 0
            %a.strong{:href => "?type=children"}
              = _("Alle anzeigen")

      = render :partial => "media_resources/list",
               :locals => {:media_resources => @children.first(12),
                           :layout => 'grid horizontal',
                           :no_content_msg => "Keine untergeordneten Sets",
                           :with_actions => false}