Skip to content

Commit

Permalink
bump version 0.11.3 (decidim-ice#344)
Browse files Browse the repository at this point in the history
* bump version 0.11.3

* underscore

* add last updates

* ffi

* erblint

* fix modal

* button to a

* changelog

* method

* displayblock

* add an organization memoizer for helpers

* ensure request exits

* memoize in request

* Fix cell spec

---------

Co-authored-by: Ivan Vergés <Ivan Vergés>
  • Loading branch information
microstudi authored Jan 29, 2025
1 parent 39c9401 commit 78410a3
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 40 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
CHANGELOG
=========

Current
v0.11.3
-------
Compatibility:
- Decidim v0.28.x

Features:
- Added user time zones in account settings
- Added custom styles for the admin panel
- Added Verification tweaks
- Added Admin manual verifications

v0.11.2
-------
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
decidim-decidim_awesome (0.11.2)
decidim-decidim_awesome (0.11.3)
decidim-admin (>= 0.28.0, < 0.29)
decidim-core (>= 0.28.0, < 0.29)
deface (>= 1.5)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module Admin
class AdminAuthorizationsController < DecidimAwesome::Admin::ApplicationController
include NeedsAwesomeConfig

layout false
layout "layouts/decidim/decidim_awesome/admin/admin_authorizations"
helper_method :user, :authorization, :workflow, :handler, :conflict
# overwrite original rescue_from to ensure we print messages from ajax methods
rescue_from Decidim::ActionForbidden, with: :json_error
Expand All @@ -23,16 +23,16 @@ def update
if conflict
message = render_to_string("conflict")
else
message = render_to_string(partial: "callout", locals: { i18n_key: "user_authorized", klass: "success" })
message = render_to_string("callout", locals: { i18n_key: "user_authorized", klass: "success" })
Decidim::Verifications::AuthorizeUser.call(handler, current_organization) do
on(:transferred) do |transfer|
message += render_to_string(partial: "callout", locals: { i18n_key: "authorization_transferred", klass: "success" }) if transfer.records.any?
message += render_to_string("callout", locals: { i18n_key: "authorization_transferred", klass: "success" }) if transfer.records.any?
end
on(:invalid) do
if force_verification.present?
create_forced_authorization
else
message = render_to_string(partial: "callout", locals: { i18n_key: "user_not_authorized", klass: "alert" })
message = render_to_string("callout", locals: { i18n_key: "user_not_authorized", klass: "alert" })
message += render_to_string("edit", locals: { with_override: true })
end
end
Expand All @@ -52,9 +52,9 @@ def update

def destroy
message = if destroy_authorization
render_to_string(partial: "callout", locals: { i18n_key: "authorization_destroyed", klass: "success" })
render_to_string("callout", locals: { i18n_key: "authorization_destroyed", klass: "success" })
else
render_to_string(partial: "callout", locals: { i18n_key: "authorization_not_destroyed", klass: "alert" })
render_to_string("callout", locals: { i18n_key: "authorization_not_destroyed", klass: "alert" })
end

render json: {
Expand All @@ -80,7 +80,7 @@ def destroy_authorization
end

def json_error(exception)
render json: render_to_string(partial: "callout", locals: { message: exception.message, klass: "alert" }), status: :unprocessable_entity
render plain: render_to_string("callout", locals: { message: exception.message, klass: "alert" }), status: :unprocessable_entity
end

def user
Expand Down
20 changes: 8 additions & 12 deletions app/packs/src/decidim/decidim_awesome/admin/verifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ document.addEventListener("DOMContentLoaded", () => {
if (!dialog) {
return;
}
const title = dialog.querySelector("[data-dialog-title]");
const content = dialog.querySelector("[data-dialog-content]");

const container = dialog.querySelector("[data-dialog-container]");

dialog.addEventListener("open.dialog", async (el) => {
const modal = window.Decidim.currentDialogs[el.target.id];
const button = modal.openingTrigger;
const url = button.dataset.verificationUrl;
const user = button.dataset.verificationUser;
title.innerText = title.innerText.replace("{{user}}", user);
content.innerHTML = '<br><br><span class="loading-spinner"></span>';
// console.log("open.dialog", el, "content", content, "button", button, "url", url);
container.innerHTML = '<br><br><span class="loading-spinner"></span>';
// console.log("open.dialog", el, "container", container, "button", button, "url", url);
fetch(url).then((res) => res.text()).then((html) => {
content.innerHTML = html;
container.innerHTML = html;
});
});

Expand All @@ -24,17 +21,16 @@ document.addEventListener("DOMContentLoaded", () => {
const response = JSON.parse(responseText.detail[0].response)
const button = document.querySelector(`[data-verification-handler="${response.handler}"][data-verification-user-id="${response.userId}"]`);
// console.log("ajax:complete", responseText, "response", response, "button", button);
content.innerHTML = response.message;
container.innerHTML = response.message;

if (response.granted) {
button.classList.add("granted");
} else {
button.classList.remove("granted");
const forceVerificationCheck = content.querySelector("#force_verification_check");
const forceVerification = content.querySelector("#force_verification");
const forceVerificationCheck = container.querySelector("#force_verification_check");
const forceVerification = container.querySelector("#force_verification");

if (forceVerificationCheck) {
console.log(forceVerificationCheck);
forceVerificationCheck.addEventListener("change", function() {
forceVerification.disabled = !forceVerification.disabled;
if (forceVerificationCheck.checked) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
&-td:not(:first-child) {
@apply text-left;

button {
a {
@apply text-sm font-normal block;

&:hover {
@apply text-secondary underline;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
data[:dialog_open] = "awesome-verification-modal"
end
%>
<%= content_tag(auth[:managed] ? "button" : "div", class: classes, data:) do %>
<%= content_tag(auth[:managed] ? "a" : "div", href: "#", class: classes, data:) do %>
<%= icon "check-line", class: "checked" %>
<%= icon "time-line", class: "undeterminated" %>
<%= icon "close-line", class: "unchecked" %>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<%= decidim_modal id: "awesome-verification-modal", class:"reveal awesome_participants-modal" do %>
<div data-dialog-container>
<%= icon "lock-line" %>
<h3 tabindex="-1" data-dialog-title>
<%= t(".authorizations_for", user: "{{user}}") %>
</h3>
<div data-dialog-content>
</div>
</div>
<div data-dialog-actions>
<button data-dialog-close="awesome-verification-modal" class="button button__lg button__transparent-secondary">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<%= icon "lock-line" %>
<h3 tabindex="-1" data-dialog-title>
<%= t("decidim.decidim_awesome.admin.officializations.verification_modal.authorizations_for", user: user.name) %>
</h3>
<div data-dialog-content>
<%= yield %>
</div>
2 changes: 1 addition & 1 deletion lib/decidim/decidim_awesome/admin_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class AdminEngine < ::Rails::Engine
end
# submenus
Decidim::DecidimAwesome::Menu.register_custom_fields_submenu!
Decidim::DecidimAwesome::Menu.register_custom__styles_submenu!
Decidim::DecidimAwesome::Menu.register_custom_styles_submenu!
Decidim::DecidimAwesome::Menu.register_menu_hacks_submenu!
Decidim::DecidimAwesome::Menu.register_maintenance_admin_menu!
Decidim::DecidimAwesome::Menu.register_awesome_admin_menu!
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/decidim_awesome/menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def register_custom_fields_submenu!
end
end

def register_custom__styles_submenu!
def register_custom_styles_submenu!
Decidim.menu :custom_styles_submenu do |menu|
menu.add_item :scoped_styles,
I18n.t("menu.title", scope: "decidim.decidim_awesome.admin.scoped_styles"),
Expand Down
2 changes: 1 addition & 1 deletion lib/decidim/decidim_awesome/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Decidim
# This holds the decidim-decidim_awesome version.
module DecidimAwesome
VERSION = "0.11.2"
VERSION = "0.11.3"
COMPAT_DECIDIM_VERSION = [">= 0.28.0", "< 0.29"].freeze
end
end
16 changes: 8 additions & 8 deletions spec/system/admin/admins_authorizations_admin_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

it "can authorize a participant" do
within "tr", text: participant2.name do
within "button[data-verification-user-id=\"#{participant2.id}\"]" do
within "a[data-verification-user-id=\"#{participant2.id}\"]" do
expect(page).to have_css("svg.unchecked")
end
click_on "Example authorization"
Expand All @@ -66,7 +66,7 @@
end

within "tr", text: participant2.name do
within "button[data-verification-user-id=\"#{participant2.id}\"]" do
within "a[data-verification-user-id=\"#{participant2.id}\"]" do
expect(page).to have_content("Example authorization")
expect(page).to have_css("svg.checked")
end
Expand All @@ -79,7 +79,7 @@

it "can revoke an authorization" do
within "tr", text: participant1.name do
within "button[data-verification-user-id=\"#{participant1.id}\"]" do
within "a[data-verification-user-id=\"#{participant1.id}\"]" do
expect(page).to have_content("Example authorization")
expect(page).to have_css("svg.checked")
end
Expand All @@ -92,7 +92,7 @@
end

within "tr", text: participant1.name do
within "button[data-verification-user-id=\"#{participant1.id}\"]" do
within "a[data-verification-user-id=\"#{participant1.id}\"]" do
expect(page).to have_content("Example authorization")
expect(page).to have_css("svg.unchecked")
end
Expand All @@ -102,7 +102,7 @@

it "can force an authorization" do
within "tr", text: participant2.name do
within "button[data-verification-user-id=\"#{participant2.id}\"]" do
within "a[data-verification-user-id=\"#{participant2.id}\"]" do
expect(page).to have_css("svg.unchecked")
end
click_on "Example authorization"
Expand All @@ -119,7 +119,7 @@
end

within "tr", text: participant2.name do
within "button[data-verification-user-id=\"#{participant2.id}\"]" do
within "a[data-verification-user-id=\"#{participant2.id}\"]" do
expect(page).to have_content("Example authorization")
expect(page).to have_css("svg.checked")
end
Expand All @@ -136,7 +136,7 @@

it "cannot force an authorization" do
within "tr", text: participant2.name do
within "button[data-verification-user-id=\"#{participant2.id}\"]" do
within "a[data-verification-user-id=\"#{participant2.id}\"]" do
expect(page).to have_css("svg.unchecked")
end
click_on "Example authorization"
Expand All @@ -151,7 +151,7 @@
end

within "tr", text: participant2.name do
within "button[data-verification-user-id=\"#{participant2.id}\"]" do
within "a[data-verification-user-id=\"#{participant2.id}\"]" do
expect(page).to have_content("Example authorization")
expect(page).to have_css("svg.unchecked")
end
Expand Down

0 comments on commit 78410a3

Please sign in to comment.