Sha256: e1edaf5c62db63a33e63c982434ac371d9be1cce874b34662267794c6dbf3968

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

- group = entity.class.to_s.demodulize.underscore
%table.table.mb-0
  %tbody
    - if entity.users.count.positive?
      - entity.users.each do |user|
        %tr
          %td
            - if policy(user).read?
              %a{ href: "#{settings.map_path}/users/#{user.id}" }
                = user.username
            - else
              = user.username
          %td.text-right
            = delete_form_tag "#{base_path}/#{entity.display_id}/users/#{user.id}" do
              %button.btn.btn-danger.btn-sm{ type: 'submit' } ×
    - else
      %tr
        %td{ colspan: 2 } No Users Associated
    %tr
      %td{ colspan: 2 }
        - users = user_options.select { |k, v| entity.users.map(&:id).include?(k) == false }
        - if users && users.count.positive?
          = new_form_tag "#{base_path}/#{entity.display_id}/users" do
            .input-group
              %select.form-control{ name: "#{group}[user_id]", id: 'user_id' }
                %option{ value: '' } Select User
                - users.each do |key, value|
                  %option{ value: key }= value
              %span.input-group-append
                %button.btn.btn-primary{ type: 'submit' } Add User
        - else
          No Users available to link

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ditty-0.10.1 views/partials/user_associations.haml