Skip to content

Adjust UI for users with restricted permissions#3609

Merged
tvdeyen merged 18 commits intomainfrom
element-ui-permissions
Jan 30, 2026
Merged

Adjust UI for users with restricted permissions#3609
tvdeyen merged 18 commits intomainfrom
element-ui-permissions

Conversation

@tvdeyen
Copy link
Member

@tvdeyen tvdeyen commented Jan 30, 2026

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

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have added tests to cover this change

@tvdeyen tvdeyen added this to the 8.1 milestone Jan 30, 2026
@tvdeyen tvdeyen requested a review from a team as a code owner January 30, 2026 12:36
@codecov
Copy link

codecov bot commented Jan 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.48%. Comparing base (c895e30) to head (04efd58).
⚠️ Report is 19 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tvdeyen tvdeyen force-pushed the element-ui-permissions branch from 63e50ca to e3a1cb2 Compare January 30, 2026 13:12
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.
@tvdeyen tvdeyen force-pushed the element-ui-permissions branch 2 times, most recently from 9f41402 to 511cdbf Compare January 30, 2026 17:53
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.
@tvdeyen tvdeyen force-pushed the element-ui-permissions branch from 3265645 to 04efd58 Compare January 30, 2026 20:45
@tvdeyen tvdeyen merged commit 423f1e1 into main Jan 30, 2026
22 checks passed
@tvdeyen tvdeyen deleted the element-ui-permissions branch January 30, 2026 21:29
This was referenced Feb 4, 2026
This was referenced Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants