Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Update API to reflect changes in silverstripe/framework #1271

Merged

Conversation

GuySartorelli
Copy link
Member

@GuySartorelli GuySartorelli commented Nov 7, 2024

Replaces use of the overly-broadly named description configuration in favour of the new class_description config added in silverstripe/silverstripe-framework#11460 and uses i18n_classDescription instead of custom i18n code.

Also updates status flag rendering to render any flags in getStatusFlags().

Ends up looking something like this (custom flag added by overriding getStatusFlags())
Screenshot from 2024-11-20 14-56-56

Issue

@GuySartorelli GuySartorelli marked this pull request as draft November 7, 2024 03:28
@GuySartorelli GuySartorelli force-pushed the pulls/6/new-description-config branch from b432c54 to 1d6e135 Compare November 7, 2024 23:36
@GuySartorelli GuySartorelli force-pushed the pulls/6/new-description-config branch 2 times, most recently from 33e17ed to e73c467 Compare November 14, 2024 04:21
@GuySartorelli GuySartorelli marked this pull request as ready for review November 14, 2024 04:40
@GuySartorelli GuySartorelli force-pushed the pulls/6/new-description-config branch 2 times, most recently from b252f6d to 157c85e Compare November 20, 2024 02:53
@GuySartorelli GuySartorelli changed the title API Use new class_description configuration API Update API to reflect changes in silverstripe/framework Nov 20, 2024
Comment on lines -32 to -33
color: $state-draft;
background-color: $state-modified-bg;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rely on silverstripe/admin styling for colours

Comment on lines -212 to +198
{this.renderStatusBadge()}
{this.renderStatusFlagBadges()}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're rendering potentially multiple badges now, so I've updated the logic to handle that and to pull the status flags from BaseElement.

@@ -205,6 +205,7 @@ public function apiReadElements(HTTPRequest $request): HTTPResponse
'canPublish' => $element->canPublish(),
'canUnpublish' => $element->canUnpublish(),
'canCreate' => $element->canCreate(),
'statusFlags' => $element->getStatusFlags(),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulls through status flags for use in javascript

@GuySartorelli GuySartorelli force-pushed the pulls/6/new-description-config branch 2 times, most recently from eff93d5 to af06aea Compare November 21, 2024 21:20
@GuySartorelli GuySartorelli force-pushed the pulls/6/new-description-config branch from af06aea to 26d094d Compare November 24, 2024 20:53
@emteknetnz emteknetnz merged commit 59aea22 into silverstripe:6 Nov 26, 2024
7 of 17 checks passed
@emteknetnz emteknetnz deleted the pulls/6/new-description-config branch November 26, 2024 03:41
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