Sha256: 37f9c4fa881967e66a8ee3761da8ef28ffd5ef9512ceb486359e962a2c42e4a1

Contents?: true

Size: 1.3 KB

Versions: 13

Compression:

Stored size: 1.3 KB

Contents

- if object.class.show_associations.nil?
  = "Please, fill show associations method in decorator"
- else
  - if object.class.show_associations.map(&:to_s).include? association.name.to_s
    - association_type = association.class.to_s.split('::').last.sub(/Reflection$/, '').underscore.to_sym
    %tr
      %td
        = model_class.human_attribute_name association.name
        %hr
        - if association_type != :has_one || !object.send(association.name).present?
          = link_to "#{I18n.t('helpers.actions.add')} #{model_class.human_attribute_name(association.name).singularize.downcase}", new_associated_record_path(association: association, object: object, as: object.send("#{association.name}_as")), class: 'btn btn-primary'
      %td{ colspan: 2 }
        - if association_type.in? [ :has_one, :belongs_to ]
          %table.table.table-striped.table-bordered
            = render 'tramway/admin/shared/show/associations/table_row', object: object, association: association, association_object: object.send(association.name)
        - else
          %table.table.table-striped.table-bordered
            - object.send(association.name)&.each do |association_object|
              = render 'tramway/admin/shared/show/associations/table_row', object: object, association: association, association_object: association_object

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tramway-admin-4.0.0.1 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-4.0 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-3.0.1.1 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-3.0.1 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-3.0 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-2.1.3.3 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-2.1.3.2 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-2.1.3.1 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-2.1.3 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-2.1.2 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-2.1.1.2 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-2.1.1.1 app/views/tramway/admin/shared/show/associations/_row.html.haml
tramway-admin-2.1.1 app/views/tramway/admin/shared/show/associations/_row.html.haml