forked from codeforjapan/decidim-cfj
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from takahashim/fix-specs-v028-2
fix decidim-user_extension
- Loading branch information
Showing
16 changed files
with
216 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pp/overrides/decidim/admin/officializations/index/user_extension_override.html.erb.deface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<!-- insert_bottom "td.table-list__actions" --> | ||
<% if allowed_to? :show_user_extension, :user, user: user %> | ||
<%= icon_link_to "person", Decidim::UserExtension::AdminEngine.routes.url_helpers.officializations_show_user_extension_path(user.id), t("show_user_extension", scope: "decidim.admin.officializations.index"), class: "action-icon action-icon--show-user", data: { full_name: user.name, toggle: "show-user-modal" } %> | ||
<%= icon_link_to "user-line", Decidim::UserExtension::AdminEngine.routes.url_helpers.officializations_show_user_extension_path(user.id), t("show_user_extension", scope: "decidim.admin.officializations.index"), class: "action-icon action-icon--show-user", data: { full_name: user.name, dialog_open: "show-user-modal" } %> | ||
<% end %> | ||
|
1 change: 1 addition & 0 deletions
1
decidim-user_extension/app/packs/entrypoints/decidim_user_extension.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "stylesheets/decidim/user_extension/application.scss"; |
1 change: 0 additions & 1 deletion
1
decidim-user_extension/app/packs/entrypoints/decidim_user_extention.scss
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...dim-user_extension/app/packs/stylesheets/decidim/user_extension/_show_user_extension.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.show_user_extension { | ||
@apply my-4; | ||
|
||
h4 { | ||
@apply text-md w-full text-gray-2 font-semibold mb-2; | ||
} | ||
|
||
> div { | ||
@apply bg-gray-3 mb-2 p-2; | ||
} | ||
|
||
#user_extension + p { | ||
@apply hidden; | ||
} | ||
|
||
#user_extension:empty + p { | ||
@apply block; | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
decidim-user_extension/app/packs/stylesheets/decidim/user_extension/application.css
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
decidim-user_extension/app/packs/stylesheets/decidim/user_extension/application.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@import "stylesheets/decidim/user_extension/_show_user_extension.scss"; |
91 changes: 53 additions & 38 deletions
91
decidim-user_extension/app/views/decidim/account/show.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,78 @@ | ||
<%= alert_box("", "account-notification hide", true) %> | ||
<% 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: "on" }) do |f| %> | ||
<div class="columns large-4"> | ||
<%= f.upload :avatar %> | ||
<%= 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 secondary" data-announcement> | ||
<span 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> | ||
</span> | ||
</div> | ||
<% end %> | ||
|
||
<div class="columns large-8 end"> | ||
<% if current_user.unconfirmed_email.present? %> | ||
<div id="email-change-pending" class="callout secondary"> | ||
<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> | ||
<% 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"> | ||
<%= f.upload :avatar, button_class: "button button__lg button__transparent-secondary w-full" %> | ||
|
||
<%= form_required_explanation %> | ||
|
||
<%= f.text_field :name, autocomplete: "name" %> | ||
<%= f.text_field :nickname, autocomplete: "nickname" %> | ||
<%= f.email_field :email, disabled: current_user.unconfirmed_email.present?, autocomplete: "email" %> | ||
<%= f.email_field :email, disabled: current_user.unconfirmed_email.present?, autocomplete: "email", data: { original: current_user.email } %> | ||
<%= f.url_field :personal_url, autocomplete: "url" %> | ||
<%= f.text_area :about, rows: 5 %> | ||
|
||
<%= f.collection_select( | ||
:locale, | ||
@account.organization.available_locales, | ||
:to_s, | ||
->(locale) {locale_name(locale) } | ||
) %> | ||
<p class="help-text"><%= t(".available_locales_helper") %></p> | ||
|
||
<!-- extension begin --> | ||
<% if current_organization.available_authorizations&.include?("user_extension") %> | ||
<%= render partial: "user_extension", locals: {f: f} %> | ||
<% end %> | ||
<!-- extension end --> | ||
|
||
<% 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 } %> | ||
<%= f.collection_select( | ||
:locale, | ||
@account.organization.available_locales, | ||
:to_s, | ||
->(locale) { locale_name(locale) }, | ||
help_text: t("available_locales_helper", scope:"decidim.account.show") | ||
) %> | ||
<% 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 %> |
Oops, something went wrong.