Skip to content

Commit

Permalink
First updates for 0.28
Browse files Browse the repository at this point in the history
  • Loading branch information
io3uokljs committed Dec 13, 2024
1 parent 6b3a882 commit f0fa6b1
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 23 deletions.
11 changes: 11 additions & 0 deletions app/cells/decidim/faceless/profile_cell_override.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module Decidim
module Faceless
module ProfileCellOverride
def description
presented_profile.about = ""
end
end
end
end
72 changes: 51 additions & 21 deletions app/views/decidim/account/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,39 +1,69 @@
<% add_decidim_page_title(t("profile", scope: "layouts.decidim.user_menu")) %>
<% content_for(:subtitle) { t("profile", scope: "layouts.decidim.user_menu") } %>

<div class="row">
<%= decidim_form_for(@account, url: account_path, method: :put, html: { autocomplete: "off" }) do |f| %>
<input autocomplete="off" name="hidden" type="password" style="display:none;">
<%= render layout: "layouts/decidim/shared/layout_user_profile" do %>
<% if current_user.unconfirmed_email.present? %>
<%# NOTE: announcement cell clean_body method will purge the button %>
<div id="email-change-pending" class="flash warning" data-announcement>
<div class="flash__message flex-none block leading-relaxed">
<p>
<strong><%= t("decidim.account.email_change.title") %></strong>
</p>
<p>
<%= t("decidim.account.email_change.body1", unconfirmed_email: current_user.unconfirmed_email) %>
</p>
<p>
<%== t(
"decidim.account.email_change.body2",
resend_link: link_to(t("decidim.account.email_change.send_again"), resend_confirmation_instructions_account_path, role: :button, method: :post, remote: true),
cancel_link: link_to(t("decidim.account.email_change.cancel"), cancel_email_change_account_path, role: :button, method: :post, remote: true)) %>
</p>
</div>
</div>
<% end %>

<%= decidim_form_for(@account, url: account_path, method: :put, html: { autocomplete: "on", class: "form-defaults edit_user" }) do |f| %>
<div class="form__wrapper pt-0">

<div class="columns large-8 end">
<%= form_required_explanation %>

<%= f.text_field :name %>
<%= f.text_field :nickname %>
<%= f.email_field :email %>
<%= f.text_field :name, autocomplete: "name" %>
<%= f.text_field :nickname, autocomplete: "nickname" %>
<%= f.email_field :email, disabled: current_user.unconfirmed_email.present?, autocomplete: "email", data: { original: current_user.email } %>

<%= f.collection_select(
:locale,
@account.organization.available_locales,
:to_s,
->(locale) {locale_name(locale) }
->(locale) { locale_name(locale) },
help_text: t("available_locales_helper", scope:"decidim.account.show")
) %>
<p class="help-text"><%= t(".available_locales_helper") %></p>

<% if @account.errors[:password].any? || @account.errors[:password_confirmation].any? %>
<%= render partial: "password_fields", locals: { form: f } %>
<% else %>
<% if current_organization.sign_in_enabled? %>
<p>
<button type="button" data-toggle="passwordChange" class="link change-password"><%= t ".change_password" %></button>
</p>
<div id="passwordChange" class="toggle-show" data-toggler=".is-expanded">
<%= render partial: "password_fields", locals: { form: f } %>
<% if @account.password.present? %>
<%= render partial: "password_fields", locals: { form: f, user: current_user } %>
<%= render partial: "old_password_field", locals: { form: f, show_help_text: true } %>
<% elsif current_organization.sign_in_enabled? %>
<div data-component="accordion" id="accordion-password">
<%= button_tag(
class: "text-lg font-semibold text-secondary underline block cursor-pointer",
id: "accordion-trigger-panel-password",
type: "button",
data: { controls: "panel-password" }
) do %>
<%= t("change_password", scope:"decidim.account.show") %>
<% end %>
<div id="panel-password" class="mt-6">
<%= render partial: "password_fields", locals: { form: f, user: current_user } %>
</div>
</div>

<%= content_tag :div, id: "panel-old-password", class: @account.errors[:old_password].any? ? nil : "hidden" do %>
<%= render partial: "old_password_field", locals: { form: f, show_help_text: true } %>
<% end %>
<% end %>

<%= f.submit t(".update_account") %>
<div class="form__wrapper-block flex-col-reverse md:flex-row justify-between">
<%= f.submit t("update_account", scope:"decidim.account.show"), class: "button button__sm md:button__lg button__secondary mr-auto !ml-0" %>
</div>
</div>
<% end %>
</div>
<% end %>
1 change: 1 addition & 0 deletions lib/decidim/faceless/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Engine < ::Rails::Engine
config.to_prepare do
Decidim::UserPresenter.prepend(Decidim::Faceless::UserPresenterOverride)
Decidim::ProfileSidebarCell.prepend(Decidim::Faceless::ProfileSidebarCellOverride)
Decidim::ProfileCell.prepend(Decidim::Faceless::ProfileCellOverride)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/decidim/faceless/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Decidim
# This holds the decidim-faceless version.
module Faceless
VERSION = "0.26.0"
DECIDIM_VERSION = "~> 0.26"
VERSION = "0.28.0"
DECIDIM_VERSION = "~> 0.28"
end
end

0 comments on commit f0fa6b1

Please sign in to comment.