<commit_before>=h1 "Les derniers comptes créés"

= form_tag admin_accounts_path, method: :get do
  %input(type="text" name="login" value="#{@login}" placeholder="Filtrer par pseudo")
  %input(type="date" name="date" value="#{@date}" placeholder="Filtrer par date (YYYY-MM-DD)")
  %input(type="text" name="ip" value="#{@ip}" placeholder="Filtrer par adresse IP")
  %input(type="text" name="email" value="#{@email}" placeholder="Filtrer par courriel")
  = check_box_tag 'inactive', 'inactive', @inactive=="inactive"
  %label(for="inactive") Inactifs
  %input(type="submit" value="Filtrer")

%table
  %tr
    %th Pseudo / Courriel
    %th Karma
    %th Adresse IP courante / précédente
    %th Commentaires / contenus / étiquettes
    %th Date de création
    %th Actions
    %th Changer de rôle
  - @accounts.each do |account|
    %tr
      %td
        = link_to account.login, account.user
        - if account.inactive?
          = image_tag "/images/icones/x_red.svg", alt: "Inactif", title: "Inactif", width: "15px"
        - else
          = image_tag "/images/icones/check.svg", alt: "Actif", title: "Actif", width: "16px"
        %br
        = account.email
        - if account.user.homesite
          %br
          = account.user.homesite
      %td= account.karma
      %td
        - if account.current_sign_in_ip != account.last_sign_in_ip
          #{ account.current_sign_in_ip }&nbsp;/ #{ account.last_sign_in_ip }
        - else
          = account.current_sign_in_ip
      %td
        - if account.user.comments.count > 0
          = image_tag "/images/icones/comment.png", alt: "Commentaires", title: "Commentaires", width: "16px"
          #{ account.user.comments.published.count }
          #{ image_tag "/images/icones/check_alt.png", alt: "visibles", title: "visibles", width: "16px" }
          - if account.user.comments.count - account.user.comments.published.count > 0
            #{ (account.user.comments.count - account.user.comments.published.count) }
            #{ image_tag "/images/icones/denied.png", alt: "masqués", title: "masqués", width: "16px" }
          %br
        - if account.user.nodes.count > 0
          = image_tag "/images/icones/pen.png", alt: "Contenus", title: "Contenus", width: "16px"
          #{ account.user.nodes.visible.count }
          #{ image_tag "/images/icones/check_alt.png", alt: "visibles", title: "visibles", width: "16px" }
          - if account.user.nodes.count - account.user.nodes.visible.count > 0
            #{ (account.user.nodes.count - account.user.nodes.visible.count) }
            #{ image_tag "/images/icones/denied.png", alt: "masqués ou non modérés", title: "masqués ou non modérés", width: "16px" }
          %br
        - if account.user.tags.count > 0
          = image_tag "/images/icones/tag.png", alt: "Étiquettes", title: "Étiquettes", width: "16px"
          #{ account.user.tags.visible.count }
          #{ image_tag "/images/icones/check_alt.png", alt: "visibles", title: "visibles", width: "16px" }
          - if account.user.tags.count - account.user.tags.visible.count > 0
            #{ (account.user.tags.count - account.user.tags.visible.count) }
            #{ image_tag "/images/icones/denied.png", alt: "masqués", title: "masqués", width: "16px" }
          %br
      %td= account.created_at.to_s(:posted)
      %td
        - if account.inactive? && account.user_id != 1
          = button_to "Activer",   [:admin, account], method: :put, class: "ok_button"
        - elsif !account.inactive?
          = button_to "Réinit. mot de passe", password_admin_account_path(account), class: "reset_password"
          = button_to "Suspendre", [:admin, account], method: :put, class: "delete_button"
      %td
        - if account.editor?
          = button_to "Simple visiteur", admin_account_editor_path(account.id), method: :delete, class: "change_role"
        - elsif account.moderator?
          = button_to "Simple visiteur", admin_account_moderator_path(account.id), method: :delete, class: "change_role"
        - elsif account.admin?
          = button_to "Simple visiteur", admin_account_admin_path(account.id), method: :delete, class: "change_role"
        - elsif !account.inactive?
          = button_to "Mainteneur", admin_account_maintainer_path(account.id), class: "change_role"
          = button_to "Modérateur", admin_account_moderator_path(account.id), class: "change_role"
          = button_to "Animateur", admin_account_editor_path(account.id), class: "change_role"
          = button_to "Admin", admin_account_admin_path(account.id), class: "change_role"

= paginate @accounts<commit_msg>admin/accounts: for maintainers, show the button to remove the role<commit_after>=h1 "Les derniers comptes créés"

= form_tag admin_accounts_path, method: :get do
  %input(type="text" name="login" value="#{@login}" placeholder="Filtrer par pseudo")
  %input(type="date" name="date" value="#{@date}" placeholder="Filtrer par date (YYYY-MM-DD)")
  %input(type="text" name="ip" value="#{@ip}" placeholder="Filtrer par adresse IP")
  %input(type="text" name="email" value="#{@email}" placeholder="Filtrer par courriel")
  = check_box_tag 'inactive', 'inactive', @inactive=="inactive"
  %label(for="inactive") Inactifs
  %input(type="submit" value="Filtrer")

%table
  %tr
    %th Pseudo / Courriel
    %th Karma
    %th Adresse IP courante / précédente
    %th Commentaires / contenus / étiquettes
    %th Date de création
    %th Actions
    %th Changer de rôle
  - @accounts.each do |account|
    %tr
      %td
        = link_to account.login, account.user
        - if account.inactive?
          = image_tag "/images/icones/x_red.svg", alt: "Inactif", title: "Inactif", width: "15px"
        - else
          = image_tag "/images/icones/check.svg", alt: "Actif", title: "Actif", width: "16px"
        %br
        = account.email
        - if account.user.homesite
          %br
          = account.user.homesite
      %td= account.karma
      %td
        - if account.current_sign_in_ip != account.last_sign_in_ip
          #{ account.current_sign_in_ip }&nbsp;/ #{ account.last_sign_in_ip }
        - else
          = account.current_sign_in_ip
      %td
        - if account.user.comments.count > 0
          = image_tag "/images/icones/comment.png", alt: "Commentaires", title: "Commentaires", width: "16px"
          #{ account.user.comments.published.count }
          #{ image_tag "/images/icones/check_alt.png", alt: "visibles", title: "visibles", width: "16px" }
          - if account.user.comments.count - account.user.comments.published.count > 0
            #{ (account.user.comments.count - account.user.comments.published.count) }
            #{ image_tag "/images/icones/denied.png", alt: "masqués", title: "masqués", width: "16px" }
          %br
        - if account.user.nodes.count > 0
          = image_tag "/images/icones/pen.png", alt: "Contenus", title: "Contenus", width: "16px"
          #{ account.user.nodes.visible.count }
          #{ image_tag "/images/icones/check_alt.png", alt: "visibles", title: "visibles", width: "16px" }
          - if account.user.nodes.count - account.user.nodes.visible.count > 0
            #{ (account.user.nodes.count - account.user.nodes.visible.count) }
            #{ image_tag "/images/icones/denied.png", alt: "masqués ou non modérés", title: "masqués ou non modérés", width: "16px" }
          %br
        - if account.user.tags.count > 0
          = image_tag "/images/icones/tag.png", alt: "Étiquettes", title: "Étiquettes", width: "16px"
          #{ account.user.tags.visible.count }
          #{ image_tag "/images/icones/check_alt.png", alt: "visibles", title: "visibles", width: "16px" }
          - if account.user.tags.count - account.user.tags.visible.count > 0
            #{ (account.user.tags.count - account.user.tags.visible.count) }
            #{ image_tag "/images/icones/denied.png", alt: "masqués", title: "masqués", width: "16px" }
          %br
      %td= account.created_at.to_s(:posted)
      %td
        - if account.inactive? && account.user_id != 1
          = button_to "Activer",   [:admin, account], method: :put, class: "ok_button"
        - elsif !account.inactive?
          = button_to "Réinit. mot de passe", password_admin_account_path(account), class: "reset_password"
          = button_to "Suspendre", [:admin, account], method: :put, class: "delete_button"
      %td
        - if account.editor?
          = button_to "Simple visiteur", admin_account_editor_path(account.id), method: :delete, class: "change_role"
        - if account.maintainer?
          = button_to "Simple visiteur", admin_account_maintainer_path(account.id), method: :delete, class: "change_role"
        - elsif account.moderator?
          = button_to "Simple visiteur", admin_account_moderator_path(account.id), method: :delete, class: "change_role"
        - elsif account.admin?
          = button_to "Simple visiteur", admin_account_admin_path(account.id), method: :delete, class: "change_role"
        - elsif !account.inactive?
          = button_to "Mainteneur", admin_account_maintainer_path(account.id), class: "change_role"
          = button_to "Modérateur", admin_account_moderator_path(account.id), class: "change_role"
          = button_to "Animateur", admin_account_editor_path(account.id), class: "change_role"
          = button_to "Admin", admin_account_admin_path(account.id), class: "change_role"

= paginate @accounts
{'fraction_non_alphanumeric': 0.14444797963728923, 'fraction_numerical': 0.006363347120585428, 'mean_word_length': 2.9096185737976783, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '398582', 'n_tokens_mistral': 3122, 'n_tokens_neox': 3127, 'n_words': 646}