Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add admin log when creating, updating or deleting area types (#9316)
* add admin log when creating area type * add admin log when updating area type * add admin log when deleting area type
- Loading branch information
1 parent
1296fa5
commit 3c8ec4e
Showing
8 changed files
with
89 additions
and
9 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
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
34 changes: 34 additions & 0 deletions
34
decidim-core/app/presenters/decidim/admin_log/area_type_presenter.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,34 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module AdminLog | ||
# This class holds the logic to present a `Decidim::AreaType` | ||
# for the `AdminLog` log. | ||
# | ||
# Usage should be automatic and you shouldn't need to call this class | ||
# directly, but here's an example: | ||
# | ||
# action_log = Decidim::ActionLog.last | ||
# view_helpers # => this comes from the views | ||
# AreaTypePresenter.new(action_log, view_helpers).present | ||
class AreaTypePresenter < Decidim::Log::BasePresenter | ||
private | ||
|
||
def diff_fields_mapping | ||
{ | ||
name: :i18n, | ||
plural: :i18n | ||
} | ||
end | ||
|
||
def action_string | ||
case action | ||
when "create", "delete", "update" | ||
"decidim.admin_log.area_type.#{action}" | ||
else | ||
super | ||
end | ||
end | ||
end | ||
end | ||
end |
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