Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ Following Semantic Versioning 2.

## next version:

## Version 0.10.1 (PATCH)
- Fix: Select the existing area_id by default when editing a participatory process if the logged user is an admin

## Version 0.10.0 (MINOR)
- Changes in input area for processes and assemblies admin form. Now this input is setting by default with department admin area.

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ GIT
PATH
remote: .
specs:
decidim-department_admin (0.10.0)
decidim-department_admin (0.10.1)
decidim-admin (~> 0.29.0)
decidim-core (~> 0.29.0)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
text: <<-ERB
<%= form.areas_select :area_id,
areas_for_select(current_organization),
{ include_blank: t(".select_an_area"), selected: current_user.areas.first&.id },
{ include_blank: t(".select_an_area"), selected: current_user.department_admin? ? current_user.areas.first&.id : current_participatory_process.try(:decidim_area_id) },
{ disabled: current_user.department_admin? } %>
ERB
)
Expand All @@ -19,7 +19,7 @@
text: <<-ERB
<%= form.areas_select :area_id,
areas_for_select(current_organization),
{ include_blank: t(".select_an_area"), selected: current_user.areas.first&.id },
{ include_blank: t(".select_an_area"), selected: current_user.department_admin? ? current_user.areas.first&.id : current_assembly.try(:decidim_area_id) },
{ disabled: current_user.department_admin? } %>
ERB
)
2 changes: 1 addition & 1 deletion lib/decidim/department_admin/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Decidim
module DepartmentAdmin
# see CHANGELOG.md
def self.version
"0.10.0"
"0.10.1"
end

DECIDIM_VER = "~> 0.29.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@
end
end

context "when user is a regular admin" do
let(:department_admin) { create(:user, :admin, :confirmed, organization:) }

it "shows area field as enabled" do
within ".new_assembly" do
area_select = find("#assembly_area_id")

expect(area_select).to be_present
expect(area_select[:disabled]).to be_falsey
end
end
end

it "creates a new assembly", :versioning do
within ".new_assembly" do
fill_in_i18n(:assembly_title, "#assembly-title-tabs", **attributes[:title].except("machine_translations"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@
end
end

context "when user is a regular admin" do
let(:department_admin) { create(:user, :admin, :confirmed, organization:) }

it "shows area field as enabled" do
within ".new_participatory_process" do
area_select = find("#participatory_process_area_id")

expect(area_select).to be_present
expect(area_select[:disabled]).to be_falsey
end
end
end

it "creates a new participatory process with department admin's area" do
within ".new_participatory_process" do
fill_in_i18n(
Expand Down
Loading