Adjust UI for users with restricted permissions#3609
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3609 +/- ##
=======================================
Coverage 97.47% 97.48%
=======================================
Files 314 314
Lines 8240 8256 +16
=======================================
+ Hits 8032 8048 +16
Misses 208 208 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
63e50ca to
e3a1cb2
Compare
sascha-karnatz
approved these changes
Jan 30, 2026
With a custom role that has not ability to edit or update an element, we should disable buttons and turn ingredient form fields into read only input fields.
9f41402 to
511cdbf
Compare
Without the ability to order elements we must not allow to drag the element editors around.
It must not look disabled.
Without the edit ability we need to make sure the input is not editable.
The Rails link_to helper uses the current browser url as default if no link is passed (sigh emoji). Removing the href attribute is the defacto standard to disable links.
We need to treat boolean HTML attributes (e.g., readonly="readonly" or readonly="") as booleans for the Tinymce config.
Instead of removing the button we disable it for better UX
Use muted test color so it looks disabled.
The shared partials were using a variable named ingredient_editor that actually held an ingredient, not an editor component. This caused a bug in _picture_tools.html.erb where the editor component was passed to CanCanCan permission checks instead of the ingredient. This renames the variable to ingredient throughout and fixes the _picture_tools partial to pass picture_editor.ingredient correctly.
3265645 to
04efd58
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this pull request for?
Disables buttons and links if user is not allowed to do related action.
Also marks ingredient editor fields as readonly or disables them if user is not allowed to edit the ingredient.
Checklist