From 72a24128a69a578102c25e34495c6ae704c78103 Mon Sep 17 00:00:00 2001 From: decabeza Date: Fri, 29 May 2020 00:11:25 +0200 Subject: [PATCH] Improve upload image and documents buttons --- app/assets/stylesheets/layout.scss | 23 +++++++++++++++++-- app/assets/stylesheets/mixins/uploads.scss | 4 ---- .../documents/_nested_documents.html.erb | 3 ++- app/views/images/_nested_image.html.erb | 2 +- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/assets/stylesheets/layout.scss b/app/assets/stylesheets/layout.scss index 7c8abf7d5..df8cb15e1 100644 --- a/app/assets/stylesheets/layout.scss +++ b/app/assets/stylesheets/layout.scss @@ -2540,8 +2540,27 @@ table { // 22. Images // ----------------- -.images .button { - margin-top: $line-height / 2; +.button { + + &.upload-image { + @include has-fa-icon(image, solid); + } + + &.upload-document { + @include has-fa-icon(file, solid); + } + + &.upload-image, + &.upload-document { + font-weight: bold; + margin-bottom: $line-height * 1.5; + + &::before { + $button-padding-left: nth($button-padding, 2); + margin-left: -$button-padding-left / 2; + margin-right: $button-padding-left / 2; + } + } } // 23. Maps diff --git a/app/assets/stylesheets/mixins/uploads.scss b/app/assets/stylesheets/mixins/uploads.scss index 7b3a211d4..f7fd718fc 100644 --- a/app/assets/stylesheets/mixins/uploads.scss +++ b/app/assets/stylesheets/mixins/uploads.scss @@ -35,10 +35,6 @@ } } - .button { - font-weight: normal; - } - .progress-bar { width: 100%; background-color: $light-gray; diff --git a/app/views/documents/_nested_documents.html.erb b/app/views/documents/_nested_documents.html.erb index 10bedfa9a..d4f80dd8e 100644 --- a/app/views/documents/_nested_documents.html.erb +++ b/app/views/documents/_nested_documents.html.erb @@ -11,7 +11,8 @@ <%= link_to_add_association t("documents.form.add_new_document"), f, :documents, partial: "documents/document_fields", id: "new_document_link", - class: "button hollow #{"hide" if documentable.documents.count >= documentable.class.max_documents_allowed}", + class: "button upload-document + #{"hide" if max_documents_allowed?(documentable)}", data: { association_insertion_node: "#nested-documents", association_insertion_method: "append" diff --git a/app/views/images/_nested_image.html.erb b/app/views/images/_nested_image.html.erb index 81783eff3..fc8e6cc62 100644 --- a/app/views/images/_nested_image.html.erb +++ b/app/views/images/_nested_image.html.erb @@ -13,7 +13,7 @@ force_non_association_create: true, partial: "images/image_fields", id: "new_image_link", - class: "button hollow + class: "button upload-image #{"hide" if image_fields == :image && imageable.image.present?}", render_options: { locals: { imageable: imageable }