Merge branch 'develop' of https://github.com/tainacan/tainacan into develop

This commit is contained in:
weryques 2018-05-02 14:11:25 -03:00
commit 14b51ed6f8
9 changed files with 684 additions and 647 deletions

View File

@ -1,11 +1,14 @@
<template>
<div
class="page-container"
:class="{'primary-page' : isNewCollection }">
<b-tag
v-if="collection != null && collection != undefined"
:type="'is-' + getStatusColor(collection.status)"
v-text="collection.status"/>
<div :class="{'primary-page' : isNewCollection }">
<div class="tainacan-page-title">
<h2>{{ $i18n.get('title_collection_edition') }}</h2>
<a
@click="$router.go(-1)"
class="back-link is-secondary">
{{ $i18n.get('return') }}
</a>
<hr>
</div>
<form
v-if="collection != null && collection != undefined"
class="tainacan-form"
@ -60,11 +63,11 @@
</a>
<figure class="image is-128x128">
<span
v-if="collection.header_image === undefined || collection.header_image === false"
v-if="collection.header_image == undefined || collection.header_image == false"
class="image-placeholder">{{ $i18n.get('label_empty_header_image') }}</span>
<img
:alt="$i18n.get('label_thumbnail')"
:src="(collection.header_image === undefined || collection.header_image === false) ? headerPlaceholderPath : collection.header_image">
:src="(collection.header_image == undefined || collection.header_image == false) ? headerPlaceholderPath : collection.header_image">
</figure>
<div class="thumbnail-buttons-row">
<a
@ -82,8 +85,8 @@
<b-field
:addons="false"
:label="$i18n.get('label_name')"
:type="editFormErrors['name'] !== undefined ? 'is-danger' : ''"
:message="editFormErrors['name'] !== undefined ? editFormErrors['name'] : ''">
:type="editFormErrors['name'] != undefined ? 'is-danger' : ''"
:message="editFormErrors['name'] != undefined ? editFormErrors['name'] : ''">
<help-button
:title="$i18n.getHelperTitle('collections', 'name')"
:message="$i18n.getHelperMessage('collections', 'name')"/>
@ -97,8 +100,8 @@
<b-field
:addons="false"
:label="$i18n.get('label_description')"
:type="editFormErrors['description'] !== undefined ? 'is-danger' : ''"
:message="editFormErrors['description'] !== undefined ? editFormErrors['description'] : ''">
:type="editFormErrors['description'] != undefined ? 'is-danger' : ''"
:message="editFormErrors['description'] != undefined ? editFormErrors['description'] : ''">
<help-button
:title="$i18n.getHelperTitle('collections', 'description')"
:message="$i18n.getHelperMessage('collections', 'description')"/>
@ -113,8 +116,8 @@
<b-field
:addons="false"
:label="$i18n.get('label_status')"
:type="editFormErrors['status'] !== undefined ? 'is-danger' : ''"
:message="editFormErrors['status'] !== undefined ? editFormErrors['status'] : ''">
:type="editFormErrors['status'] != undefined ? 'is-danger' : ''"
:message="editFormErrors['status'] != undefined ? editFormErrors['status'] : ''">
<help-button
:title="$i18n.getHelperTitle('collections', 'status')"
:message="$i18n.getHelperMessage('collections', 'status')"/>
@ -164,7 +167,7 @@
v-model="coverPageTitle"
@select="onSelectCoverPage($event)"
:loading="isFetchingPages"
@input="fetchCoverPages($event)"
@input="fecthCoverPages($event)"
@focus="clearErrors('cover_page_id')"
v-if="coverPage == undefined || coverPage.title == undefined">
<template slot-scope="props">
@ -197,8 +200,8 @@
<b-field
:addons="false"
:label="$i18n.get('label_moderators')"
:type="editFormErrors['moderators'] !== undefined ? 'is-danger' : ''"
:message="editFormErrors['moderators'] !== undefined ? editFormErrors['moderators'] : ''">
:type="editFormErrors['moderators'] != undefined ? 'is-danger' : ''"
:message="editFormErrors['moderators'] != undefined ? editFormErrors['moderators'] : ''">
<help-button
:title="$i18n.getHelperTitle('collections', 'moderators_ids')"
:message="$i18n.getHelperMessage('collections', 'moderators_ids')"/>
@ -208,7 +211,7 @@
:data="users"
@select="onAddModerator($event)"
:loading="isFetchingModerators"
@input="fetchModerators($event)"
@input="fecthModerators($event)"
@focus="clearErrors('moderators')">
<template slot-scope="props">
{{ props.option.name }}
@ -217,7 +220,7 @@
</b-autocomplete>
<ul
class="moderators-list"
v-if="moderators !== undefined && moderators.length > 0">
v-if="moderators != undefined && moderators.length > 0">
<li
:key="index"
v-for="(moderator, index) of moderators">
@ -240,8 +243,8 @@
<b-field
:addons="false"
:label="$i18n.get('label_slug')"
:type="editFormErrors['slug'] !== undefined ? 'is-danger' : ''"
:message="editFormErrors['slug'] !== undefined ? editFormErrors['slug'] : ''">
:type="editFormErrors['slug'] != undefined ? 'is-danger' : ''"
:message="editFormErrors['slug'] != undefined ? editFormErrors['slug'] : ''">
<help-button
:title="$i18n.getHelperTitle('collections', 'slug')"
:message="$i18n.getHelperMessage('collections', 'slug')"/>
@ -255,8 +258,8 @@
<b-field
:addons="false"
:label="$i18n.get('label_parent_collection')"
:type="editFormErrors['parent'] !== undefined ? 'is-danger' : ''"
:message="editFormErrors['parent'] !== undefined ? editFormErrors['parent'] : ''">
:type="editFormErrors['parent'] != undefined ? 'is-danger' : ''"
:message="editFormErrors['parent'] != undefined ? editFormErrors['parent'] : ''">
<help-button
:title="$i18n.getHelperTitle('collections', 'parent')"
:message="$i18n.getHelperMessage('collections', 'parent')"/>
@ -268,7 +271,7 @@
:placeholder="$i18n.get('instruction_select_a_parent_collection')">
<option value="0">{{ $i18n.get('label_no_parent_collection') }}</option>
<option
v-if="collection.id !== anotherCollection.id"
v-if="collection.id != anotherCollection.id"
v-for="anotherCollection of collections"
:key="anotherCollection.id"
:value="anotherCollection.id">{{ anotherCollection.name }}
@ -286,15 +289,13 @@
id="button-cancel-collection-creation"
class="button is-outlined"
type="button"
@click="cancelBack">{{ $i18n.get('cancel') }}
</button>
@click="cancelBack">{{ $i18n.get('cancel') }}</button>
</div>
<div class="control">
<button
id="button-submit-collection-creation"
@click.prevent="onSubmit"
class="button is-success">{{ $i18n.get('save') }}
</button>
class="button is-success">{{ $i18n.get('save') }}</button>
</div>
</div>
<p class="help is-danger">{{ formErrorMessage }}</p>
@ -425,20 +426,6 @@
this.isLoading = false;
});
},
getStatusColor(status) {
switch (status) {
case 'publish':
return 'success'
case 'draft':
return 'info'
case 'private':
return 'warning'
case 'trash':
return 'danger'
default:
return 'info'
}
},
createNewCollection() {
// Puts loading on Draft Collection creation
this.isLoading = true;
@ -488,7 +475,7 @@
cancelBack(){
this.$router.push(this.$routerHelper.getCollectionsPath());
},
fetchCoverPages(search) {
fecthCoverPages(search) {
this.isFetchingPages = true;
this.fetchPages(search)
.then((pages) => {
@ -506,7 +493,7 @@
this.coverPageTitle = this.coverPage.title.rendered;
this.coverPageEditPath = tainacan_plugin.admin_url + '/post.php?post=' + selectedPage.id + '&action=edit';
},
fetchModerators(search) {
fecthModerators(search) {
this.isFetchingModerators = true;
let exceptions = [];
@ -592,10 +579,10 @@
},
created(){
if (this.$route.fullPath.split("/").pop() === "new") {
if (this.$route.fullPath.split("/").pop() == "new") {
this.createNewCollection();
this.isNewCollection = true;
} else if (this.$route.fullPath.split("/").pop() === "edit") {
} else if (this.$route.fullPath.split("/").pop() == "edit") {
this.isLoading = true;
@ -621,7 +608,7 @@
this.moderators = JSON.parse(JSON.stringify(this.collection.moderators));
// Generates CoverPage from current cover_page_id info
if (this.form.cover_page_id !== undefined && this.form.cover_page_id !== '') {
if (this.form.cover_page_id != undefined && this.form.cover_page_id != '') {
this.isFetchingPages = true;
@ -717,21 +704,17 @@
}
}
}
.selected-cover-page {
background-color: $tainacan-input-color;
padding: 8px;
font-size: .85rem;
.span {
vertical-align: middle;
}
.span { vertical-align: middle;}
.selected-cover-page-control {
float: right;
}
}
.moderators-list {
padding: 10px;
display: flex;
@ -740,7 +723,6 @@
margin-right: 5px;
}
}
.moderators-empty-list {
color: gray;
font-size: 0.85rem;

View File

@ -1,5 +1,5 @@
<template>
<div class="page-container">
<div>
<div class="tainacan-page-title">
<h2>{{ $i18n.get('title_item_edition') }}</h2>
<a
@ -15,8 +15,50 @@
label-width="120px">
<div class="columns">
<div class="column is-4">
<!-- Status -------------------------------- -->
<label class="section-label">{{ $i18n.get('label_status') }}</label>
<span class="required-field-asterisk">*</span>
<help-button
:title="$i18n.getHelperTitle('items', 'status')"
:message="$i18n.getHelperMessage('items', 'status')"/>
<div class="document-box">
<div class="field">
<b-select
v-model="form.status"
:placeholder="$i18n.get('instruction_select_a_status')">
<option
:id="`status-option-${statusOption.value}`"
v-for="statusOption in statusOptions"
:key="statusOption.value"
:value="statusOption.value"
:disabled="statusOption.disabled">{{ statusOption.label }}
</option>
</b-select>
<p
v-if="item.status == 'auto-draft'"
class="help is-danger">
{{ $i18n.get('info_item_not_saved') }}
</p>
</div>
<div class="field is-grouped">
<div class="control">
<button
id="button-submit-item-creation"
@click.prevent="onSubmit"
class="button is-success">
{{ $i18n.get('save') }}
</button>
</div>
</div>
<p class="help is-danger">{{ formErrorMessage }}</p>
</div>
<!-- Document -------------------------------- -->
<label class="section-label">{{ form.document != undefined && form.document != null && form.document != '' ? $i18n.get('label_document') : $i18n.get('label_document_empty') }}</label>
<help-button
:title="$i18n.getHelperTitle('items', 'document')"
:message="$i18n.getHelperMessage('items', 'document')"/>
<div class="document-box">
<div
v-if="form.document != undefined && form.document != null &&
@ -160,6 +202,9 @@
<!-- Thumbnail -------------------------------- -->
<label class="section-label">{{ $i18n.get('label_thumbnail') }}</label>
<help-button
:title="$i18n.getHelperTitle('items', 'featured_img_id')"
:message="$i18n.getHelperMessage('items', 'featured_img_id')"/>
<div class="document-box">
<div class="thumbnail-field">
<a
@ -223,54 +268,15 @@
:icon=" collapseAll ? 'menu-down' : 'menu-right'" />
</a>
<!-- Status -------------------------------- -->
<b-field
:addons="false"
:label="$i18n.get('label_status')">
<help-button
:title="$i18n.getHelperTitle('items', 'status')"
:message="$i18n.getHelperMessage('items', 'status')"/>
<b-select
id="status-select"
v-model="form.status"
:placeholder="$i18n.get('instruction_select_a_status')">
<option
:id="`status-option-${statusOption.value}`"
v-for="statusOption in statusOptions"
:key="statusOption.value"
:value="statusOption.value"
:disabled="statusOption.disabled">{{ statusOption.label }}
</option>
</b-select>
</b-field>
<!-- Fields from Collection-------------------------------- -->
<tainacan-form-item
v-for="(field, index) in fieldList"
v-for="(field, index) of fieldList"
:key="index"
:field="field"
:is-collapsed="!fieldCollapses[index]" />
</div>
</div>
<div class="field is-grouped form-submit">
<div class="control">
<button
id="button-cancel-item-creation"
class="button is-outlined"
type="button"
@click="cancelBack">{{ $i18n.get('cancel') }}</button>
</div>
<div class="control">
<button
id="button-submit-item-creation"
@click.prevent="onSubmit"
class="button is-success"
>{{ $i18n.get('save') }}</button>
</div>
</div>
<p class="help is-danger">{{ formErrorMessage }}</p>
</form>
<b-loading
@ -341,7 +347,6 @@ export default {
]),
...mapGetters('item',[
'getFields',
'getItem',
'getAttachments'
]),
onSubmit() {
@ -443,9 +448,6 @@ export default {
this.form.document = '';
this.updateItemDocument({ item_id: this.itemId, document: this.form.document, document_type: this.form.document_type });
},
cancelBack(){
this.$router.push(this.$routerHelper.getCollectionPath(this.collectionId));
},
deleteThumbnail() {
this.updateThumbnail({itemId: this.itemId, thumbnailId: 0})
.then(() => {
@ -512,7 +514,7 @@ export default {
},
computed: {
fieldList() {
return this.getFields();
return JSON.parse(JSON.stringify(this.getFields()));
},
attachmentsList(){
return this.getAttachments();

View File

@ -1,6 +1,7 @@
<template>
<div>
<tainacan-filter-item
v-show="!isMenuCompressed"
:query="getQuery"
v-for="(filter, index) in filters"
:key="index"

View File

@ -2,7 +2,14 @@
<div :class="{'primary-page': isRepositoryLevel, 'page-container': isRepositoryLevel, 'page-container-small' :!isRepositoryLevel }">
<!-- SEARCH AND FILTERS --------------------- -->
<aside class="filters-menu">
<button
id="filter-menu-compress-button"
@click="isFiltersMenuCompressed = !isFiltersMenuCompressed">
<b-icon :icon="isFiltersMenuCompressed ? 'menu-right' : 'menu-left'" />
</button>
<aside
v-show="!isFiltersMenuCompressed"
class="filters-menu">
<b-loading
:is-full-page="false"
:active.sync="isLoadingFilters"/>
@ -31,7 +38,9 @@
</section>
</aside>
<div class="to-right">
<div
class="items-list-area"
:class="{ 'spaced-to-right': !isFiltersMenuCompressed }">
<!-- SEARCH CONTROL ------------------------- -->
<div class="sub-header">
<b-loading
@ -102,7 +111,8 @@
isLoadingItems: false,
isLoadingFilters: false,
isLoadingFields: false,
hasFiltered: false
hasFiltered: false,
isFiltersMenuCompressed: false
}
},
props: {
@ -293,6 +303,9 @@
height: 100%;
max-height: 100%;
overflow-y: auto;
visibility: visible;
display: block;
transition: visibility 0.5s ease, display 0.5s ease;
.label {
font-size: 12px;
@ -301,7 +314,11 @@
}
.to-right{
.items-list-area {
margin-left: 0;
transition: margin-left 0.5s ease;
}
.spaced-to-right {
margin-left: $filter-menu-width;
}
@ -320,6 +337,26 @@
}
}
#filter-menu-compress-button {
position: absolute;
z-index: 9;
top: 152px;
left: 0px;
max-width: 23px;
height: 21px;
width: 23px;
border: none;
background-color: $primary-light;
color: $tertiary;
padding: 0px;
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
.icon {
margin-top: -1px;
}
}
</style>

View File

@ -4,7 +4,7 @@
<tainacan-subheader :id="collectionId"/>
<router-view
:collection-id="collectionId"
class="page-container"/>
class="page-container page-container-small"/>
</section>
</div>
</template>

View File

@ -64,15 +64,18 @@ html {
}
}
.page-container-small{
padding: $page-small-top-padding $page-small-side-padding;
height: calc(100% - 82px);
overflow-y: auto;
}
.page-container-narrow{
padding: $page-small-top-padding $page-small-side-padding;
@media screen and (max-width: 769px) {
padding: $page-mobile-top-padding $page-mobile-side-padding;
}
}
.tainacan-page-title, .tainacan-modal-title {
h1, h2 {
font-size: 20px;
@ -140,6 +143,9 @@ html {
.button.is-outlined {
color: $tertiary;
}
&.has-only-save {
justify-content: end !important;
}
}
.label {
font-weight: normal;
@ -377,6 +383,9 @@ html {
.wp-core-ui {
a:focus{ box-shadow: none; }
}
.media-modal-backdrop {
z-index: 9999999 !important;
}
.media-modal {
left: 100px;
top: 100px;
@ -384,122 +393,127 @@ html {
right: 100px;
background-color: white;
z-index: 99999999999 !important;
}
// .media-modal {
// left: 100px;
// top: 100px;
// bottom: 100px;
// right: 100px;
// background-color: white;
// z-index: 99999999999 !important;
.media-modal-content {
background-color: white;
margin: 42px 60px;
box-shadow: none;
}
// .media-modal-content {
// background-color: white;
// margin: 42px 60px;
// box-shadow: none;
// }
.media-frame-title {
border-bottom: 1px solid #298596 !important;
margin-bottom: 60px !important;
box-shadow: none !important;
// .media-frame-title {
// border-bottom: 1px solid #298596 !important;
// margin-bottom: 60px !important;
// box-shadow: none !important;
h1, h2 {
font-size: 20px;
font-weight: 500;
color: $tertiary;
display: inline-block;
margin-bottom: 3px;
}
}
// h1, h2 {
// font-size: 20px;
// font-weight: 500;
// color: $tertiary;
// display: inline-block;
// margin-bottom: 3px;
// }
// }
.media-frame-router {
margin-top: 28px;
a.media-menu-item.active {
border-top: none;
border-left: none;
border-right: none;
border-bottom: 3px solid $primary;
}
}
// .media-frame-router {
// margin-top: 28px;
// a.media-menu-item.active {
// border-top: none;
// border-left: none;
// border-right: none;
// border-bottom: 3px solid $primary;
// }
// }
.media-frame-content {
margin-top: 30px;
// .media-frame-content {
// margin-top: 30px;
.attachments-browser .attachments, .media-toolbar {
padding: 12px;
right: 270px;
// .attachments-browser .attachments, .media-toolbar {
// padding: 12px;
// right: 270px;
.media-toolbar-primary {
max-width: 30%;
}
.media-toolbar-secondary {
max-width: 70%;
}
.attachment {
padding: 12px;
}
.attachment.details {
box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 14px $primary-light;
}
.attachment.details .check, .wp-core-ui .attachment.selected .check:focus, .wp-core-ui .media-frame.mode-grid .attachment.selected .check {
background-color: $primary-light;
box-shadow: 0 0 0 1px #fff,0 0 0 2px $primary-light;
}
}
.media-sidebar {
background-color: white;
width: 238px;
}
// .media-toolbar-primary {
// max-width: 30%;
// }
// .media-toolbar-secondary {
// max-width: 70%;
// }
// .attachment {
// padding: 12px;
// }
// .attachment.details {
// box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 14px $primary-light;
// }
// .attachment.details .check, .wp-core-ui .attachment.selected .check:focus, .wp-core-ui .media-frame.mode-grid .attachment.selected .check {
// background-color: $primary-light;
// box-shadow: 0 0 0 1px #fff,0 0 0 2px $primary-light;
// }
// }
// .media-sidebar {
// background-color: white;
// width: 238px;
// }
.crop-content{
.imgareaselect-outer {
background-color: white;
opacity: 0.6;
}
}
}
// .crop-content{
// .imgareaselect-outer {
// background-color: white;
// opacity: 0.6;
// }
// }
// }
.media-frame-toolbar .media-toolbar {
bottom: initial;
margin-top: -1px;
padding: 28px 0px;
}
// .media-frame-toolbar .media-toolbar {
// bottom: initial;
// margin-top: -1px;
// padding: 28px 0px;
// }
.media-button.button-primary {
background-color: $success;
border: none;
box-shadow: none;
color: #fff;
text-decoration: none;
text-shadow: none;
}
.media-button.button-primary[disabled] {
color: #66c6e4 !important;
background: $success !important;
border-color: none!important;
box-shadow: none !important;
text-shadow: none !important;
cursor: default;
}
.media-button.button-secondary {
color: $tertiary;
border-color: #999;
background: white;
box-shadow: none;
vertical-align: middle;
}
.button-hero {
background-color: $secondary;
border: none;
box-shadow: none;
color: #fff;
text-decoration: none;
text-shadow: none;
font-size: 14px;
height: 46px;
line-height: 20px !important;
padding: 0 36px;
// .media-button.button-primary {
// background-color: $success;
// border: none;
// box-shadow: none;
// color: #fff;
// text-decoration: none;
// text-shadow: none;
// }
// .media-button.button-primary[disabled] {
// color: #66c6e4 !important;
// background: $success !important;
// border-color: none!important;
// box-shadow: none !important;
// text-shadow: none !important;
// cursor: default;
// }
// .media-button.button-secondary {
// color: $tertiary;
// border-color: #999;
// background: white;
// box-shadow: none;
// vertical-align: middle;
// }
// .button-hero {
// background-color: $secondary;
// border: none;
// box-shadow: none;
// color: #fff;
// text-decoration: none;
// text-shadow: none;
// font-size: 14px;
// height: 46px;
// line-height: 20px !important;
// padding: 0 36px;
&:hover{
background-color: #339daf;
color: white;
}
}
// &:hover{
// background-color: #339daf;
// color: white;
// }
// }
}
.media-modal-backdrop {
z-index: 9999999 !important;
}
// }

View File

@ -200,6 +200,7 @@ return [
'info_no_page_found' => __( 'No page was found with this name.', 'tainacan' ),
'info_no_user_found' => __( 'No user was found with this name.', 'tainacan' ),
'info_no_item_found' => __( 'No item was found here with these filters.', 'tainacan' ),
'info_item_not_saved' => __( 'Warning: Item not saved.', 'tainacan' ),
'info_no_moderator_on_collection' => __( "This collection doesn't have any moderator yet.", 'tainacan' ),
'info_error_deleting_collection' => __( 'Error on deleting collection.', 'tainacan' ),
'info_error_deleting_category' => __( 'Error on deleting category', 'tainacan' ),

View File

@ -97,7 +97,7 @@ export const deleteField = ({commit}, {collectionId, fieldId, isRepositoryLevel}
});
};
export const updateCollectionFieldsOrder = ({commit, dispatch}, {collectionId, fieldsOrder}) => {
export const updateCollectionFieldsOrder = ({ dispatch }, {collectionId, fieldsOrder}) => {
return new Promise((resolve, reject) => {
axios.tainacan.patch('/collections/' + collectionId, {
fields_order: fieldsOrder

View File

@ -89,7 +89,7 @@ export const sendItem = ( { commit }, { collection_id, status }) => {
status: status
})
.then( res => {
commit('setItem', { collection_id: collection_id, status: status });
commit('setItem', res.data);
resolve( res.data );
})
.catch(error => {