From 3902310463ce776c0dffa717415c399852a1b5dd Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 5 Jan 2023 11:42:59 +0100 Subject: [PATCH 1/2] Update protocol view screen [SCI-7590] --- .../stylesheets/protocols/protocol.scss | 83 +++++++-- app/controllers/protocols_controller.rb | 14 ++ app/javascript/vue/protocol/container.vue | 158 +++++++++++------- .../vue/protocol/protocolMetadata.vue | 125 ++++++++------ app/serializers/protocol_serializer.rb | 6 +- app/views/protocols/show.html.erb | 32 +++- config/locales/en.yml | 7 + config/routes.rb | 2 +- 8 files changed, 291 insertions(+), 136 deletions(-) diff --git a/app/assets/stylesheets/protocols/protocol.scss b/app/assets/stylesheets/protocols/protocol.scss index df44ef7cb..d05db6aab 100644 --- a/app/assets/stylesheets/protocols/protocol.scss +++ b/app/assets/stylesheets/protocols/protocol.scss @@ -9,38 +9,96 @@ margin: 0 -16px; min-height: calc(100vh - var(--navbar-height)); overflow: hidden; - padding: 36px 10px 10px; + padding: 0 0 10px; width: calc(100% + 31px); + .content-header { + padding: 0 2em; + } + .protocol-position-container { background-color: $color-white; box-shadow: $flyout-shadow; - margin: 0 auto; + margin: 20px auto; max-width: 900px; padding: 10px 10px 10px 26px; } + .protocol-section { + margin: 16px 0 16px -20px; + + &.protocol-steps-section { + margin-left: 0; + } + + .protocol-section-caret { + color: $color-volcano; + display: inline-block; + padding: .5em; + text-decoration: none; + + .fas { + margin-right: 5px; + } + + &:not(.collapsed) .fas { + @include rotate(90deg); + } + } + + .protocol-section-title { + display: inline-block; + + h2 { + display: inline-block; + margin: 10px 0; + } + + .protocol-code { + color: $color-volcano; + margin-left: .5em; + } + + } + + .protocol-section-header { + align-items: center; + display: flex; + flex-wrap: wrap; + + .actions-block { + display: flex; + flex-grow: 1; + justify-content: flex-end; + + .caret { + margin-left: 25px; + } + } + } + + .protocol-details { + padding-left: 20px; + } + } + .protocol-metadata { margin-bottom: 2em; + .data-block { + margin-bottom: 16px; + } + .authors-data { align-items: center; display: flex; + margin-top: -12px; .authors-list { flex-basis: calc(100% - 90px); flex-grow: 1; margin-left: .75em; - - &:hover:not(.editing) { - .sci-inline-edit__content { - border: $border-focus; - } - } - - .sci-inline-edit__content { - padding-top: .35em; - } + line-height: 32px; } * { @@ -51,6 +109,7 @@ .keywords-data { align-items: center; display: flex; + margin-top: -12px; .keywords-list { flex-basis: calc(100% - 90px); diff --git a/app/controllers/protocols_controller.rb b/app/controllers/protocols_controller.rb index 0bc368c23..757daa60e 100644 --- a/app/controllers/protocols_controller.rb +++ b/app/controllers/protocols_controller.rb @@ -79,6 +79,8 @@ class ProtocolsController < ApplicationController before_action :set_importer, only: %i(load_from_file import) + before_action :set_inline_name_editing, only: :show + layout 'fluid' def index; end @@ -1103,6 +1105,18 @@ class ProtocolsController < ApplicationController end end + def set_inline_name_editing + return unless can_manage_protocol_in_repository?(@protocol) + + @inline_editable_title_config = { + name: 'title', + params_group: 'protocol', + item_id: @protocol.id, + field_to_udpate: 'name', + path_to_update: name_protocol_path(@protocol) + } + end + def load_team_and_type @current_team = current_team # :public, :private or :archive diff --git a/app/javascript/vue/protocol/container.vue b/app/javascript/vue/protocol/container.vue index 9607fffc8..2f6f35a05 100644 --- a/app/javascript/vue/protocol/container.vue +++ b/app/javascript/vue/protocol/container.vue @@ -33,7 +33,7 @@
-
+
-
- -
-
-
- {{ i18n.t("protocols.no_text_placeholder") }} -
-
- - - {{ i18n.t("protocols.steps.new_step") }} - -
- - - - - {{ i18n.t("protocols.reorder_steps.button") }} - -
-
- +
+
+ +
+
+
+ {{ i18n.t("protocols.no_text_placeholder") }} +
+
+
+
+
+ +
+
+ + + + + {{ i18n.t("protocols.reorder_steps.button") }} + +
+
+ +
+ +
-
-