From 3f82666619cb03a7142d80975abbafa6d9e0c586 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 15 Jul 2022 14:58:06 +0200 Subject: [PATCH] Fix step for viewer role [SCI-6972] --- .../stylesheets/my_modules/protocol.scss | 3 +++ .../shared_styles/elements/checkboxes.scss | 2 ++ .../steps/components/checklist.scss | 18 +++++++++++++++++- .../stylesheets/steps/components/table.scss | 2 +- .../stylesheets/steps/components/text.scss | 6 +++++- app/javascript/vue/protocol/container.vue | 4 +++- app/javascript/vue/protocol/step.vue | 2 +- .../vue/protocol/step_elements/checklist.vue | 9 ++++++--- .../protocol/step_elements/checklistItem.vue | 4 +++- .../vue/protocol/step_elements/table.vue | 7 ++++++- .../vue/protocol/step_elements/text.vue | 5 ++++- config/locales/en.yml | 3 +++ 12 files changed, 54 insertions(+), 11 deletions(-) diff --git a/app/assets/stylesheets/my_modules/protocol.scss b/app/assets/stylesheets/my_modules/protocol.scss index 7f638efd9..c0d14a5aa 100644 --- a/app/assets/stylesheets/my_modules/protocol.scss +++ b/app/assets/stylesheets/my_modules/protocol.scss @@ -64,6 +64,9 @@ padding-left: .75em; } + .empty-protocol-description { + color: $color-silver-chalice; + } .protocol-options-dropdown { a { diff --git a/app/assets/stylesheets/shared_styles/elements/checkboxes.scss b/app/assets/stylesheets/shared_styles/elements/checkboxes.scss index b5c189811..57e598982 100644 --- a/app/assets/stylesheets/shared_styles/elements/checkboxes.scss +++ b/app/assets/stylesheets/shared_styles/elements/checkboxes.scss @@ -28,6 +28,8 @@ input[type="checkbox"].sci-checkbox { height: var(--sci-checkbox-size); margin-left: calc(var(--sci-checkbox-size) * -1); position: absolute; + right: 0; + top: 0; width: var(--sci-checkbox-size); &::before { diff --git a/app/assets/stylesheets/steps/components/checklist.scss b/app/assets/stylesheets/steps/components/checklist.scss index ee339e878..ebc00162e 100644 --- a/app/assets/stylesheets/steps/components/checklist.scss +++ b/app/assets/stylesheets/steps/components/checklist.scss @@ -37,6 +37,15 @@ } } + .sci-checkbox-view-mode { + align-self: center; + background-color: $color-black; + border-radius: 50%; + height: 4px; + margin-right: .5em; + width: 4px; + } + .step-checklist-add-item { margin-left: 12px; @@ -50,10 +59,17 @@ } .sci-checkbox-container { - margin: 16px 0; + margin: 12px 0; &.disabled { pointer-events: none; } } } + +.step-checklist-container { + .empty-checklist-element { + color: $color-silver-chalice; + margin-left: 3em; + } +} diff --git a/app/assets/stylesheets/steps/components/table.scss b/app/assets/stylesheets/steps/components/table.scss index 0404aa6a0..42f56940d 100644 --- a/app/assets/stylesheets/steps/components/table.scss +++ b/app/assets/stylesheets/steps/components/table.scss @@ -45,7 +45,7 @@ color: $color-black; } - &.view { + &.view:not(.locked) { &:hover { background-color: $color-concrete; diff --git a/app/assets/stylesheets/steps/components/text.scss b/app/assets/stylesheets/steps/components/text.scss index 8196f6b1b..125962d4d 100644 --- a/app/assets/stylesheets/steps/components/text.scss +++ b/app/assets/stylesheets/steps/components/text.scss @@ -10,6 +10,10 @@ flex: 0; } + .empty-text-element { + color: $color-silver-chalice; + } + .buttons-container { background: linear-gradient( 90deg, @@ -35,7 +39,7 @@ position: absolute; } - &:hover:not(.edit) { + &:hover:not(.edit):not(.locked) { background: $color-concrete; .buttons-container { diff --git a/app/javascript/vue/protocol/container.vue b/app/javascript/vue/protocol/container.vue index b5371a85f..622b99479 100644 --- a/app/javascript/vue/protocol/container.vue +++ b/app/javascript/vue/protocol/container.vue @@ -62,7 +62,9 @@ @update="updateDescription" /> -
+
+
+ {{ i18n.t("protocols.no_text_placeholder") }}
diff --git a/app/javascript/vue/protocol/step.vue b/app/javascript/vue/protocol/step.vue index e7977376f..b2886d00f 100644 --- a/app/javascript/vue/protocol/step.vue +++ b/app/javascript/vue/protocol/step.vue @@ -24,7 +24,7 @@ @click="toggleCollapsed"> -
+
-
+
@@ -29,7 +29,7 @@
-
+
+
+ {{ i18n.t("protocols.steps.checklist.empty_checklist") }} +
@@ -126,7 +129,7 @@ return this.linesToPaste > 0; }, locked() { - return this.reordering || this.editingName + return this.reordering || this.editingName || !this.element.attributes.orderable.urls.update_url } }, methods: { diff --git a/app/javascript/vue/protocol/step_elements/checklistItem.vue b/app/javascript/vue/protocol/step_elements/checklistItem.vue index 8e4b7cfd4..98af0cbf6 100644 --- a/app/javascript/vue/protocol/step_elements/checklistItem.vue +++ b/app/javascript/vue/protocol/step_elements/checklistItem.vue @@ -4,8 +4,9 @@
+
-
+
+
-
+
@@ -113,6 +116,8 @@ this.update(); }, updateTable() { + if (this.editingTable == false) return; + let tableData = JSON.stringify({data: this.tableObject.getData()}); this.element.attributes.orderable.contents = tableData; this.update(); diff --git a/app/javascript/vue/protocol/step_elements/text.vue b/app/javascript/vue/protocol/step_elements/text.vue index 5b2e6aa3f..dbac21282 100644 --- a/app/javascript/vue/protocol/step_elements/text.vue +++ b/app/javascript/vue/protocol/step_elements/text.vue @@ -28,7 +28,10 @@ @editingDisabled="disableEditMode" @editingEnabled="enableEditMode" /> -
+
+
+ {{ i18n.t("protocols.steps.text.empty_text") }} +
diff --git a/config/locales/en.yml b/config/locales/en.yml index b3c764891..e541053e1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2270,6 +2270,7 @@ en: unchangable_error_message: "Predefined roles can not be changed!" protocols: + no_text_placeholder: 'No protocol description' reorder_steps: button: "Rearrange steps" modal: @@ -2564,8 +2565,10 @@ en: edit_message: 'Use right click for table options' checklist: default_name: 'Checklist %{position}' + empty_checklist: 'Doesn’t contain any checklist items' text: placeholder: 'Enter step text' + empty_text: 'No text entered' modals: delete_element: title: 'Delete content'