From a92a6b7b101b2fb5daae47182244441d9df50538 Mon Sep 17 00:00:00 2001 From: Kris Date: Mon, 24 Aug 2020 22:51:58 -0400 Subject: [PATCH] UX: Minor layout fixes and improved consistency on theme admin --- .../admin/templates/customize-themes-show.hbs | 203 +++++++++--------- .../stylesheets/common/admin/customize.scss | 32 ++- 2 files changed, 126 insertions(+), 109 deletions(-) diff --git a/app/assets/javascripts/admin/templates/customize-themes-show.hbs b/app/assets/javascripts/admin/templates/customize-themes-show.hbs index 0e452a960cc48..73d78b085e39f 100644 --- a/app/assets/javascripts/admin/templates/customize-themes-show.hbs +++ b/app/assets/javascripts/admin/templates/customize-themes-show.hbs @@ -2,13 +2,14 @@
{{#if editingName}} {{text-field value=model.name autofocus="true"}} - {{d-button action=(action "finishedEditingName") class="btn-primary submit-edit" icon="check"}} - {{d-button action=(action "cancelEditingName") class="cancel-edit" icon="times"}} + {{d-button action=(action "finishedEditingName") class="btn-primary btn-small submit-edit" icon="check"}} + {{d-button action=(action "cancelEditingName") class="btn-small cancel-edit" icon="times"}} {{else}} {{model.name}} {{d-button action=(action "startEditingName") icon="pencil-alt" + class="btn-small" }} {{/if}}
@@ -52,93 +53,92 @@ {{/unless}} - {{#unless model.component}} -
- {{inline-edit-checkbox action=(action "applyDefault") labelKey="admin.customize.theme.is_default" checked=model.default}} - {{inline-edit-checkbox action=(action "applyUserSelectable") labelKey="admin.customize.theme.user_selectable" checked=model.user_selectable}} -
- {{/unless}} - - {{#if model.remote_theme}} - - {{#if model.remote_theme.remote_url}} - {{#if sourceIsHttp}} - {{i18n "admin.customize.theme.source_url"}}{{d-icon "link"}} - {{else}} -
{{model.remote_theme.remote_url}}
- {{/if}} - {{/if}} - {{#if model.remote_theme.about_url}} - {{i18n "admin.customize.theme.about_theme"}}{{d-icon "link"}} - {{/if}} - {{#if model.remote_theme.license_url}} - {{i18n "admin.customize.theme.license"}}{{d-icon "link"}} - {{/if}} - - {{#if model.description}} - {{model.description}} - {{/if}} +
+ {{#if model.remote_theme}} + {{#if model.remote_theme.remote_url}} + {{#if sourceIsHttp}} + {{i18n "admin.customize.theme.source_url"}}{{d-icon "link"}} + {{else}} +
{{model.remote_theme.remote_url}}
+ {{/if}} + {{/if}} + {{#if model.remote_theme.about_url}} + {{i18n "admin.customize.theme.about_theme"}}{{d-icon "link"}} + {{/if}} + {{#if model.remote_theme.license_url}} + {{i18n "admin.customize.theme.license"}}{{d-icon "link"}} + {{/if}} - + {{#if model.description}} + {{model.description}} + {{/if}} -
- {{#if model.remote_theme.is_git}} + {{#if model.remote_theme.authors}}{{i18n "admin.customize.theme.authors"}} {{model.remote_theme.authors}}{{/if}} + {{#if model.remote_theme.theme_version}}{{i18n "admin.customize.theme.version"}} {{model.remote_theme.theme_version}}{{/if}} - {{#if showRemoteError}} -
- {{d-icon "exclamation-triangle"}} {{i18n "admin.customize.theme.repo_unreachable"}} -
-
- {{model.remoteError}} -
- {{/if}} +
+ {{#if model.remote_theme.is_git}} - {{#if model.remote_theme.commits_behind}} - {{#d-button action=(action "updateToLatest") icon="download" class="btn-primary"}}{{i18n "admin.customize.theme.update_to_latest"}}{{/d-button}} - {{else}} - {{#d-button action=(action "checkForThemeUpdates") icon="sync" class="btn-default"}}{{i18n "admin.customize.theme.check_for_updates"}}{{/d-button}} - {{/if}} + {{#if showRemoteError}} +
+ {{d-icon "exclamation-triangle"}} {{i18n "admin.customize.theme.repo_unreachable"}} +
+
+ {{model.remoteError}} +
+ {{/if}} - - {{#if updatingRemote}} - {{i18n "admin.customize.theme.updating"}} + {{#if model.remote_theme.commits_behind}} + {{d-button action=(action "updateToLatest") icon="download" class="btn-primary" label="admin.customize.theme.update_to_latest"}} {{else}} - {{#if model.remote_theme.commits_behind}} - {{i18n "admin.customize.theme.commits_behind" count=model.remote_theme.commits_behind}} - {{#if model.remote_theme.github_diff_link}} - - {{i18n "admin.customize.theme.compare_commits"}} - - {{/if}} + {{d-button action=(action "checkForThemeUpdates") icon="sync" class="btn-default" label="admin.customize.theme.check_for_updates"}} + {{/if}} + + + {{#if updatingRemote}} + {{i18n "admin.customize.theme.updating"}} {{else}} - {{#unless showRemoteError}} - {{i18n "admin.customize.theme.up_to_date"}} {{format-date model.remote_theme.updated_at leaveAgo="true"}} - {{/unless}} + {{#if model.remote_theme.commits_behind}} + {{i18n "admin.customize.theme.commits_behind" count=model.remote_theme.commits_behind}} + {{#if model.remote_theme.github_diff_link}} + + {{i18n "admin.customize.theme.compare_commits"}} + + {{/if}} + {{else}} + {{#unless showRemoteError}} + {{i18n "admin.customize.theme.up_to_date"}} {{format-date model.remote_theme.updated_at leaveAgo="true"}} + {{/unless}} + {{/if}} {{/if}} - {{/if}} - - {{else}} - - {{d-icon "info-circle"}} {{i18n "admin.customize.theme.imported_from_archive"}} + + {{else}} + + {{d-icon "info-circle"}} {{i18n "admin.customize.theme.imported_from_archive"}} + + {{/if}} +
+ {{else}} + {{i18n "admin.customize.theme.creator"}} + + {{#user-link user=model.user}} + {{format-username model.user.username}} + {{/user-link}} - {{/if}} -
- {{else}} + {{/if}} +
+ + + {{#unless model.component}}
- {{i18n "admin.customize.theme.creator"}} - - {{#user-link user=model.user}} - {{format-username model.user.username}} - {{/user-link}} - + {{inline-edit-checkbox action=(action "applyDefault") labelKey="admin.customize.theme.is_default" checked=model.default}} + {{inline-edit-checkbox action=(action "applyUserSelectable") labelKey="admin.customize.theme.user_selectable" checked=model.user_selectable}}
- {{/if}} + {{/unless}} + {{#unless model.component}} - {{#d-section class="form-horizontal theme settings"}} + {{#d-section class="form-horizontal theme settings control-unit"}}
{{i18n "admin.customize.theme.color_scheme"}} @@ -175,13 +175,13 @@ {{/if}} {{#if model.component}} - {{#d-section class="form-horizontal theme settings"}} + {{#d-section class="form-horizontal theme settings control-unit"}}
{{theme-setting-relatives-selector setting=relativesSelectorSettingsForComponent model=model class="theme-setting"}}
{{/d-section}} {{else}} - {{#d-section class="form-horizontal theme settings"}} + {{#d-section class="form-horizontal theme settings control-unit"}}
{{theme-setting-relatives-selector setting=relativesSelectorSettingsForTheme model=model class="theme-setting"}}
@@ -225,7 +225,7 @@ {{else}}
{{i18n "admin.customize.theme.no_uploads"}}
{{/if}} - {{#d-button action=(action "addUploadModal") class="btn-default" icon="plus"}}{{i18n "admin.customize.theme.add"}}{{/d-button}} + {{d-button action=(action "addUploadModal") class="btn-default" icon="plus" label="admin.customize.theme.add"}}
{{#if extraFiles.length}} @@ -251,7 +251,7 @@ {{#if hasSettings}}
{{i18n "admin.customize.theme.theme_settings"}}
- {{#d-section class="form-horizontal theme settings"}} + {{#d-section class="form-horizontal theme settings control-unit"}} {{#each settings as |setting|}} {{theme-setting-editor setting=setting model=model class="theme-setting"}} {{/each}} @@ -262,7 +262,7 @@ {{#if hasTranslations}}
{{i18n "admin.customize.theme.theme_translations"}}
- {{#d-section class="form-horizontal theme settings translations"}} + {{#d-section class="form-horizontal theme settings translations control-unit"}} {{#each translations as |translation|}} {{theme-translation translation=translation model=model class="theme-translation"}} {{/each}} @@ -270,26 +270,31 @@
{{/if}} - {{d-icon "desktop"}}{{i18n "admin.customize.theme.preview"}} - {{d-icon "download"}} {{i18n "admin.export_json.button_text"}} +
+ + {{d-icon "desktop"}}{{i18n "admin.customize.theme.preview"}} + {{d-icon "download"}} {{i18n "admin.export_json.button_text"}} - {{d-button action=(action "switchType") label="admin.customize.theme.convert" icon=convertIcon class="btn-default btn-normal" title=convertTooltip}} + {{d-button action=(action "switchType") label="admin.customize.theme.convert" icon=convertIcon class="btn-default btn-normal" title=convertTooltip}} - {{#if model.component}} - {{#if model.enabled}} - {{d-button - class="btn-default" - action=(action "disableComponent") - icon="ban" - label="admin.customize.theme.disable"}} - {{else}} - {{d-button - class="btn-default" - action=(action "enableComponent") - icon="check" - label="admin.customize.theme.enable"}} + {{#if model.component}} + {{#if model.enabled}} + {{d-button + class="btn-default" + action=(action "disableComponent") + icon="ban" + label="admin.customize.theme.disable"}} + {{else}} + {{d-button + class="btn-default" + action=(action "enableComponent") + icon="check" + label="admin.customize.theme.enable"}} + {{/if}} {{/if}} - {{/if}} - {{d-button action=(action "destroy") label="admin.customize.delete" icon="trash-alt" class="btn-danger"}} + {{d-button action=(action "destroy") label="admin.customize.delete" icon="trash-alt" class="btn-danger"}} + +
+
diff --git a/app/assets/stylesheets/common/admin/customize.scss b/app/assets/stylesheets/common/admin/customize.scss index 970a72047e03a..e5617aa01244e 100644 --- a/app/assets/stylesheets/common/admin/customize.scss +++ b/app/assets/stylesheets/common/admin/customize.scss @@ -108,19 +108,21 @@ display: inline-block; vertical-align: top; - .btn { - line-height: $line-height-medium; // Temporary button-height fix - } - .title { font-size: $font-up-4; font-weight: bold; - margin-bottom: 10px; - a { - font-size: $font-down-2; + margin-bottom: 0.25em; + display: flex; + align-items: stretch; + + input { + margin: 0; } .btn { - line-height: $line-height-small; + margin-left: 0.5em; + } + a { + font-size: $font-down-2; } } @@ -161,8 +163,8 @@ margin-bottom: 7px; } .control-unit { - margin-bottom: 25px; - margin-top: 15px; + margin-top: 0.5em; + margin-bottom: 2em; } .control { margin-bottom: 10px; @@ -170,6 +172,13 @@ .description { margin-bottom: 12px; } + .theme-controls { + display: flex; + flex-wrap: wrap; + .btn { + margin: 0 0.5em 0.5em 0; + } + } } .add-component-button { vertical-align: middle; @@ -330,6 +339,9 @@ margin-bottom: 0.5rem; } } + .setting { + padding-bottom: 0; + } } .current-style.maximized {