Skip to content

Additional template and style updates#8181

Merged
javierjulio merged 19 commits into
masterfrom
template-updates
Dec 24, 2023
Merged

Additional template and style updates#8181
javierjulio merged 19 commits into
masterfrom
template-updates

Conversation

@javierjulio

@javierjulio javierjulio commented Dec 16, 2023

Copy link
Copy Markdown
Member

This extracts partials for resource comments, index blank slate and index empty results, with styles now inlined so they can be fully customized. This also adds styles for some remaining elements that weren't converted yet. The attributes_table, status_tag, and table_for components have been updated to use data attributes for metadata and no longer adds any default CSS class names, other than the component class name. The index_column from index table has also been removed.

This partial is for customizing the entire output of active_admin_comments_for method. This used to be a component but is now an Arbre::Element which outputs no root element where as component does. This way the user can control all that from the partial. We may want to consider extracting the comments resource to partials too so for now this is named as resource_comments to avoid confusion.
@javierjulio javierjulio self-assigned this Dec 16, 2023
@codecov

codecov Bot commented Dec 16, 2023

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4454906) 99.01% compared to head (01e6c6a) 99.04%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8181      +/-   ##
==========================================
+ Coverage   99.01%   99.04%   +0.03%     
==========================================
  Files         152      152              
  Lines        4243     4184      -59     
==========================================
- Hits         4201     4144      -57     
+ Misses         42       40       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@javierjulio javierjulio force-pushed the template-updates branch 4 times, most recently from 239beae to 7e6cebc Compare December 23, 2023 18:11
This also renames the partial sidebar_section_block to sidebar_section, to follow same approach from elsewhere, e.g. action items.

This adds default vertical spacing similar to what we had before and can now be customized by the host app.

Since active-filters are implemented as a sidebar, we no longer need the CSS style to set spacing since it's now in the partial as a customizable default.
When ActiveAdmin was created, HTML data attributes and CSS even/odd selection was a new feature in some browsers that year. It was common to use class names for metadata since there wasn't any other means. This now removes any default class names so users can safely specify any Tailwind classes and rely on data attributes when needing to customize further based on that through plain CSS.
No need to manually change options like this since we can just use Arbre to add the default class name.
We mostly just test the default actions so this adds coverage for the edit branch of the id_column method.
No need to query for the SVG elements since we can just use the standard Tailwind modifiers to control which is visible from the HTML. Defaults to light mode.
No need for this to be in an Arbre partial. We only document link_to usage and we have noted in the upgrading guide to not use resource named methods here (e.g. post) and use the resource helper instead.
Add the status given as a data attribute instead of a class in the same format as before (underscore). This way the only class set by default is the status-tag class. Caller can provide any class they want.
To follow table_for, this now uses data attributes for metadata like column name so it can still be styled but not clash. This also changes the default class name to be attributes-table. No need for odd/even classes since CSS has long supported that query selector (started the year ActiveAdmin was created).
This also has no references
@javierjulio javierjulio merged commit 0e630e6 into master Dec 24, 2023
@javierjulio javierjulio deleted the template-updates branch December 24, 2023 06:02
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.

1 participant