mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-10 07:05:57 +08:00
Step rearranging fixes [SCI-6970]
This commit is contained in:
parent
3d2e835268
commit
496ade309c
7 changed files with 34 additions and 13 deletions
|
@ -92,6 +92,11 @@
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
flex-basis: 20%;
|
flex-basis: 20%;
|
||||||
|
|
||||||
|
.disabled {
|
||||||
|
color: $color-silver-chalice;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.dropdown-menu {
|
.dropdown-menu {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
@ -135,12 +140,12 @@
|
||||||
|
|
||||||
.step-elements {
|
.step-elements {
|
||||||
padding-left: calc(var(--left-component-padding) * 2);
|
padding-left: calc(var(--left-component-padding) * 2);
|
||||||
|
}
|
||||||
|
|
||||||
.step-element-grip-placeholder {
|
.step-element-grip-placeholder {
|
||||||
height: 24px;
|
height: 24px;
|
||||||
width: 28px;
|
width: 28px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.comments-counter {
|
.comments-counter {
|
||||||
@include font-small;
|
@include font-small;
|
||||||
|
@ -242,6 +247,7 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
|
|
||||||
.step-element-number {
|
.step-element-number {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
|
@ -300,6 +306,13 @@
|
||||||
|
|
||||||
.step-element-name {
|
.step-element-name {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.step-element-name-placeholder {
|
||||||
|
color: $color-silver-chalice;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fas {
|
.fas {
|
||||||
|
|
|
@ -78,9 +78,12 @@
|
||||||
<span class="fas fa-caret-down"></span>
|
<span class="fas fa-caret-down"></span>
|
||||||
{{ i18n.t("protocols.steps.expand_label") }}
|
{{ i18n.t("protocols.steps.expand_label") }}
|
||||||
</button>
|
</button>
|
||||||
<a v-if="urls.reorder_steps_url && steps.length > 1" class="btn btn-light" data-toggle="modal"
|
<a v-if="urls.reorder_steps_url"
|
||||||
|
class="btn btn-light"
|
||||||
|
data-toggle="modal"
|
||||||
@click="startStepReorder"
|
@click="startStepReorder"
|
||||||
@keyup.enter="startStepReorder"
|
@keyup.enter="startStepReorder"
|
||||||
|
:class="{'disabled': steps.length == 1}"
|
||||||
tabindex="0" >
|
tabindex="0" >
|
||||||
<i class="fas fas-rotated-90 fa-exchange-alt" aria-hidden="true"></i>
|
<i class="fas fas-rotated-90 fa-exchange-alt" aria-hidden="true"></i>
|
||||||
<span>{{ i18n.t("protocols.reorder_steps.button") }}</span>
|
<span>{{ i18n.t("protocols.reorder_steps.button") }}</span>
|
||||||
|
@ -98,7 +101,7 @@
|
||||||
:inRepository="inRepository"
|
:inRepository="inRepository"
|
||||||
@step:delete="updateStepsPosition"
|
@step:delete="updateStepsPosition"
|
||||||
@step:update="updateStep"
|
@step:update="updateStep"
|
||||||
:reorderStepUrl="urls.reorder_steps_url"
|
:reorderStepUrl="steps.length > 1 ? urls.reorder_steps_url : null"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
<div class="step-element-name">
|
<div class="step-element-name">
|
||||||
<strong v-if="includeNumbers" class="step-element-number">{{ index + 1 }}</strong>
|
<strong v-if="includeNumbers" class="step-element-number">{{ index + 1 }}</strong>
|
||||||
<i v-if="item.attributes.icon" class="fas" :class="item.attributes.icon"></i>
|
<i v-if="item.attributes.icon" class="fas" :class="item.attributes.icon"></i>
|
||||||
{{ item.attributes.name }}
|
<span v-if="item.attributes.name">{{ item.attributes.name }}</span>
|
||||||
|
<span v-else class="step-element-name-placeholder">{{ item.attributes.placeholder }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Draggable>
|
</Draggable>
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<div v-if="reorderStepUrl" class="step-element-grip" @click="$emit('reorder')">
|
<div v-if="reorderStepUrl" class="step-element-grip" @click="$emit('reorder')">
|
||||||
<i class="fas fas-rotated-90 fa-exchange-alt"></i>
|
<i class="fas fas-rotated-90 fa-exchange-alt"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-else class="step-element-grip-placeholder"></div>
|
||||||
<a class="step-collapse-link"
|
<a class="step-collapse-link"
|
||||||
:href="'#stepBody' + step.id"
|
:href="'#stepBody' + step.id"
|
||||||
data-toggle="collapse"
|
data-toggle="collapse"
|
||||||
|
@ -153,7 +154,7 @@
|
||||||
@cancel="showClipboardPasteModal = false"
|
@cancel="showClipboardPasteModal = false"
|
||||||
/>
|
/>
|
||||||
<ReorderableItemsModal v-if="reordering"
|
<ReorderableItemsModal v-if="reordering"
|
||||||
:title="i18n.t('protocols.steps.modals.reorder_elements.title', { step_name: step.attributes.name })"
|
:title="i18n.t('protocols.steps.modals.reorder_elements.title', { step_position: step.attributes.position + 1 })"
|
||||||
:items="reorderableElements"
|
:items="reorderableElements"
|
||||||
@reorder="updateElementOrder"
|
@reorder="updateElementOrder"
|
||||||
@close="closeReorderModal"
|
@close="closeReorderModal"
|
||||||
|
@ -194,7 +195,6 @@
|
||||||
required: true
|
required: true
|
||||||
},
|
},
|
||||||
reorderStepUrl: {
|
reorderStepUrl: {
|
||||||
type: String,
|
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
v-if="element.attributes.orderable.urls.update_url"
|
v-if="element.attributes.orderable.urls.update_url"
|
||||||
:value="element.attributes.orderable.text"
|
:value="element.attributes.orderable.text"
|
||||||
:value_html="element.attributes.orderable.text_view"
|
:value_html="element.attributes.orderable.text_view"
|
||||||
:placeholder="i18n.t('protocols.steps.text.placeholder')"
|
:placeholder="element.attributes.orderable.placeholder"
|
||||||
:updateUrl="element.attributes.orderable.urls.update_url"
|
:updateUrl="element.attributes.orderable.urls.update_url"
|
||||||
:objectType="'StepText'"
|
:objectType="'StepText'"
|
||||||
:objectId="element.attributes.orderable.id"
|
:objectId="element.attributes.orderable.id"
|
||||||
|
|
|
@ -6,12 +6,16 @@ class StepTextSerializer < ActiveModel::Serializer
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include ActionView::Helpers::TextHelper
|
include ActionView::Helpers::TextHelper
|
||||||
|
|
||||||
attributes :id, :text, :urls, :text_view, :updated_at, :icon, :name
|
attributes :id, :text, :urls, :text_view, :updated_at, :icon, :name, :placeholder
|
||||||
|
|
||||||
def updated_at
|
def updated_at
|
||||||
object.updated_at.to_i
|
object.updated_at.to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def placeholder
|
||||||
|
I18n.t('protocols.steps.text.placeholder')
|
||||||
|
end
|
||||||
|
|
||||||
def text_view
|
def text_view
|
||||||
@user = scope[:user]
|
@user = scope[:user]
|
||||||
custom_auto_link(object.tinymce_render('text'),
|
custom_auto_link(object.tinymce_render('text'),
|
||||||
|
|
|
@ -2540,7 +2540,7 @@ en:
|
||||||
uncomplete: "Unmark as done"
|
uncomplete: "Unmark as done"
|
||||||
options_dropdown:
|
options_dropdown:
|
||||||
title: 'Step options'
|
title: 'Step options'
|
||||||
rearrange: 'Rearrange step content'
|
rearrange: 'Rearrange content'
|
||||||
delete: 'Delete'
|
delete: 'Delete'
|
||||||
insert:
|
insert:
|
||||||
button: 'Insert'
|
button: 'Insert'
|
||||||
|
@ -2574,7 +2574,7 @@ en:
|
||||||
description_2: 'Are you sure you want to delete them?'
|
description_2: 'Are you sure you want to delete them?'
|
||||||
confirm: 'Delete forever'
|
confirm: 'Delete forever'
|
||||||
reorder_elements:
|
reorder_elements:
|
||||||
title: 'Rearrange %{step_name} content'
|
title: 'Rearrange step %{step_position} content'
|
||||||
options:
|
options:
|
||||||
up_arrow_title: "Move step up"
|
up_arrow_title: "Move step up"
|
||||||
down_arrow_title: "Move step down"
|
down_arrow_title: "Move step down"
|
||||||
|
|
Loading…
Add table
Reference in a new issue