Add a new cookie policy/category manager#521
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #521 +/- ##
==========================================
+ Coverage 94.60% 97.09% +2.49%
==========================================
Files 183 196 +13
Lines 4948 5335 +387
==========================================
+ Hits 4681 5180 +499
+ Misses 267 155 -112 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Adds an admin-facing “Cookie Management” feature to Decidim Awesome to configure cookie consent categories and items via UI (backed by AwesomeConfig), and uses a custom data consent cell to render configured categories on the public side.
Changes:
- Add admin CRUD for cookie categories and cookie items, stored under
AwesomeConfig[:cookie_management]. - Add a custom
DataConsentCell+ view to render configured cookie categories/items (with visibility rules). - Register new admin menu entry, feature flag, routes, and translations; add specs for the new behavior.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| spec/system/public/voting_cards_spec.rb | Adds extra synchronization assertions around voting UI. |
| spec/forms/admin/cookie_item_form_spec.rb | New validation coverage for cookie item form. |
| spec/forms/admin/cookie_category_form_spec.rb | New validation coverage for cookie category form, including visibility states. |
| spec/controllers/admin/cookie_items_controller_spec.rb | New controller specs for cookie items CRUD. |
| spec/controllers/admin/cookie_categories_controller_spec.rb | New controller specs for cookie categories CRUD. |
| spec/commands/admin/update_cookie_item_spec.rb | New command spec for updating a cookie item. |
| spec/commands/admin/update_cookie_category_spec.rb | New command spec for updating a cookie category. |
| spec/commands/admin/destroy_cookie_item_spec.rb | New command spec for deleting/resetting a cookie item. |
| spec/commands/admin/destroy_cookie_category_spec.rb | New command spec for deleting/resetting a cookie category. |
| spec/commands/admin/create_cookie_item_spec.rb | New command spec for creating a cookie item (including duplicate checks). |
| spec/commands/admin/create_cookie_category_spec.rb | New command spec for creating a cookie category (including duplicate checks). |
| spec/cells/data_consent_cell_spec.rb | New cell spec for rendering configured categories/items. |
| lib/decidim/decidim_awesome/test/initializer.rb | Enables :cookie_management in test initializer config list. |
| lib/decidim/decidim_awesome/menu.rb | Adds admin menu entry for cookie management and adjusts menu positions. |
| lib/decidim/decidim_awesome/has_cookie_categories.rb | Introduces default-category helpers, normalization, visibility logic, and reset/modified checks. |
| lib/decidim/decidim_awesome/engine.rb | Requires cookie category helpers and registers a new icon. |
| lib/decidim/decidim_awesome/awesome.rb | Adds config_accessor :cookie_management. |
| lib/decidim/decidim_awesome/admin_engine.rb | Adds routes for cookie categories and nested cookie items. |
| config/locales/en.yml | Adds admin UI strings and attribute labels for cookie management. |
| app/views/layouts/decidim/_application.html.erb | Switches data consent cell to the custom one when feature enabled. |
| app/views/decidim/decidim_awesome/admin/cookie_items/new.html.erb | New item creation UI. |
| app/views/decidim/decidim_awesome/admin/cookie_items/index.html.erb | New items list UI with actions/reset logic. |
| app/views/decidim/decidim_awesome/admin/cookie_items/edit.html.erb | New item edit UI. |
| app/views/decidim/decidim_awesome/admin/cookie_items/_form.html.erb | Form partial for cookie items. |
| app/views/decidim/decidim_awesome/admin/cookie_categories/new.html.erb | New category creation UI. |
| app/views/decidim/decidim_awesome/admin/cookie_categories/index.html.erb | New categories list UI with actions/reset logic. |
| app/views/decidim/decidim_awesome/admin/cookie_categories/edit.html.erb | New category edit UI. |
| app/views/decidim/decidim_awesome/admin/cookie_categories/_form.html.erb | Form partial for cookie categories. |
| app/overrides/decidim/meetings/layouts/live_event/replace_data_consent.html.erb.deface | Replaces the consent cell in meetings live event layout when enabled. |
| app/forms/decidim/decidim_awesome/admin/cookie_item_form.rb | New admin form object for cookie items. |
| app/forms/decidim/decidim_awesome/admin/cookie_category_form.rb | New admin form object for cookie categories. |
| app/controllers/decidim/decidim_awesome/admin/cookie_items_controller.rb | New controller for managing cookie items. |
| app/controllers/decidim/decidim_awesome/admin/cookie_categories_controller.rb | New controller for managing cookie categories. |
| app/controllers/concerns/decidim/decidim_awesome/admin/cookie_management_helpers.rb | Shared config access + helpers for cookie management controllers. |
| app/controllers/concerns/decidim/decidim_awesome/admin/cookie_breadcrumb_helper.rb | Adds breadcrumb helper for the new admin pages. |
| app/commands/decidim/decidim_awesome/admin/update_cookie_item.rb | Command to update an item in config. |
| app/commands/decidim/decidim_awesome/admin/update_cookie_category.rb | Command to update a category in config. |
| app/commands/decidim/decidim_awesome/admin/destroy_cookie_item.rb | Command to delete/reset an item. |
| app/commands/decidim/decidim_awesome/admin/destroy_cookie_category.rb | Command to delete/reset a category. |
| app/commands/decidim/decidim_awesome/admin/create_cookie_item.rb | Command to create an item. |
| app/commands/decidim/decidim_awesome/admin/create_cookie_category.rb | Command to create a category. |
| app/cells/decidim/decidim_awesome/data_consent_cell.rb | Custom consent cell that reads categories from AwesomeConfig. |
| app/cells/decidim/decidim_awesome/data_consent/category.erb | Custom consent category rendering including items table. |
Comments suppressed due to low confidence (2)
config/locales/en.yml:563
- The strings
cookie_items.*.cannot_edit_mandatory_category/cannot_remove_mandatory_categoryare phrased as applying to any mandatory category, but the enforcement checksdefault_category? && mandatory. Either clarify the text to match the actual restriction (default mandatory categories) or enforce the restriction for all mandatory categories.
cannot_edit_mandatory_category: Items from mandatory categories cannot
be edited
save: Save
title: Edit cookie item
index:
back_to_categories: Back to categories
cannot_edit_mandatory_category: Items from mandatory categories cannot
be edited
cannot_remove_default: Default items cannot be removed
cannot_remove_mandatory_category: Items from mandatory categories cannot
be removed
config/locales/en.yml:526
- The translation key
cookie_categories.index.cannot_edit_mandatorysays mandatory categories cannot be edited, but the UI logic only disables editing for default mandatory categories (is_default && is_mandatory). Either adjust the copy to match the behavior (e.g. "Mandatory default categories...") or extend the restriction to all mandatory categories for consistency.
cannot_edit_mandatory: Mandatory categories cannot be edited
cannot_remove_default: Default categories cannot be removed
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
microstudi
left a comment
There was a problem hiding this comment.
I haven't done a profound review but i see that you can improve some parts by trying not to repead code around. Check specially at the "CookieCategory", "CookieItem" classes. It seems to me that they do much more than needed
There was a problem hiding this comment.
@ElviaBth I've made the latest changes in the code in order to simplificate and solve a couple of bugs.
Now it only requires to add a couple of system tests, please do:
- Create an admin system test editing/creating/deleting categories and items and adding presets.
- Create a public system test where we can see that the default cookies are shown if no editions are made and the corresponding overrides if they are.
🎩 What? Why?
Add a new cookie policy/category manager.
📌 Related Issues
Link your PR to an issue
Related to #?
Fixes #520
📷 Screenshots

menu
admin categories view
admin category items view