Skip to content

Commit

Permalink
Redesign: replace cells with redesigned versions if present and updat…
Browse files Browse the repository at this point in the history
…e references (#11123)

* Replace cells with redesigned versions if present and update references

* Adapt test

* Remove unused translations

* Remove REDESIGN_PENDING comment

* Update decidim-core/app/cells/decidim/author/flag_user.erb

Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>

* Update decidim-core/app/cells/decidim/card_cell.rb

Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>

* Update decidim-core/app/cells/decidim/endorsement_buttons_cell.rb

Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>

* Improve official author presenter identification in card cell

* Disable endorse button if endorsements blocked even when user is not logged in

* Adapt test

* Enable redesign in admin tests

* Adapt admin pasword tests to redesign

* Update accept_confirm calls with admin

---------

Co-authored-by: Alexandru Emil Lupu <contact@alecslupu.ro>
  • Loading branch information
entantoencuanto and alecslupu committed Jul 7, 2023
1 parent 227e4d5 commit f78a24b
Show file tree
Hide file tree
Showing 117 changed files with 469 additions and 1,482 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
PARALLEL_TEST_PROCESSORS: 2
CODECOV_TOKEN: bc15b944-6b42-420a-b3f9-a5a8fb214326
WEBPACKER_RUNTIME_COMPILE: "false"
REDESIGN_ENABLED: "false"
REDESIGN_ENABLED: "true"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_admin_system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ env:
PARALLEL_TEST_PROCESSORS: 2
CODECOV_TOKEN: bc15b944-6b42-420a-b3f9-a5a8fb214326
WEBPACKER_RUNTIME_COMPILE: "false"
REDESIGN_ENABLED: "false"
REDESIGN_ENABLED: "true"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
Expand Down
3 changes: 3 additions & 0 deletions config/i18n-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ ignore_unused:
- layouts.decidim.conferences.conference.*
- decidim.consultations.show.footer_button_text.*
- decidim.admin.conflicts.*
- decidim.profiles.show.badges
- decidim.profiles.show.conversations
- decidim.profiles.show.groups
- decidim.profiles.show.view_full_profile
- layouts.decidim.assemblies.promoted_assembly.take_part
- versions.dropdown.option_*
Expand Down
4 changes: 4 additions & 0 deletions decidim-admin/spec/shared/manage_impersonations_examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@
end

expect(page).to have_content("successfully")
within_user_menu do
click_link "My public profile"
end

expect(page).to have_content(managed_user.name)

relogin_as user
Expand Down
10 changes: 5 additions & 5 deletions decidim-admin/spec/system/admin_manages_newsletters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def select_all
end

within ".button--double" do
accept_confirm { find("*", text: "Deliver").click }
accept_confirm(admin: true) { find("*", text: "Deliver").click }
end

expect(page).to have_content("Newsletters")
Expand Down Expand Up @@ -243,7 +243,7 @@ def select_all
end

within ".button--double" do
accept_confirm { find("*", text: "Deliver").click }
accept_confirm(admin: true) { find("*", text: "Deliver").click }
end

expect(page).to have_content("Newsletters")
Expand Down Expand Up @@ -280,7 +280,7 @@ def select_all
end

within ".button--double" do
accept_confirm { find("*", text: "Deliver").click }
accept_confirm(admin: true) { find("*", text: "Deliver").click }
end

expect(page).to have_content("Newsletters")
Expand Down Expand Up @@ -324,7 +324,7 @@ def select_all
end

within ".button--double" do
accept_confirm { find("*", text: "Deliver").click }
accept_confirm(admin: true) { find("*", text: "Deliver").click }
end

expect(page).to have_content("Newsletters")
Expand All @@ -345,7 +345,7 @@ def select_all
visit decidim_admin.newsletters_path

within("tr[data-newsletter-id=\"#{newsletter.id}\"]") do
accept_confirm { click_link "Delete" }
accept_confirm(admin: true) { click_link "Delete" }
end

expect(page).to have_content("successfully")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
expect(page).to have_content(other_admin.name)

within "tr[data-user-id=\"#{other_admin.id}\"]" do
accept_confirm { click_link "Delete" }
accept_confirm(admin: true) { click_link "Delete" }
end

expect(page).not_to have_content(other_admin.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

it "can delete them" do
within find("tr", text: translated(area_type.name)) do
accept_confirm { click_link "Delete" }
accept_confirm(admin: true) { click_link "Delete" }
end

expect(page).to have_admin_callout("successfully")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@

def click_delete_area
within find("tr", text: translated(area.name)) do
accept_confirm { click_link "Delete" }
accept_confirm(admin: true) { click_link "Delete" }
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@

it "can delete them" do
within find("tr", text: translated(scope_type.name)) do
accept_confirm { click_link "Delete" }
accept_confirm(admin: true) { click_link "Delete" }
end

expect(page).to have_admin_callout("successfully")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

it "can delete them" do
within find("tr", text: translated(scope.name)) do
accept_confirm { click_link "Delete" }
accept_confirm(admin: true) { click_link "Delete" }
end

expect(page).to have_admin_callout("successfully")
Expand Down
7 changes: 4 additions & 3 deletions decidim-admin/spec/system/admin_passwords_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
it "cannot dismiss password change" do
manual_login(user.email, password)
expect(page).to have_content("Password change")
click_link "user-menu-control"
click_link "Admin dashboard"
within "#admin-bar" do
click_link "Admin dashboard"
end
expect(page).to have_content("You need to change your password in order to proceed further")
expect(page).to have_content("Password change")
expect(page).to have_current_path(decidim.change_password_path)
Expand Down Expand Up @@ -66,7 +67,7 @@
end

def manual_login(email, password)
click_link "Sign In"
click_link "Sign In", match: :first
fill_in :session_user_email, with: email
fill_in :session_user_password, with: password
click_button "Log in"
Expand Down
4 changes: 2 additions & 2 deletions decidim-admin/spec/system/static_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@

it "can delete them" do
within find(".card", text: translated(topic.title)) do
accept_confirm { click_link "Remove topic" }
accept_confirm(admin: true) { click_link "Remove topic" }
end

expect(page).to have_admin_callout("successfully")
Expand Down Expand Up @@ -248,7 +248,7 @@

it "can delete them" do
within find("tr", text: translated(decidim_page.title)) do
accept_confirm { click_link "Delete" }
accept_confirm(admin: true) { click_link "Delete" }
end

expect(page).to have_admin_callout("successfully")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<% else %>
<div class="comment__header">
<span class="font-bold">
<%== cell("decidim/redesigned_author", author_presenter) %>
<%== cell("decidim/author", author_presenter) %>
</span>
<span class="text-gray-2 text-sm">
<%= time_tag created_at, time_ago_in_words(created_at) %>
Expand Down
8 changes: 3 additions & 5 deletions decidim-core/app/cells/decidim/author/comments.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<% if commentable? %>
<%= link_to "#{resource_locator(from_context).path}#comments", title: t("decidim.author.comments", count: from_context.comments_count) do %>
<%= icon "comment-square", class: "icon--small", role: "img", "aria-hidden": true %>
<%= from_context.comments_count %> <%= t("decidim.author.comments", count: from_context.comments_count) %>
<% end %>
<%= link_to "#{resource_locator(from_context).path}#comments", title: t("decidim.author.comments", count: from_context.comments_count), class: "author__metadata" do %>
<%= icon "chat-1-line" if show_icons? %>
<%= from_context.comments_count %> <%= t("decidim.author.comments", count: from_context.comments_count) %>
<% end %>
9 changes: 4 additions & 5 deletions decidim-core/app/cells/decidim/author/date.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<% if creation_date? %>
<span>
<%= creation_date %> &nbsp;
</span>
<% end %>
<span class="author__metadata">
<%= icon "calendar-line" if show_icons? %>
<%= creation_date %>
</span>
8 changes: 3 additions & 5 deletions decidim-core/app/cells/decidim/author/endorsements.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<% if endorsable? %>
<%= link_to "#{resource_locator(from_context).path}#list-of-endorsements", title: t("decidim.author.endorsements",count: from_context.endorsements_count) do %>
<%= icon "bullhorn", class: "icon--small", role: "img", "aria-hidden": true %>
<%= from_context.endorsements_count %> <%= t("decidim.author.endorsements", count: from_context.endorsements_count) %>
<% end %>
<%= link_to "#{resource_locator(from_context).path}#list-of-endorsements", title: t("decidim.author.endorsements", count: from_context.endorsements_count), class: "author__metadata" do %>
<%= icon "heart-add-line" if show_icons? %>
<%= from_context.endorsements_count %> <%= t("decidim.author.endorsements", count: from_context.endorsements_count) %>
<% end %>
14 changes: 6 additions & 8 deletions decidim-core/app/cells/decidim/author/flag.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<% if flaggable? %>
<button type="button" class="link-alt" data-open="<%= current_user.present? ? "flagModal" : "loginModal" %>" title="<%= t("report", scope: "decidim.proposals.proposals.show") %>" aria-controls="<%= current_user.present? ? "flagModal" : "loginModal" %>" aria-haspopup="true" tabindex="0">
<%= icon "flag", aria_hidden: true, class: "icon--small", role: "img", "aria-hidden": true %>
<span class="show-for-sr">
<%= t("report", scope: "decidim.proposals.proposals.show") %>
</span>
</button>
<% end %>
<button type="button" class="link-alt" data-open="<%= current_user.present? ? "flagModal" : "loginModal" %>" title="<%= t("report", scope: "decidim.proposals.proposals.show") %>" aria-controls="<%= current_user.present? ? "flagModal" : "loginModal" %>" aria-haspopup="true" tabindex="0">
<%= icon "flag", aria_hidden: true, class: "icon--small", role: "img", "aria-hidden": true %>
<span class="show-for-sr">
<%= t("report", scope: "decidim.proposals.proposals.show") %>
</span>
</button>
16 changes: 10 additions & 6 deletions decidim-core/app/cells/decidim/author/flag_user.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<% if user_flaggable? && model.try(:id) != current_user.try(:id) %>
<button type="button" class="link-alt" data-open="<%= current_user.present? ? "flagUserModal" : "loginModal" %>" title="<%= t("report", scope: "decidim.proposals.proposals.show") %>" aria-controls="<%= current_user.present? ? "flagUserModal" : "loginModal" %>" aria-haspopup="dialog" tabindex="0">
<%= icon "flag", aria_hidden: true, class: "icon--small", role: "img", "aria-hidden": true %>
<span class="show-for-sr">
<%= t("report", scope: "decidim.proposals.proposals.show") %>
</span>
</button>
<%= cell(
"decidim/button",
{ icon: "flag-line", text: t("decidim.shared.flag_modal.report") },
button_classes: "button button__sm button__text-secondary only:m-auto",
html_options: {
"data-open" => current_user.present? ? "flagUserModal" : "loginModal",
"aria-controls" => current_user.present? ? "flagUserModal" : "loginModal",
"aria-haspopup" => "dialog"
}
) %>
<%= cell("decidim/flag_modal", model).flag_user %>
<% end %>
9 changes: 0 additions & 9 deletions decidim-core/app/cells/decidim/author/profile.erb

This file was deleted.

39 changes: 0 additions & 39 deletions decidim-core/app/cells/decidim/author/profile_inline.erb

This file was deleted.

43 changes: 24 additions & 19 deletions decidim-core/app/cells/decidim/author/profile_minicard.erb
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
<div class="p-xs flex--sbc">
<div class="mr-s">
<div class="card__header collapse">
<%= cell("decidim/user_profile", raw_model).user_data %>
</div>
<div class="card__text card--picture-offset">
<%= text_link_to_current_or_new_conversation_with(model) %>
</div>
</div>
<div class="ml-s">
<%= cell "decidim/follow_button", raw_model %>
<div class="author__tooltip bottom" role="tooltip">
<div class="author__container">
<%= render :avatar %>

<div>
<%= link_to decidim.profile_followers_path(raw_model.nickname), class: "card__link" do %>
<strong><%= model.followers_count %></strong> <%= t("decidim.profiles.show.followers") %>
<% end %>
<%= render :name %>
<span class="text-md"><%= model.nickname %></span>
</div>
</div>

<div class="author__tooltip-links">
<%= link_to decidim.profile_followers_path(raw_model.nickname) do %>
<%= content_tag(:span, model.followers_count, id: dom_id(raw_model, :followers_count)) %> <%= t("decidim.profiles.show.followers") %>
<% end %>
<% if model.can_follow? %>
<div>
<%= link_to decidim.profile_following_path(raw_model.nickname), class: "card__link" do %>
<strong><%= model.following_count %></strong> <%= t("decidim.profiles.show.following") %>
<% end %>
</div>
<%= link_to decidim.profile_following_path(raw_model.nickname) do %>
<%= model.following_count %> <%= t("decidim.profiles.show.following") %>
<% end %>
<% end %>
</div>

<% if model.direct_messages_enabled?(context) %>
<%= link_to current_or_new_conversation_path_with(model), class: "button button__sm button__transparent" do %>
<span><%= t("decidim.profiles.show.send_private_message") %></span>
<%= icon "mail-send-line" %>
<% end %>
<% end %>
<%= follow_button_for(raw_model, false, button_classes: "button button__sm button__transparent") %>
</div>
36 changes: 22 additions & 14 deletions decidim-core/app/cells/decidim/author/show.erb
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
<div class="<%= author_classes %>">
<div class="author-data__main">
<%= render :profile %>
</div>
<% data = has_tooltip? ? { tooltip: render(:profile_minicard).html_safe } : nil %>
<div class="author" data-author>
<%= content_tag :div, class: "author__container#{" is-compact" if layout == :compact}", data: do %>
<% if layout == :compact %>
<%= render :avatar %>

<% if actionable? %>
<div class="author-data__extra">
<%= render :date %>
<div>
<%= render :name %>
<%= render :comments %>
<%= render :endorsements %>
<%= render :flag %>
<% context_actions.each do |action| %>
<%= render action %>
<% end %>
</div>
<% elsif layout == :avatar %>
<%= render :avatar %>
<% else %>
<%= render :avatar %>
<%= render :name %>
<% end %>
<% end %>
<%= render :withdraw %>
</div>
<% if layout == :default %>
<% context_actions.each do |action| %>
<%= render action %>
<% end %>
<% end %>
</div>
8 changes: 3 additions & 5 deletions decidim-core/app/cells/decidim/author/withdraw.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<% if withdrawable? %>
<%= action_authorized_link_to :withdraw, withdraw_path, method: :put, class: "title-action__action button small hollow", title: t("withdraw_btn_hint", scope: resource_i18n_scope ), data: { confirm: t("withdraw_confirmation_html", scope: resource_i18n_scope ) } do %>
<%= t("withdraw_#{resource_name}", scope: resource_i18n_scope) %>
<%= icon "x", role: "img", "aria-hidden": true %>
<% end %>
<%= action_authorized_link_to :withdraw, withdraw_path, method: :put, class: "title-action__action button small hollow", title: t("withdraw_btn_hint", scope: resource_i18n_scope ), data: { confirm: t("withdraw_confirmation_html", scope: resource_i18n_scope ) } do %>
<%= t("withdraw_#{resource_name}", scope: resource_i18n_scope) %>
<%= icon "x", role: "img", "aria-hidden": true %>
<% end %>

0 comments on commit f78a24b

Please sign in to comment.