- set_title t('documents.admin')

= link_to members_control_panel_path do
  .samf-button.plain.mb-3
    = t("common.back")

%h1.mb-2.mt-2
  = t("documents.admin")

- if can? :new, Event
  = link_to new_document_path do
    .samf-button.green.mb-3
      = t('documents.new_document')

%table
  %thead
    %tr
      %th= t('documents.title')
      %th= t('documents.publication_date')
      %th= t('documents.uploader')
      %th
      %th
  - @categories.each do |category|
    %tbody
      %tr.category
        %td{colspan: 5}
          = category.title
      - if category.documents.empty?
        %tr.empty
          %td{colspan: 5}= t('documents.no_documents')
      - else
        - category.documents.each do |document|
          %tr
            %td= link_to document.title, document.file.url
            %td= document.publication_date
            %td= document.uploader.full_name
            %td
              - if can? :edit, document
                = link_to edit_document_path(document) do
                  .samf-button.small.blue
                    = t('crud.edit')
            %td
              - if can? :destroy, document
                = link_to document, data: { confirm: t('documents.confirm_delete') }, method: :delete do
                  .samf-button.small
                    = t('crud.destroy')

- set_title t('documents.admin')

= link_to members_control_panel_path do
  .samf-button.plain.mb-3
    = t("common.back")

%h1.mb-2.mt-2
  = t("documents.admin")

- if can? :new, Document
  = link_to new_document_path do
    .samf-button.green.mb-3
      = t('documents.new_document')

%table
  %thead
    %tr
      %th= t('documents.title')
      %th= t('documents.publication_date')
      %th= t('documents.uploader')
      %th
      %th
  - @categories.each do |category|
    %tbody
      %tr.category
        %td{colspan: 5}
          = category.title
      - if category.documents.empty?
        %tr.empty
          %td{colspan: 5}= t('documents.no_documents')
      - else
        - category.documents.each do |document|
          %tr
            %td= link_to document.title, document.file.url
            %td= document.publication_date
            %td= document.uploader.full_name
            %td
              - if can? :edit, document
                = link_to edit_document_path(document) do
                  .samf-button.small.blue
                    = t('crud.edit')
            %td
              - if can? :destroy, document
                = link_to document, data: { confirm: t('documents.confirm_delete') }, method: :delete do
                  .samf-button.small
                    = t('crud.destroy')

Change the required role for making a new document from Event to Document
Change the required role for making a new document from Event to Document
