Sha256: deccf83adcaf5dd8800ae9e26a089d80b7d708334c9bd4757d9b2e8f89f81942

Contents?: true

Size: 1.34 KB

Versions: 3

Compression:

Stored size: 1.34 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 create_is_available?(association.class_name) && (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/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/shared/show/associations/table_row', object: object, association: association, association_object: association_object

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tramway-0.1.2 app/views/tramway/shared/show/associations/_row.html.haml
tramway-0.1.1.1 app/views/tramway/shared/show/associations/_row.html.haml
tramway-0.1.1 app/views/tramway/shared/show/associations/_row.html.haml