mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-10-11 22:36:33 +08:00
Add empty block for form builder and set correct order on loading of form fields [SCI-11422]
This commit is contained in:
parent
c4b3654544
commit
aa1d8fbd71
3 changed files with 7 additions and 2 deletions
|
@ -89,6 +89,10 @@
|
||||||
@update="updateField"
|
@update="updateField"
|
||||||
@delete="deleteField"
|
@delete="deleteField"
|
||||||
/>
|
/>
|
||||||
|
<div v-if="!activeField.id"
|
||||||
|
class="text-xl font-semibold text-sn-grey font-inter flex items-center justify-center w-full h-full">
|
||||||
|
{{ i18n.t('forms.show.no_block') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -216,7 +220,7 @@ export default {
|
||||||
axios.delete(field.attributes.urls.show).then(() => {
|
axios.delete(field.attributes.urls.show).then(() => {
|
||||||
this.fields.splice(index, 1);
|
this.fields.splice(index, 1);
|
||||||
if (this.fields.length > 0) {
|
if (this.fields.length > 0) {
|
||||||
[this.activeField] = this.fields;
|
this.activeField = this.fields[index - 1];
|
||||||
} else {
|
} else {
|
||||||
this.activeField = {};
|
this.activeField = {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ class Form < ApplicationRecord
|
||||||
belongs_to :restored_by, class_name: 'User', optional: true
|
belongs_to :restored_by, class_name: 'User', optional: true
|
||||||
belongs_to :default_public_user_role, class_name: 'UserRole', optional: true
|
belongs_to :default_public_user_role, class_name: 'UserRole', optional: true
|
||||||
|
|
||||||
has_many :form_fields, inverse_of: :form, dependent: :destroy
|
has_many :form_fields, -> { order(:position) }, inverse_of: :form, dependent: :destroy
|
||||||
has_many :form_responses, dependent: :destroy
|
has_many :form_responses, dependent: :destroy
|
||||||
has_many :users, through: :user_assignments
|
has_many :users, through: :user_assignments
|
||||||
|
|
||||||
|
|
|
@ -1126,6 +1126,7 @@ en:
|
||||||
unit_placeholder: 'Add a unit'
|
unit_placeholder: 'Add a unit'
|
||||||
time_label: 'Include time'
|
time_label: 'Include time'
|
||||||
range_label: 'Include range'
|
range_label: 'Include range'
|
||||||
|
no_block: 'Add your first form block'
|
||||||
validations:
|
validations:
|
||||||
response_validation:
|
response_validation:
|
||||||
title: 'Response validation'
|
title: 'Response validation'
|
||||||
|
|
Loading…
Add table
Reference in a new issue