From a32849c79b88e17545bb3e7bd8b6e3f51dfe97d5 Mon Sep 17 00:00:00 2001 From: Alessandro Cuoghi Date: Thu, 24 Aug 2017 14:28:55 +0200 Subject: [PATCH] Changed style button. Add margin top progress bar. --- app/assets/javascripts/forms.js.coffee | 1 - app/assets/stylesheets/documentable.scss | 73 +++++++++++-------- app/views/documents/_nested_document.html.erb | 8 +- .../documents/_nested_documents.html.erb | 5 +- app/views/documents/destroy.js.erb | 5 +- app/views/documents/new_nested.js.erb | 5 +- 6 files changed, 57 insertions(+), 40 deletions(-) diff --git a/app/assets/javascripts/forms.js.coffee b/app/assets/javascripts/forms.js.coffee index 99157ab56..20c3b7718 100644 --- a/app/assets/javascripts/forms.js.coffee +++ b/app/assets/javascripts/forms.js.coffee @@ -34,7 +34,6 @@ App.Forms = i++ initialize: -> - console.log 'initialize forms' App.Forms.disableEnter() App.Forms.submitOnChange() App.Forms.toggleLink() diff --git a/app/assets/stylesheets/documentable.scss b/app/assets/stylesheets/documentable.scss index 5efcd1c24..6f1e57185 100644 --- a/app/assets/stylesheets/documentable.scss +++ b/app/assets/stylesheets/documentable.scss @@ -1,34 +1,49 @@ -.progress-bar { - background-color: transparent; - height: 5px; - width: 100%; - z-index: 666000555; -} +.document{ + .button{ + font-weight: normal; + } -.loading-bar { - height: 5px; - width: 0px; - z-index: 666000666; - -webkit-transition:width 500ms ease-out, height 500ms ease-out; - -moz-transition:width 500ms ease-out, height 500ms ease-out; - -o-transition:width 500ms ease-out, height 500ms ease-out; - transition:width 500ms ease-out, height 500ms ease-out; - &.uploading{ - background-color: #bbb; - } - &.complete{ - background-color: #0f0; + .progress-bar { + background-color: transparent; + height: 5px; width: 100%; + z-index: 666000555; + } + + .file-name{ + margin-top:15px; + } + + .loading-bar { + height: 5px; + width: 0px; + z-index: 666000666; + -webkit-transition:width 500ms ease-out, height 500ms ease-out; + -moz-transition:width 500ms ease-out, height 500ms ease-out; + -o-transition:width 500ms ease-out, height 500ms ease-out; + transition:width 500ms ease-out, height 500ms ease-out; + + &.uploading { + background-color: #bbb; + } + + &.complete { + background-color: #0f0; + width: 100%; + margin-top: $line-height * 2; + } + + &.errors { + background-color: #f00; + width: 100%; + } + } + + .loading-bar.no-transition { + -webkit-transition:none; + -moz-transition:none; + -o-transition:none; + transition:none; } - &.errors{ - background-color: #f00; - width: 100%; - } -} -.loading-bar.no-transition { - -webkit-transition:none; - -moz-transition:none; - -o-transition:none; - transition:none; } diff --git a/app/views/documents/_nested_document.html.erb b/app/views/documents/_nested_document.html.erb index 75f9c8e5f..432a981bc 100644 --- a/app/views/documents/_nested_document.html.erb +++ b/app/views/documents/_nested_document.html.erb @@ -44,17 +44,17 @@ method: :delete, remote: true, data: { confirm: t('documents.actions.destroy.confirm') }, - class: "button hollow alert" if document.persisted? %> + class: "delete float-right" if document.persisted? %> <% elsif !document.persisted? && document.cached_attachment.present? %> <%= link_to t('documents.form.delete_button'), destroy_upload_documents_path(path: document.cached_attachment, index: index, documentable_type: document.documentable_type, documentable_id: document.documentable_id), method: :delete, remote: true, - class: "button hollow alert" %> + class: "delete float-right" %> <% else %> <%= label_tag document_nested_field_id(document, index, :attachment), t("documents.form.attachment_label"), class: "button hollow #{"error" if document.errors[:attachment].any?}" %> - <%= link_to t('documents.form.delete_button'), "#", class: "button hollow alert remove-document" %> + <%= link_to t('documents.form.delete_button'), "#", class: "delete float-right remove-document" %> <% if document.errors[:attachment].any? %>
<%= document.errors[:attachment].join(", ") %> @@ -65,4 +65,4 @@

<%= document_attachment_file_name(document) %>


- \ No newline at end of file + diff --git a/app/views/documents/_nested_documents.html.erb b/app/views/documents/_nested_documents.html.erb index c1af35058..37f9bb006 100644 --- a/app/views/documents/_nested_documents.html.erb +++ b/app/views/documents/_nested_documents.html.erb @@ -11,7 +11,8 @@ <%= link_to t("documents.form.add_new_document"), new_nested_documents_path(documentable_type: resource.class.name, index: resource.documents.size), remote: true, - id: "new_document_link" %> + id: "new_document_link", + class: "button hollow" %>
<%= t "documents.max_documents_allowed_reached_html" %>
@@ -21,4 +22,4 @@ <% end %> -
\ No newline at end of file +
diff --git a/app/views/documents/destroy.js.erb b/app/views/documents/destroy.js.erb index 39de52fb0..8cea61c63 100644 --- a/app/views/documents/destroy.js.erb +++ b/app/views/documents/destroy.js.erb @@ -2,5 +2,6 @@ App.Documentable.destroy("<%= document_nested_field_wrapper_id(params[:index]) % <% new_document_link = link_to t("documents.form.add_new_document"), new_document_path(documentable_type: @document.documentable_type, index: params[:index]), remote: true, - id: "new_document_link" %> -App.Documentable.updateNewDocumentButton("<%= j new_document_link %>") \ No newline at end of file + id: "new_document_link", + class: "button hollow" %> +App.Documentable.updateNewDocumentButton("<%= j new_document_link %>") diff --git a/app/views/documents/new_nested.js.erb b/app/views/documents/new_nested.js.erb index 2b4707815..a2716f1dd 100644 --- a/app/views/documents/new_nested.js.erb +++ b/app/views/documents/new_nested.js.erb @@ -3,7 +3,8 @@ new_document_link = link_to t("documents.form.add_new_document"), new_nested_documents_path(documentable_type: params[:documentable_type], index: params[:index].to_i + 1), remote: true, - id: "new_document_link" + id: "new_document_link", + class: "button hollow" %> App.Documentable.new("<%= j nested_fields %>") -App.Documentable.updateNewDocumentButton("<%= j new_document_link %>") \ No newline at end of file +App.Documentable.updateNewDocumentButton("<%= j new_document_link %>")