Skip to content

Commit

Permalink
Fix admin redesign module (decidim#11648)
Browse files Browse the repository at this point in the history
* Fix admin redesign module

* More admin customizations

* Lint erb

* Remove components sidebar

* Apply review recommendations
  • Loading branch information
alecslupu authored Oct 5, 2023
1 parent 72a7ad0 commit d15dcd6
Show file tree
Hide file tree
Showing 23 changed files with 341 additions and 345 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
<%= cell("decidim/announcement", announcement_body, callout_class: current_user.admin_terms_accepted? ? "success" : "warning" ) %>

<div class="item_show__header">
<h2 class="item_show__header-title">
<%= t("title", scope: "decidim.admin.admin_terms_of_service") %>
</h2>
</div>

<article class="card">
<div class="card-section p-4">
<div class="cell medium-12">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<div class="form__wrapper">
<div class="card">
<div class="card-divider"></div>

<div class="card pt-4">
<div class="card-section">
<div class="row column">
<%= form.translated :text_field, :name, autofocus: true, aria: { label: :name } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<div class="item__edit item__edit-1col">
<div class="item__edit-form">
<%= decidim_form_for(@form, url: url_for([@attachment_collection.collection_for, @attachment_collection]), html: { class: "form form-defaults edit_attachment_collection" }) do |f| %>
<%= render partial: "decidim/admin/attachment_collections/form", object: f, locals: { title: t("attachment_collections.edit.title", scope: "decidim.admin") } %>
<%= render partial: "decidim/admin/attachment_collections/form", object: f %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t("attachment_collections.edit.update", scope: "decidim.admin"), class: "button button__sm button__secondary" %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="item__edit item__edit-1col">
<div class="item__edit-form">
<%= decidim_form_for(@form, url: url_for([collection_for, @form]), html: { class: "form form-defaults new_attachment_collection" }) do |f| %>
<%= render partial: "decidim/admin/attachment_collections/form", object: f, locals: { title: t("attachment_collections.new.title", scope: "decidim.admin") } %>
<%= render partial: "decidim/admin/attachment_collections/form", object: f %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t("attachment_collections.new.create", scope: "decidim.admin"), class: "button button__sm button__secondary" %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<div class="form__wrapper">
<div class="card">
<div class="card-divider">
<h2 class="card-title">
<%= title %>
</h2>
</div>

<div class="card pt-4">
<div class="card-section">
<div class="row column">
<%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
<%= t(".title") %>
</h2>
</div>

<div class="item__edit item__edit-1col">
<div class="item__edit-form">
<%= decidim_form_for(@form, url: url_for([@attachment.attached_to, @attachment]), html: { class: "form form-defaults edit_attachment" }) do |f| %>
<%= render partial: "decidim/admin/attachments/form", object: f, locals: { title: t(".title") } %>
<%= render partial: "decidim/admin/attachments/form", object: f %>

<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<% add_decidim_page_title(t(".title")) %>
<div class="item_show__header">
<h2 class="item_show__header-title">
<%= t(".title") %>
</h2>
</div>

<div class="item__edit item__edit-1col">
<div class="item__edit-form">
<%= decidim_form_for(@form, url: url_for([attached_to, @form]), html: { class: "form form-defaults new_attachment" }) do |f| %>
<%= render partial: "decidim/admin/attachments/form", object: f, locals: { title: t(".title") } %>
<%= render partial: "decidim/admin/attachments/form", object: f %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t(".create"), class: "button button__sm button__secondary" %>
Expand Down
62 changes: 36 additions & 26 deletions decidim-admin/app/views/decidim/admin/block_user/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
<h2 class="process-title-summary">
<%= t(".title", name: user.name) %>
</h2>
<div class="item_show__header">
<h2 class="item_show__header-title">
<%= t(".title", name: user.name) %>
</h2>
</div>

<%= decidim_form_for(@form, html: { class: "form new_user_block" }, url: user_block_path(user_id: user.id), method: :post) do |f| %>
<div class="card">
<div class="card-section">
<div class="row column">
<%= t(".description") %>
</div>
<br>
<% if @form.hide %>
<% announcement_message = t(".already_reported_html", link: new_user_block_path(user_id: user.id)) %>
<%= cell("decidim/announcement", announcement_message, callout_class: "alert" ) %>
<% end %>
<div class="item__edit item__edit-1col">
<div class="item__edit-form">
<%= decidim_form_for(@form, url: user_block_path(user_id: user.id), method: :post, html: { class: "form-defaults form import_participatory_process" }) do |f| %>
<div class="form__wrapper">
<div class="card pt-4">
<div class="card-section">
<div class="row column">
<%= t(".description") %>
</div>

<% if @form.hide %>
<% announcement_message = t(".already_reported_html", link: new_user_block_path(user_id: user.id)) %>
<%= cell("decidim/announcement", announcement_message, callout_class: "alert" ) %>
<% end %>

<% if defined?(Decidim::Templates) %>
<%= render "decidim/templates/admin/block_user_templates/template_chooser", form: f %>
<% end %>
<% if defined?(Decidim::Templates) %>
<%= render "decidim/templates/admin/block_user_templates/template_chooser", form: f %>
<% end %>

<div class="row column">
<%= f.hidden_field :user_id %>
<%= f.hidden_field :hide %>
<%= f.text_area :justification, required: true, label: t(".justification") %>
<div class="row column">
<%= f.hidden_field :user_id %>
<%= f.hidden_field :hide %>
<%= f.text_area :justification, required: true, label: t(".justification") %>
</div>
</div>
</div>
</div>
</div>
</div>

<div class="form__wrapper-block flex-col-reverse md:flex-row justify-between">
<%= f.submit t(".action"), class: "button button__sm button__secondary" %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t(".action"), class: "button button__sm button__secondary" %>
</div>
</div>
<% end %>
</div>
<% end %>
</div>
11 changes: 1 addition & 10 deletions decidim-admin/app/views/decidim/admin/categories/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<div class="form__wrapper">
<div class="card" data-component="accordion" id="accordion-title">
<div class="card-divider">
<button class="card-divider-button" data-open="true" data-controls="panel-title" type="button">
<%= icon "arrow-right-s-line" %>
<h2 class="card-title" id="title">
<%= title %>
</h2>
</button>
</div>

<div class="card pt-4">
<div id="panel-title" class="card-section">
<div class="row column">
<%= form.translated :text_field, :name, autofocus: true, aria: { label: :name } %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="item__edit item__edit-1col">
<div class="item__edit-form">
<%= decidim_form_for(@form, url: category_path(@category.participatory_space, @category), html: { class: "form-defaults form edit_category" }) do |f| %>
<%= render partial: "form", object: f, locals: { title: t(".title") } %>
<%= render partial: "form", object: f %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t("categories.edit.update", scope: "decidim.admin"), class: "button button__sm button__secondary" %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div class="item__edit item__edit-1col">
<div class="item__edit-form">
<%= decidim_form_for(@form, url: categories_path(current_participatory_space), html: { class: "form-defaults form new_category" }) do |f| %>
<%= render partial: "form", object: f, locals: { title: t("categories.new.title", scope: "decidim.admin") } %>
<%= render partial: "form", object: f %>
<div class="item__edit-sticky">
<div class="item__edit-sticky-container">
<%= f.submit t("categories.new.create", scope: "decidim.admin"), class: "button button__sm button__secondary" %>
Expand Down
6 changes: 4 additions & 2 deletions decidim-admin/app/views/decidim/admin/dashboard/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<% add_decidim_page_title(t("decidim.admin.titles.dashboard")) %>

<h2 class="text-xl font-bold pb-4 border-b border-gray mb-4">
<div class="item_show__header">
<h2 class="item_show__header-title">
<%= t "decidim.admin.titles.dashboard" %> <%= current_organization.name %>
</h2>
</h2>
</div>

<div class="content">
<% unless current_user.admin_terms_accepted? %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
</div>
<% end %>

<div class="item_show__header">
<h2 class="item_show__header-title">
<%= t "decidim.admin.titles.impersonatable_users" %>
<% if allowed_to? :impersonate, :impersonatable_user, user: new_managed_user %>
<%= link_to t(".impersonate_new_managed_user"), new_impersonatable_user_impersonation_path(:new_managed_user), class: "button button__sm button__secondary #{"disabled" if current_organization.available_authorizations.empty?}" %>
<% end %>
</h2>
</div>

<div class="filters__section">
<div class="fcell">
<ul class="dropdown menu" data-dropdown-menu data-close-on-click-inside="false">
Expand Down Expand Up @@ -39,14 +48,6 @@
</div>

<div class="card">
<div class="item_show__header">
<h2 class="item_show__header-title">
<%= t "decidim.admin.titles.impersonatable_users" %>
<% if allowed_to? :impersonate, :impersonatable_user, user: new_managed_user %>
<%= link_to t(".impersonate_new_managed_user"), new_impersonatable_user_impersonation_path(:new_managed_user), class: "button button__sm button__secondary #{"disabled" if current_organization.available_authorizations.empty?}" %>
<% end %>
</h2>
</div>
<div class="table-scroll">
<table class="table-list">
<thead>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="form__wrapper">
<div class="card">
<div class="card pt-4">
<div class="card-section">
<div class="row column">
<%= form.text_field :reason, label: t(".reason") %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<% if report.details.blank? %>
<%= t(".reasons.#{report.reason}") %>
<% else %>
<span
data-tooltip
title="<%= report.details&.truncate(250) %>">
<%= t(".reasons.#{report.reason}") %>
</span>
<%= with_tooltip(strip_tags(report.details), class: :top) { t(".reasons.#{report.reason}") } %>
<% end %>
117 changes: 57 additions & 60 deletions decidim-admin/app/views/decidim/admin/moderated_users/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,68 +1,65 @@
<% add_decidim_page_title(t(".title")) %>
<div class="card">
<div class="card-divider mb-4">
<h2 class="card-title">
<div class="item_show__header">
<h2 class="item_show__header-title">
<%= t(".title") %>

<%= t(".title") %>
<div class="card__filter">
<%= link_to t("decidim.admin.moderated_users.tabs.unblocked"), moderated_users_path %>
|
<%= link_to t("decidim.admin.moderated_users.tabs.blocked"), moderated_users_path(blocked: true) %>
</div>
</h2>
</div>

<div class="card__filter">
<%= link_to t("decidim.admin.moderated_users.tabs.unblocked"), moderated_users_path %>
|
<%= link_to t("decidim.admin.moderated_users.tabs.blocked"), moderated_users_path(blocked: true) %>
</div>
</h2>
</div>
<%= admin_filter_selector(:moderated_users) %>
<div class="table-scroll">
<table class="table-list">
<thead>
<tr>
<th><%= t(".name") %></th>
<th><%= t(".nickname") %></th>
<th><%= t(".reason") %></th>
<th><%= sort_link(query, :created_at, t("models.moderation.fields.created_at", scope: "decidim.moderations")) %></th>
<th><%= sort_link(query, :report_count, t(".reports"), default_order: :desc) %></th>
<th class="actions"><%= t(".actions.title") %></th>
</tr>
</thead>
<tbody>
<% @moderated_users.each do |moderation| %>
<tr data-id="<%= moderation.id %>">
<% if moderation.user.nickname.present? %>
<td><%= link_to moderation.user.name, decidim.profile_path(moderation.user.nickname) %></td>
<td><%= link_to moderation.user.nickname, decidim.profile_path(moderation.user.nickname) %></td>
<% else %>
<td><%= moderation.user.name %></td>
<td><%= moderation.user.nickname %></td>
<% end %>
<td>
<% reports = moderation.reports.map { |report| render "report", report: } %>
<%= safe_join(reports, ",") %>
</td>
<td>
<%= l moderation.created_at, format: :decidim_short %>
</td>
<td>
<%= moderation.report_count %>
</td>

<%= admin_filter_selector(:moderated_users) %>
<div class="table-scroll">
<table class="table-list">
<thead>
<tr>
<th><%= t(".name") %></th>
<th><%= t(".nickname") %></th>
<th><%= t(".reason") %></th>
<th><%= sort_link(query, :created_at, t("models.moderation.fields.created_at", scope: "decidim.moderations")) %></th>
<th><%= sort_link(query, :report_count, t(".reports"), default_order: :desc) %></th>
<th class="actions"><%= t(".actions.title") %></th>
</tr>
</thead>
<tbody>
<% @moderated_users.each do |moderation| %>
<tr data-id="<%= moderation.id %>">
<% if moderation.user.nickname.present? %>
<td><%= link_to moderation.user.name, decidim.profile_path(moderation.user.nickname) %></td>
<td><%= link_to moderation.user.nickname, decidim.profile_path(moderation.user.nickname) %></td>
<% else %>
<td><%= moderation.user.name %></td>
<td><%= moderation.user.nickname %></td>
<td class="actions">
<% if !moderation.user.blocked? && allowed_to?(:unreport, :moderate_users) %>
<%= icon_link_to "arrow-go-back-line", ignore_moderated_user_path(id: moderation), t(".actions.unreport"), class: "action-icon--unreport", method: :put %>
<% end %>
<td> <%#= moderation.reason %>
<% reports = moderation.reports.map { |report| render "report", report: } %>
<%= safe_join(reports, ",") %>
</td>
<td>
<%= l moderation.created_at, format: :decidim_short %>
</td>
<td>
<%= moderation.report_count %>
</td>

<td class="actions">
<% if !moderation.user.blocked? && allowed_to?(:unreport, :moderate_users) %>
<%= icon_link_to "arrow-go-back-line", ignore_moderated_user_path(id: moderation), t(".actions.unreport"), class: "action-icon--unreport", method: :put %>
<% if allowed_to?(:block, :moderate_users) %>
<% if moderation.user.blocked? %>
<%= icon_link_to "forbid-2-line", user_block_path(user_id: moderation.user.id), t(".actions.unblock"), class: "action-icon action-icon--disabled", method: :delete %>
<% else %>
<%= icon_link_to "forbid-2-line", new_user_block_path(user_id: moderation.user.id), t(".actions.block"), class: "action-icon action-icon" %>
<% end %>
<% if allowed_to?(:block, :moderate_users) %>
<% if moderation.user.blocked? %>
<%= icon_link_to "forbid-2-line", user_block_path(user_id: moderation.user.id), t(".actions.unblock"), class: "action-icon action-icon--disabled", method: :delete %>
<% else %>
<%= icon_link_to "forbid-2-line", new_user_block_path(user_id: moderation.user.id), t(".actions.block"), class: "action-icon action-icon" %>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<%= decidim_paginate @moderated_users %>
Loading

0 comments on commit d15dcd6

Please sign in to comment.