add additional descriptions
This commit is contained in:
parent
39623ff5a6
commit
c648ebd4fc
6 changed files with 69 additions and 3 deletions
|
@ -33,6 +33,7 @@ function initialState() {
|
|||
files: [],
|
||||
references: [],
|
||||
titles: [],
|
||||
descriptions: [],
|
||||
checkedContributors: [],
|
||||
checkedSubmitters: [],
|
||||
|
||||
|
|
|
@ -214,6 +214,13 @@ const app = new Vue({
|
|||
formData.append('titles[' + i + '][type]', title.type);
|
||||
}
|
||||
|
||||
for (var i = 0; i < this.dataset.descriptions.length; i++) {
|
||||
let description = this.dataset.descriptions[i];
|
||||
formData.append('descriptions[' + i + '][value]', description.value);
|
||||
formData.append('descriptions[' + i + '][language]', description.language);
|
||||
formData.append('descriptions[' + i + '][type]', description.type);
|
||||
}
|
||||
|
||||
/*
|
||||
Make the request to the POST /multiple-files URL
|
||||
*/
|
||||
|
@ -290,11 +297,22 @@ const app = new Vue({
|
|||
this.dataset.titles.push(newTitle);
|
||||
},
|
||||
/*
|
||||
Removes a selected reference
|
||||
Removes a selected title
|
||||
*/
|
||||
removeTitle(key) {
|
||||
this.dataset.titles.splice(key, 1);
|
||||
},
|
||||
addDescription() {
|
||||
let newTitle = { value: '', language: '', type: '' };
|
||||
//this.dataset.files.push(uploadedFiles[i]);
|
||||
this.dataset.descriptions.push(newTitle);
|
||||
},
|
||||
/*
|
||||
Removes a selected description
|
||||
*/
|
||||
removeDescription(key) {
|
||||
this.dataset.descriptions.splice(key, 1);
|
||||
},
|
||||
filesChange(fieldName, fileList) {
|
||||
this.fileCount = fileList.length
|
||||
// this.dataset.files = this.$refs.files.files;
|
||||
|
|
|
@ -107,7 +107,40 @@
|
|||
"v-validate" => "'required'", "data-vv-as" => "Abstract Language", 'data-vv-scope' => 'step-2']) !!}
|
||||
</div>
|
||||
</div>
|
||||
<div class="pure-u-1 pure-u-md-1-2 pure-div">
|
||||
{!! Form::label('AddtionalDescription', 'Add additional descriptions(s) ') !!}
|
||||
<button class="pure-button button-small" @click.prevent="addDescription()">+</button>
|
||||
</div>
|
||||
</div>
|
||||
<table class="pure-table pure-table-horizontal" v-if="dataset.descriptions.length">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 20px;">Description</th>
|
||||
<th>Type</th>
|
||||
<th>Language</th>
|
||||
<th style="width: 130px;"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item, index) in dataset.descriptions">
|
||||
<td>
|
||||
<input name="Description[Value]" class="form-control" placeholder="[DESCRIPTION]" v-model="item.value" v-validate="'required'" data-vv-scope="step-1" />
|
||||
</td>
|
||||
<td>
|
||||
{!! Form::select('Description[Type]', $descriptionTypes, null,
|
||||
['placeholder' => '[descriptionType]', 'v-model' => 'item.type', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
|
||||
</td>
|
||||
<td>
|
||||
{!! Form::select('Description[Language]', $languages, null,
|
||||
['placeholder' => '[language]', 'v-model' => 'item.language', "v-validate" => "'required'", 'data-vv-scope' => 'step-1']) !!}
|
||||
</td>
|
||||
<td>
|
||||
<button class="pure-button button-small is-warning" @click.prevent="removeDescription(index)">-</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="fieldset-creator">
|
||||
|
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue