From ddca2ca6293b455b70109d6a161c45557590aec8 Mon Sep 17 00:00:00 2001 From: "Ella E." Date: Thu, 19 Dec 2024 05:07:14 -0700 Subject: [PATCH] UX: Apply admin table to Automation settings page (#30341) * UX: Apply admin table classes for consistent mobile styling on the automation page * UX: Remove icon beside the automation page title * DEV: Add status label to translations * UX: Reorder the status and name when on mobile * DEV: Add comment explaining tablet-specific status reorder * DEV: Apply prettier --- ...min-plugins-discourse-automation-index.hbs | 77 +++++++++++++------ .../admin-plugins-discourse-automation.hbs | 32 -------- .../common/discourse-automation.scss | 40 ++++++++++ .../automation/config/locales/client.en.yml | 2 + 4 files changed, 96 insertions(+), 55 deletions(-) diff --git a/plugins/automation/admin/assets/javascripts/admin/templates/admin-plugins-discourse-automation-index.hbs b/plugins/automation/admin/assets/javascripts/admin/templates/admin-plugins-discourse-automation-index.hbs index 294913e6b65..5d59441ce68 100644 --- a/plugins/automation/admin/assets/javascripts/admin/templates/admin-plugins-discourse-automation-index.hbs +++ b/plugins/automation/admin/assets/javascripts/admin/templates/admin-plugins-discourse-automation-index.hbs @@ -1,5 +1,5 @@ {{#if this.model.length}} - +
@@ -14,9 +14,12 @@ {{#each this.model as |automation|}} - + {{#if automation.script.not_found}} - {{else if automation.trigger.not_found}} - {{else}} + }} + + }} + + > +
+ {{i18n "discourse_automation.models.automation.trigger.label"}} +
+ {{if automation.trigger.id automation.trigger.name "-"}} + - + {{/if}} -
+ +
+ {{i18n "discourse_automation.models.automation.status.label"}} +
{{i18n "discourse_automation.scriptables.not_found" script=automation.script.id @@ -24,7 +27,10 @@ }}
+ +
+ {{i18n "discourse_automation.models.automation.status.label"}} +
{{i18n "discourse_automation.triggerables.not_found" trigger=automation.trigger.id @@ -33,46 +39,71 @@
{{format-enabled-automation + > +
+ {{i18n "discourse_automation.models.automation.status.label"}} +
+ {{format-enabled-automation automation.enabled automation.trigger - }}
{{if + > + {{if automation.name automation.name (i18n "discourse_automation.unnamed_automation") - }} {{if automation.trigger.id automation.trigger.name "-"}} {{automation.script.name}} (v{{automation.script.version}}) - - {{avatar automation.last_updated_by imageSize="small"}} - - {{format-date automation.updated_at leaveAgo="true"}} + > +
+ {{i18n "discourse_automation.models.automation.script.label"}} +
+ {{automation.script.name}} + (v{{automation.script.version}}) +
+
+ {{i18n + "discourse_automation.models.automation.last_updated_by.label" + }} +
+
+ + {{avatar automation.last_updated_by imageSize="small"}} + + {{format-date automation.updated_at leaveAgo="true"}} +
+ - Asset 4 -

{{i18n "discourse_automation.title"}}

diff --git a/plugins/automation/assets/stylesheets/common/discourse-automation.scss b/plugins/automation/assets/stylesheets/common/discourse-automation.scss index 544f5050951..e29bc636f36 100644 --- a/plugins/automation/assets/stylesheets/common/discourse-automation.scss +++ b/plugins/automation/assets/stylesheets/common/discourse-automation.scss @@ -13,6 +13,46 @@ } } + .d-admin-table.automations { + .d-admin-row__content { + @include breakpoint("tablet") { + display: grid; + grid-template-columns: 1fr; + grid-template-rows: repeat(5, auto); + } + } + + .d-admin-row__overview { + @include breakpoint("tablet") { + order: 1; + } + } + + .d-admin-row__detail.automations__status { + @include breakpoint("tablet") { + order: 2; // move below the name to avoid empty spacing + } + } + + .d-admin-row__detail.automations__script { + @include breakpoint("tablet") { + order: 3; + } + } + + .d-admin-row__detail.automations__version { + @include breakpoint("tablet") { + order: 4; + } + } + + .d-admin-row__detail.automations__updated-by { + @include breakpoint("tablet") { + order: 5; + } + } + } + .admin-section-landing__header { display: flex; align-items: center; diff --git a/plugins/automation/config/locales/client.en.yml b/plugins/automation/config/locales/client.en.yml index 081bcf62124..91109ef8ea4 100644 --- a/plugins/automation/config/locales/client.en.yml +++ b/plugins/automation/config/locales/client.en.yml @@ -408,6 +408,8 @@ en: label: Script version: label: Version + status: + label: Status enabled: label: Enabled disabled: