-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
518d74e
commit b97cd07
Showing
5 changed files
with
35 additions
and
30 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
31 changes: 31 additions & 0 deletions
31
...ecidim/participatory_processes/admin/participatory_process_groups_controller_decorator.rb
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,31 @@ | ||
# frozen_string_literal: true | ||
|
||
# To avoid admin users to delete special process groups | ||
|
||
module Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessGroupsControllerDecorator | ||
# | ||
# Decorate to avoid admin users to delete special process groups | ||
# | ||
def self.decorate | ||
Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessGroupsController.class_eval do | ||
|
||
alias_method :original_destroy, :destroy | ||
|
||
def destroy | ||
byebug | ||
forbidden_groups_ids = [ | ||
Rails.application.config.process.to_s, | ||
Rails.application.config.regulation.to_s | ||
] | ||
if forbidden_groups_ids.include?(params[:id]) | ||
flash[:alert] = "Protected ParticipatoryProcessGroup, can't be deleted." | ||
redirect_to participatory_process_groups_path | ||
else | ||
original_destroy | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
::Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessGroupsControllerDecorator.decorate |
26 changes: 0 additions & 26 deletions
26
...app/decorators/decidim/regulations/admin/avoid_deletion_of_regulations_group_decorator.rb
This file was deleted.
Oops, something went wrong.
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