Adds arrow icon for creating filter from field in FiltersPage. Adds thumbnail to ItemsList.

This commit is contained in:
mateuswetah 2018-03-15 16:17:21 -03:00
parent 9584059945
commit fedae7fb4e
4 changed files with 18 additions and 14 deletions

View File

@ -16,12 +16,10 @@
backend-sorting>
<template slot-scope="props">
<b-table-column tabindex="0" label="Imagem" :aria-label="$i18n.get('label_image')" field="featured_image" width="55">
<!-- <router-link class="" tag="span" > -->
<b-table-column tabindex="0" label="$i18n.get('label_thumbnail')" :aria-label="$i18n.get('label_thumbnail')" field="featured_image" width="55">
<template v-if="props.row.featured_image" slot-scope="scope">
<router-link tag="img" :to="{path: $routerHelper.getCollectionPath(props.row.id)}" class="table-thumb clickable-row" :src="`${props.row.featured_image}`"></router-link>
</template>
<!-- </router-link> -->
</b-table-column>
<b-table-column tabindex="0" :label="$i18n.get('label_name')" :aria-label="$i18n.get('label_name')" field="props.row.name">

View File

@ -76,12 +76,16 @@
<div class="columns box available-fields-area" >
<draggable class="column" :list="availableFieldList" :options="{ sort: false, group: { name:'filters', pull: true, put: false, revertClone: true }}">
<div class="available-field-item" v-if="index % 2 == 0" v-for="(field, index) in availableFieldList" :key="index">
{{ field.name }} <b-icon type="is-gray" class="is-pulled-left" icon="drag"></b-icon>
<a @click.prevent="addFieldViaButton(field)">
<b-icon type="is-gray" class="is-pulled-left" icon="arrow-left-bold"></b-icon>
</a> {{ field.name }} <b-icon type="is-gray" class="is-pulled-left" icon="drag"></b-icon>
</div>
</draggable>
<draggable class="column" :list="availableFieldList" :options="{ sort: false, group: { name:'filters', pull: true, put: false, revertClone: true }}">
<div class="available-field-item" v-if="index % 2 != 0" v-for="(field, index) in availableFieldList" :key="index">
{{ field.name }} <b-icon type="is-gray" class="is-pulled-left" icon="drag"></b-icon>
<a @click.prevent="addFieldViaButton(field)">
<b-icon type="is-gray" class="is-pulled-left" icon="arrow-left-bold"></b-icon>
</a> {{ field.name }} <b-icon type="is-gray" class="is-pulled-left" icon="drag"></b-icon>
</div>
</draggable>
</div>
@ -162,6 +166,11 @@ export default {
this.updateCollectionFiltersOrder({ collectionId: this.collectionId, filtersOrder: filtersOrder });
},
addFieldViaButton(field) {
let lastIndex = this.activeFilterList.length;
this.activeFilterList.push(field);
this.addNewFilter(field, lastIndex);
},
addNewFilter(choosenField, newIndex) {
this.choosenField = choosenField;
this.newIndex = newIndex;

View File

@ -28,12 +28,10 @@
</template>
</router-link>
<router-link tag="span" class="clickable-row" :to="{path: $routerHelper.getItemPath(collectionId, props.row.id)}">
<template v-if="column.field == 'featured_image'">
<img class="table-thumb" :src="`${ props.row[column.slug] }`"/>
</template>
</router-link>
<template v-if="column.field == 'featured_image'">
<router-link tag="img" class="table-thumb clickable-row" :to="{path: $routerHelper.getItemPath(collectionId, props.row.id)}" :src="props.row[column.slug]"></router-link>
</template>
<template v-if="column.field == 'row_actions'">
<!-- <a id="button-view" @click.prevent.stop="goToItemPage(props.row.id)"><b-icon icon="eye"></a> -->
<a id="button-edit" :aria-label="$i18n.getFrom('items','edit_item')" @click="goToItemEditPage(props.row.id)"><b-icon icon="pencil"></a>

View File

@ -135,8 +135,6 @@ export default {
let prevValue = this.prefTableFields;
let index = this.prefTableFields.findIndex(alteredField => alteredField.slug === field.slug);
if (index >= 0) {
console.log(prevValue[index].visible);
console.log(this.prefTableFields[index].visible);
//prevValue[index].visible = this.prefTableFields[index].visible ? false : true;
}
@ -223,13 +221,14 @@ export default {
this.loadItems();
this.fetchFields({ collectionId: this.collectionId, isRepositoryLevel: false }).then((res) => {
let rawFields = res;
this.tableFields.push({ label: this.$i18n.get('label_thumbnail'), field: 'featured_image', slug: 'featured_image', visible: true });
for (let field of rawFields) {
this.tableFields.push(
{ label: field.name, field: field.description, slug: field.slug, visible: true }
);
}
this.tableFields.push({ label: this.$i18n.get('label_actions'), field: 'row_actions', slug: 'actions', visible: true });
this.prefTableFields = this.tableFields;
// this.$userPrefs.get('table_columns_' + this.collectionId)
// .then((value) => {