From 90e0f1b37829403531f674221e22498f7d6f3e23 Mon Sep 17 00:00:00 2001 From: Penar Musaraj Date: Mon, 15 Jul 2019 13:44:44 -0400 Subject: [PATCH] UX: rearrange controls in edit modals Allows users to see the controls even after scrolling contents of edit modal. --- .../discourse/templates/modal/history.hbs | 94 +++++++++---------- .../stylesheets/common/base/history.scss | 7 +- app/assets/stylesheets/desktop/history.scss | 13 ++- app/assets/stylesheets/mobile/history.scss | 14 +++ 4 files changed, 69 insertions(+), 59 deletions(-) diff --git a/app/assets/javascripts/discourse/templates/modal/history.hbs b/app/assets/javascripts/discourse/templates/modal/history.hbs index fc6f987451f..2ef40153659 100644 --- a/app/assets/javascripts/discourse/templates/modal/history.hbs +++ b/app/assets/javascripts/discourse/templates/modal/history.hbs @@ -1,24 +1,31 @@ {{#d-modal-body title="history" maxHeight="70%"}}
-
- {{d-button class="btn-default" action=(action "loadFirstVersion") icon="fast-backward" title="post.revisions.controls.first" disabled=loadFirstDisabled}} - {{d-button class="btn-default" action=(action "loadPreviousVersion") icon="backward" title="post.revisions.controls.previous" disabled=loadPreviousDisabled}} -
- {{#conditional-loading-spinner condition=loading size="small"}} - {{{revisionsText}}} - {{/conditional-loading-spinner}} -
- {{d-button class="btn-default" action=(action "loadNextVersion") icon="forward" title="post.revisions.controls.next" disabled=loadNextDisabled}} - {{d-button class="btn-default" action=(action "loadLastVersion") icon="fast-forward" title="post.revisions.controls.last" disabled=loadLastDisabled}} +
+ {{d-icon "pencil-alt"}} + {{#link-to 'user' model.username}} + {{bound-avatar-template model.avatar_template "small"}} {{model.username}} + {{/link-to}} + {{bound-date model.created_at}} + {{#if model.edit_reason}} + — {{model.edit_reason}} + {{/if}} + {{#unless site.mobileView}} + {{#if model.user_changes}} + — {{bound-avatar-template model.user_changes.previous.avatar_template "small"}} {{model.user_changes.previous.username}} + → {{bound-avatar-template model.user_changes.current.avatar_template "small"}} {{model.user_changes.current.username}} + {{/if}} + {{#if model.wiki_changes}} + — {{disabled-icon icon="pencil-square-o" disabled=wikiDisabled}} + {{/if}} + {{#if model.post_type_changes}} + — {{disabled-icon icon="shield-alt" disabled=postTypeDisabled}} + {{/if}} + {{#if model.category_id_changes}} + — {{{previousCategory}}} → {{{currentCategory}}} + {{/if}} + {{/unless}}
- {{#if displayEdit}} - {{d-button action=(action "editPost") - class="btn-default" - icon="pencil-alt" - label=editButtonLabel}} - {{/if}} -
{{d-button action=(action "displayInline") icon="square-o" @@ -40,31 +47,6 @@ {{/unless}}
-
- {{d-icon "pencil-alt"}} - {{#link-to 'user' model.username}} - {{bound-avatar-template model.avatar_template "small"}} {{model.username}} - {{/link-to}} - {{bound-date model.created_at}} - {{#if model.edit_reason}} - — {{model.edit_reason}} - {{/if}} - {{#unless site.mobileView}} - {{#if model.user_changes}} - — {{bound-avatar-template model.user_changes.previous.avatar_template "small"}} {{model.user_changes.previous.username}} - → {{bound-avatar-template model.user_changes.current.avatar_template "small"}} {{model.user_changes.current.username}} - {{/if}} - {{#if model.wiki_changes}} - — {{disabled-icon icon="pencil-square-o" disabled=wikiDisabled}} - {{/if}} - {{#if model.post_type_changes}} - — {{disabled-icon icon="shield-alt" disabled=postTypeDisabled}} - {{/if}} - {{#if model.category_id_changes}} - — {{{previousCategory}}} → {{{currentCategory}}} - {{/if}} - {{/unless}} -
{{#if model.title_changes}}
@@ -124,6 +106,26 @@ {{/d-modal-body}} {{#if topicController}} {{/if}} diff --git a/app/assets/stylesheets/common/base/history.scss b/app/assets/stylesheets/common/base/history.scss index a17ad25490d..c4724f06b55 100644 --- a/app/assets/stylesheets/common/base/history.scss +++ b/app/assets/stylesheets/common/base/history.scss @@ -9,12 +9,9 @@ #revision { overflow: auto; + border-bottom: 3px solid $primary-low; } - #revision-controls { - display: inline-block; - margin-bottom: 5px; - } table.markdown > tbody > tr > td, .revision-content { width: 47.5%; @@ -27,8 +24,6 @@ #revision-details { padding: 5px; - margin-top: 10px; - border-bottom: 3px solid $primary-low; } #revisions .row:first-of-type { diff --git a/app/assets/stylesheets/desktop/history.scss b/app/assets/stylesheets/desktop/history.scss index 196c1b307ca..9f11b58e81c 100644 --- a/app/assets/stylesheets/desktop/history.scss +++ b/app/assets/stylesheets/desktop/history.scss @@ -16,10 +16,10 @@ background-color: $danger-medium; } } - #display-modes { - text-align: right; - display: inline-block; - float: right; + + #revision { + display: flex; + justify-content: space-between; } #revisions { @@ -59,4 +59,9 @@ .modal-header { height: 42px; } + + .modal-footer { + display: flex; + justify-content: space-between; + } } diff --git a/app/assets/stylesheets/mobile/history.scss b/app/assets/stylesheets/mobile/history.scss index cdcbd44d2e8..662baef2796 100644 --- a/app/assets/stylesheets/mobile/history.scss +++ b/app/assets/stylesheets/mobile/history.scss @@ -28,4 +28,18 @@ word-wrap: break-word; } } + + .modal-footer { + text-align: center; + } + + #revision-controls { + margin-bottom: 5px; + } + + #revision-footer-buttons { + button { + @extend .btn-small; + } + } }