Create a field state label view.

Review Request #13242 — Created Aug. 31, 2023 and submitted

Information

Review Board
release-6.x

Reviewers

This change adds a view for a field state label, a pill shaped label that
displays the state of a field, like our Draft/Submitted/Discarded state labels
for review requests in the dashboard. This can be used on review request
fields to show which fields have been modified in a review request draft.
We'll make use of the label in an upcoming change for file attachments, to
help display which file attachments are new, new revisions, drafts, or
pending deletion.

Right now the label is pretty simple, but it could be expanded upon in the
future to allow a button for reverting a field, diffing the change of a
field, etc. We currently have draft and deleted color themes for the label.

  • Used in the upcoming file attachments change.
  • Attached the label to the summary field.
Summary
Create a field state label view.

Description From Last Updated

I know this is technically in another change, but to avoid shifting the layout, could we overlay the top-left of …

chipx86chipx86

Please add a doc comment at the top describing the file.

daviddavid

This needs a semicolon.

daviddavid

Is this something that we expect to inherit from and override? If not, I don't think we need a template …

daviddavid

Type is wrong here.

daviddavid

Because this view is templatized, we should probably type this as TExtraViewOptions

daviddavid

Can you move this to rb/ui/field-state-label.less? Aiming to give every component its own file.

chipx86chipx86

Let's use ems here.

chipx86chipx86

Each color (and other units) we reference in the component should be defined in a #rb-ns-ui.field-state-label() namespace. Those can then …

chipx86chipx86

Naming of constants should be all UPPER_CASE.

chipx86chipx86
david
  1. 
      
  2. Please add a doc comment at the top describing the file.

  3. This needs a semicolon.

  4. Is this something that we expect to inherit from and override? If not, I don't think we need a template here, and can just do .text(this.#state) in the render function.

  5. Because this view is templatized, we should probably type this as TExtraViewOptions

  6. 
      
maubin
chipx86
  1. 
      
  2. I know this is technically in another change, but to avoid shifting the layout, could we overlay the top-left of the file attachment thumbnail, offsetting into it maybe 0.5em or something?

  3. Can you move this to rb/ui/field-state-label.less? Aiming to give every component its own file.

    1. Would rb/ui/review-request/field-state-label.less be more appropriate since the field state label should only apply to review request pages?

    2. Sure, that works.

  4. Let's use ems here.

  5. Each color (and other units) we reference in the component should be defined in a #rb-ns-ui.field-state-label() namespace. Those can then map to the color codes or other constants. That way, there's one place to update to start changing these values (which will be important later as we move to dark mode support).

  6. Naming of constants should be all UPPER_CASE.

  7. 
      
maubin
chipx86
  1. Ship It!
  2. 
      
maubin
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-6.x (c487dea)
Loading...