Skip to content

Commit

Permalink
Fix views' CSS / Fix specs
Browse files Browse the repository at this point in the history
  • Loading branch information
JoonasAapro committed Jun 20, 2024
1 parent 6d1c5b2 commit 1d02e00
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 99 deletions.
2 changes: 1 addition & 1 deletion app/cells/decidim/privacy/publish_account_modal/show.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= decidim_modal id: "publishAccountModal" do %>
<div>
<div class="pb-4">
<h2 class="h2" id="privacy-consent-label"><%= t("make_profile_public", scope:"decidim.privacy.partials.privacy_consent") %></h2>
</div>
<div class="row columns">
Expand Down
29 changes: 9 additions & 20 deletions app/views/decidim/privacy/message_block.html.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<div class="wrapper">
<div class="row">
<div class="row">
<div class="columns large-8 large-centered text-center page-title">
<h1><%= t(".title") %></h1>
</div>
</div>

<div class="row">
<div class="columns large-6 text-center medium-centered">
<div class="card">
<div class="card__content">
<%= t(".content_html") %>
</div>
</div>
</div>
<div class="columns large-4 medium-centered">
<%= link_to t(".back"), :back, class: "button expanded" %>
</div>
</div>
<div class="text-center">
<span class="uppercase pt-2 text-2xl font-semibold text-gray-2 block">
<%= t(".title") %>
</span>
<p class="help-text pb-8">
<%= t(".content_html") %>
</p>
<div class="form__wrapper-block flex justify-center">
<%= link_to t(".back"), :back, class: "border border-secondary rounded hover:bg-secondary text-secondary hover:text-white px-4 py-1.5 font-semibold mx-auto" %>
</div>
</div>
6 changes: 3 additions & 3 deletions app/views/decidim/privacy/privacy_block.html.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="text-center">
<span class="uppercase font-semibold text-gray-2 mb-4 block">
<span class="uppercase pt-2 text-2xl font-semibold text-gray-2 block">
<%= t("decidim.privacy.privacy_block.title") %>
</span>
<p class="help-text pb-8">
<%= t("decidim.privacy.privacy_block.content_html") %>
</p>
<div class="form__wrapper-block">
<button class="button button__sm md:button__lg button__secondary" data-dialog-open="publishAccountModal" data-redirect-url=<%= request.original_url %>>
<div class="form__wrapper-block flex justify-center">
<button class="button button__sm md:button__lg button__secondary mx-auto" data-dialog-open="publishAccountModal" data-redirect-url=<%= request.original_url %>>
<%= t("decidim.privacy.privacy_block.button") %>
</button>
</div>
Expand Down
88 changes: 46 additions & 42 deletions app/views/decidim/privacy/privacy_settings/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,61 +23,65 @@
<%= icon "check-line", class: "toggle__switch-toggle-icon" %>
<%= icon "close-line", class: "toggle__switch-toggle-icon" %>
</span>
<span class="toggle__switch-trigger-text">
<span class="toggle__switch-trigger-text font-semibold">
<%= t("public_profile", scope: "decidim.privacy.privacy_settings.show") %>
</span>
</label>
</div>
</div>
</div>

<div id="toggle-privacy-messaging" class="form__wrapper">
<div id="toggle-privacy-messaging" class="pb-12">
<%= t("private_messaging_html", scope: "decidim.privacy.privacy_settings.show") %>

<label>
<%= t("enable_private_messaging", scope: "decidim.privacy.privacy_settings.show") %>
</label>
<div class="toggle__switch-trigger space-y-2">
<label for="allow_private_messaging" class="toggle__switch-toggle">
<span>
<input type="hidden" name="allow_private_messaging" value="false">
<input
<%== %(checked="checked") if @privacy_settings.allow_private_messaging %>
id="allow_private_messaging"
type="checkbox"
name="allow_private_messaging">
<span class="toggle__switch-toggle-content">
</span>
<%= icon "check-line", class: "toggle__switch-toggle-icon" %>
<%= icon "close-line", class: "toggle__switch-toggle-icon" %>
</span>
<span class="toggle__switch-trigger-text">
<%= t("private_messaging", scope: "decidim.privacy.privacy_settings.show") %>
</span>
<div class="form__wrapper pt-4 pb-4">
<label>
<%= t("enable_private_messaging", scope: "decidim.privacy.privacy_settings.show") %>
</label>
<div class="toggle__switch-trigger">
<label for="allow_private_messaging" class="toggle__switch-toggle">
<span>
<input type="hidden" name="allow_private_messaging" value="false">
<input
<%== %(checked="checked") if @privacy_settings.allow_private_messaging %>
id="allow_private_messaging"
type="checkbox"
name="allow_private_messaging">
<span class="toggle__switch-toggle-content">
</span>
<%= icon "check-line", class: "toggle__switch-toggle-icon" %>
<%= icon "close-line", class: "toggle__switch-toggle-icon" %>
</span>
<span class="toggle__switch-trigger-text font-semibold">
<%= t("private_messaging", scope: "decidim.privacy.privacy_settings.show") %>
</span>
</label>
</div>
</div>

<label>
<%= t("allow_public_contact", scope: "decidim.privacy.privacy_settings.show") %>
</label>
<div class="toggle__switch-trigger">
<label for="allow_public_contact" class="toggle__switch-toggle">
<span>
<input type="hidden" name="allow_public_contact" value="false">
<input
<%== %(checked="checked") if @privacy_settings.allow_public_contact %>
id="allow_public_contact"
type="checkbox"
name="allow_public_contact">
<span class="toggle__switch-toggle-content">
</span>
<%= icon "check-line", class: "toggle__switch-toggle-icon" %>
<%= icon "close-line", class: "toggle__switch-toggle-icon" %>
</span>
<span class="toggle__switch-trigger-text">
<%= t("public_contact", scope: "decidim.privacy.privacy_settings.show") %>
</span>
<div class="form__wrapper pt-4">
<label>
<%= t("allow_public_contact", scope: "decidim.privacy.privacy_settings.show") %>
</label>
<div class="toggle__switch-trigger">
<label for="allow_public_contact" class="toggle__switch-toggle">
<span>
<input type="hidden" name="allow_public_contact" value="false">
<input
<%== %(checked="checked") if @privacy_settings.allow_public_contact %>
id="allow_public_contact"
type="checkbox"
name="allow_public_contact">
<span class="toggle__switch-toggle-content">
</span>
<%= icon "check-line", class: "toggle__switch-toggle-icon" %>
<%= icon "close-line", class: "toggle__switch-toggle-icon" %>
</span>
<span class="toggle__switch-trigger-text font-semibold">
<%= t("public_contact", scope: "decidim.privacy.privacy_settings.show") %>
</span>
</label>
</div>
</div>
</div>
<%= f.submit t(".save_privacy_settings"), class: "button button__sm md:button__lg button__secondary mr-auto !ml-0" %>
Expand Down
9 changes: 6 additions & 3 deletions config/locales/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ cs:
privacy:
message_block:
title: Soukromé zprávy nejsou povoleny
content_html: Pro přístup na tuto stránku musíte v nastavení profilu povolit soukromé zprávy z "Nastavení soukromí".
content_html: |
<p class="text-lg pb-4">
Pro přístup na tuto stránku musíte v nastavení profilu povolit soukromé zprávy z "Nastavení soukromí".
</p>
back: Předchozí strana
privacy_settings:
show:
Expand Down Expand Up @@ -71,11 +74,11 @@ cs:
privacy_block:
title: Pro tuto akci je vyžadován veřejný profil
content_html: |
<p class="text-center">
<p class="text-lg">
You are trying to access a page which requires your profile to be public. Making your profile public allows
other participants to see information about you.
</p>
<p class="text-center">
<p class="text-lg py-4">
<strong>
Additional information about making your profile public will be presented after clicking the button below.
</strong>
Expand Down
9 changes: 6 additions & 3 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ en:
privacy:
message_block:
title: Private messaging is not enabled
content_html: To access this page you have to enable private messaging from the "Privacy settings" under your profile settings.
content_html: |
<p class="text-lg pb-4">
To access this page you have to enable private messaging from the "Privacy settings" under your profile settings.
</p>
back: Previous page
privacy_settings:
show:
Expand Down Expand Up @@ -77,11 +80,11 @@ en:
privacy_block:
title: Public profile is required for this action
content_html: |
<p class="text-center">
<p class="text-lg">
You are trying to access a page which requires your profile to be public. Making your profile public allows
other participants to see information about you.
</p>
<p class="text-center">
<p class="text-lg py-4">
<strong>
Additional information about making your profile public will be presented after clicking the button below.
</strong>
Expand Down
9 changes: 6 additions & 3 deletions config/locales/fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ fi:
privacy:
message_block:
title: Yksityisviestit eivät ole käytössä
content_html: Käyttääksesi tätä toimintoa, sinun täytyy ottaa yksityisviestit käyttöön tilisi asetusten alta löytyvien "yksityisyysasetusten" kautta.
content_html: |
<p class="text-lg pb-4">
Käyttääksesi tätä toimintoa, sinun täytyy ottaa yksityisviestit käyttöön tilisi asetusten alta löytyvien "yksityisyysasetusten" kautta.
</p>
back: Edellinen sivu
privacy_settings:
show:
Expand Down Expand Up @@ -69,11 +72,11 @@ fi:
privacy_block:
title: Profiilisi tulee olla julkinen suorittaaksesi tämän toiminnon
content_html: |
<p class="text-center">
<p class="text-lg">
Yrität päästä sivulle, joka vaatii julkisen profiilin. Profiilisi julkaiseminen sallii
muiden osallistujien nähdä sinua koskevia tietoja.
</p>
<p class="text-center">
<p class="text-lg py-4">
<strong>
Saat lisätietoja profiilisi julkaisemisesta alla olevan painikkeen painamisen jälkeen.
</strong>
Expand Down
9 changes: 6 additions & 3 deletions config/locales/sv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ sv:
privacy:
message_block:
title: Direktmeddelanden är inte aktiverat
content_html: För att komma åt den här sidan måste du aktivera privata meddelanden från "Integritetsinställningar" under dina profilinställningar.
content_html: |
<p class="text-lg pb-4">
För att komma åt den här sidan måste du aktivera privata meddelanden från "Integritetsinställningar" under dina profilinställningar.
</p>
back: Föregående sida
privacy_settings:
show:
Expand Down Expand Up @@ -69,11 +72,11 @@ sv:
privacy_block:
title: Offentlig profil krävs för denna åtgärd
content_html: |
<p class="text-center">
<p class="text-lg">
Du försöker komma åt en sida som kräver att din profil är offentlig. Att göra din profil offentlig tillåter
andra deltagare att se information om dig.
</p>
<p class="text-center">
<p class="text-lg py-4">
<strong>
Ytterligare information om att göra din profil offentlig kommer att presenteras efter att klicka på knappen nedan.
</strong>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ class AssemblyMembersController

context "when assembly has some public members" do
before do
member1.user.update!(published_at: Time.current)
first_member.user.update!(published_at: Time.current)
end

context "when user has permissions" do
it "displays only public members" do
get :index, params: { assembly_slug: assembly.slug }

expect(controller.helpers.collection).to contain_exactly(member1)
expect(controller.helpers.collection).to contain_exactly(first_member)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/system/decidim/conversations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@

visit decidim.conversations_path

expect(page).to have_content("Private messaging is not enabled")
expect(page).to have_content("PRIVATE MESSAGING IS NOT ENABLED")
end

it "does not show 'conversations' link in the navbar" do
Expand Down
15 changes: 2 additions & 13 deletions spec/system/decidim/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
let!(:admin) { create(:user, :confirmed, :admin, organization:) }

before do
login_as user, scope: :user
login_as admin, scope: :user
switch_to_host(organization.host)
visit decidim.root_path
expect(page).to have_content(organization.name)
Expand All @@ -29,10 +29,6 @@
end

it "shows up in the admin search" do
login_as admin, scope: :user
visit decidim.root_path
refresh

click_on "Admin dashboard"
click_on "Participants"
within ".sidebar-menu" do
Expand All @@ -46,6 +42,7 @@
context "when user public" do
it "shows up in search" do
user.update(published_at: Time.current)
user.reload

fill_in "term", with: user.name
find("button[type='submit'][aria-label='Search']").click
Expand All @@ -68,10 +65,6 @@
end

it "shows up in the admin search" do
login_as admin, scope: :user
visit decidim.root_path
refresh

click_on "Admin dashboard"
click_on "Participants"
click_on "Groups"
Expand Down Expand Up @@ -103,10 +96,6 @@
end

it "shows up in the admin search" do
login_as admin, scope: :user
visit decidim.root_path
refresh

click_on "Admin dashboard"
click_on "Participants"
click_on "Groups"
Expand Down
10 changes: 5 additions & 5 deletions spec/types/decidim/core/user_entity_input_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,23 @@
end

context "when user is blocked" do
let!(:user1) { create(:user, :blocked, :published, :confirmed, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }
let!(:first_user) { create(:user, :blocked, :published, :confirmed, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }

it "does not returns matching users" do
expect(response["users"]).not_to include("name" => first_user.name)
end
end

context "when user is deleted" do
let!(:user1) { create(:user, :deleted, :confirmed, :published, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }
let!(:first_user) { create(:user, :deleted, :confirmed, :published, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }

it "does not returns matching users" do
expect(response["users"]).not_to include("name" => first_user.name)
end
end

context "when user is private" do
let!(:user1) { create(:user, :confirmed, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }
let!(:first_user) { create(:user, :confirmed, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }

it "does not returns matching users" do
expect(response["users"]).not_to include("name" => first_user.name)
Expand All @@ -132,15 +132,15 @@
end

context "when user is blocked" do
let!(:user1) { create(:user, :blocked, :confirmed, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }
let!(:first_user) { create(:user, :blocked, :confirmed, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }

it "does not returns matching users" do
expect(response["users"]).not_to include("name" => first_user.name)
end
end

context "when user is private" do
let!(:user1) { create(:user, :confirmed, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }
let!(:first_user) { create(:user, :confirmed, nickname: "_foo_user_1", name: "FooBar User 1", organization: current_organization) }

it "does not returns matching users" do
expect(response["users"]).not_to include("name" => first_user.name)
Expand Down

0 comments on commit 1d02e00

Please sign in to comment.