1.1 Renaming of events by activities on back-end and front-end (#147)

This commit is contained in:
weryques 2018-11-13 10:29:36 -02:00
parent f882710650
commit 7695bcc1bf
19 changed files with 353 additions and 353 deletions

View File

@ -6,15 +6,15 @@
<tr> <tr>
<!-- Title --> <!-- Title -->
<th> <th>
<div class="th-wrap">{{ $i18n.get('label_event_title') }}</div> <div class="th-wrap">{{ $i18n.get('label_activity_title') }}</div>
</th> </th>
<!-- Created by --> <!-- Created by -->
<th> <th>
<div class="th-wrap">{{ $i18n.get('label_created_by') }}</div> <div class="th-wrap">{{ $i18n.get('label_created_by') }}</div>
</th> </th>
<!-- Event date --> <!-- Activity date -->
<th> <th>
<div class="th-wrap">{{ $i18n.get('label_event_date') }}</div> <div class="th-wrap">{{ $i18n.get('label_activity_date') }}</div>
</th> </th>
<!-- Status --> <!-- Status -->
<!--<th>--> <!--<th>-->
@ -25,72 +25,72 @@
<tbody> <tbody>
<tr <tr
:key="index" :key="index"
v-for="(event, index) of events"> v-for="(activity, index) of activities">
<!-- Name --> <!-- Name -->
<td <td
class="column-default-width column-main-content" class="column-default-width column-main-content"
@click="goToEventPage(event.id)" @click="goToActivityPage(activity.id)"
:label="$i18n.get('label_event_title')" :label="$i18n.get('label_activity_title')"
:aria-label="$i18n.get('label_event_title') + ': ' + event.title"> :aria-label="$i18n.get('label_activity_title') + ': ' + activity.title">
<p <p
v-tooltip="{ v-tooltip="{
content: event.title, content: activity.title,
autoHide: false, autoHide: false,
placement: 'auto-start' placement: 'auto-start'
}">{{ event.title }}</p> }">{{ activity.title }}</p>
</td> </td>
<!-- User --> <!-- User -->
<td <td
class="table-creation column-small-width" class="table-creation column-small-width"
@click="goToEventPage(event.id)" @click="goToActivityPage(activity.id)"
:label="$i18n.get('label_created_by')" :label="$i18n.get('label_created_by')"
:aria-label="$i18n.get('label_created_by') + ': ' + event.user_name"> :aria-label="$i18n.get('label_created_by') + ': ' + activity.user_name">
<p <p
v-tooltip="{ v-tooltip="{
content: event.user_name, content: activity.user_name,
autoHide: false, autoHide: false,
placement: 'auto-start' placement: 'auto-start'
}" }"
v-html="event.user_name" /> v-html="activity.user_name" />
</td> </td>
<!-- Event Date --> <!-- Activity Date -->
<td <td
class="table-creation column-small-width" class="table-creation column-small-width"
@click="goToEventPage(event.id)" @click="goToActivityPage(activity.id)"
:label="$i18n.get('label_event_date')" :label="$i18n.get('label_activity_date')"
:aria-label="$i18n.get('label_event_date') + ': ' + event.log_date"> :aria-label="$i18n.get('label_activity_date') + ': ' + activity.log_date">
<p <p
v-tooltip="{ v-tooltip="{
content: event.log_date, content: activity.log_date,
autoHide: false, autoHide: false,
placement: 'auto-start' placement: 'auto-start'
}" }"
v-html="event.log_date" /> v-html="activity.log_date" />
</td> </td>
<!-- Status --> <!-- Status -->
<!--<td--> <!--<td-->
<!--@click="goToEventPage(event.id)"--> <!--@click="goToActivityPage(activity.id)"-->
<!--class="status-cell" --> <!--class="status-cell" -->
<!--:label="$i18n.get('label_status')" --> <!--:label="$i18n.get('label_status')" -->
<!--:aria-label="$i18n.get('label_status') + ': ' + event.status">--> <!--:aria-label="$i18n.get('label_status') + ': ' + activity.status">-->
<!--<p>--> <!--<p>-->
<!--<a--> <!--<a-->
<!--v-if="event.status === 'pending'"--> <!--v-if="activity.status === 'pending'"-->
<!--id="button-approve"--> <!--id="button-approve"-->
<!--:aria-label="$i18n.get('approve_item')"--> <!--:aria-label="$i18n.get('approve_item')"-->
<!--@click.prevent.stop="approveEvent(event.id)">--> <!--@click.prevent.stop="approveActivity(activity.id)">-->
<!--<b-icon--> <!--<b-icon-->
<!--icon="check" />--> <!--icon="check" />-->
<!--</a>--> <!--</a>-->
<!--<a--> <!--<a-->
<!--v-if="event.status === 'pending'"--> <!--v-if="activity.status === 'pending'"-->
<!--id="button-not-approve"--> <!--id="button-not-approve"-->
<!--class="delete"--> <!--class="delete"-->
<!--:aria-label="$i18n.get('not_approve_item')"--> <!--:aria-label="$i18n.get('not_approve_item')"-->
<!--@click.prevent.stop="notApproveEvent(event.id)" />--> <!--@click.prevent.stop="notApproveActivity(activity.id)" />-->
<!--<small v-if="event.status !== 'pending'">{{ $i18n.get('label_approved') }}</small>--> <!--<small v-if="activity.status !== 'pending'">{{ $i18n.get('label_approved') }}</small>-->
<!--</p>--> <!--</p>-->
<!--</td>--> <!--</td>-->
</tr> </tr>
@ -99,13 +99,13 @@
</div> </div>
<!-- Empty state image --> <!-- Empty state image -->
<div v-if="(totalEvents <= 0 || !totalEvents) && !isLoading"> <div v-if="(totalActivities <= 0 || !totalActivities) && !isLoading">
<section class="section"> <section class="section">
<div class="content has-text-grey has-text-centered"> <div class="content has-text-grey has-text-centered">
<p> <p>
<activities-icon /> <activities-icon />
</p> </p>
<p>{{ $i18n.get('info_no_events') }}</p> <p>{{ $i18n.get('info_no_activities') }}</p>
</div> </div>
</section> </section>
</div> </div>
@ -116,10 +116,10 @@
import ActivitiesIcon from '../other/activities-icon.vue'; import ActivitiesIcon from '../other/activities-icon.vue';
export default { export default {
name: 'EventsList', name: 'ActivitiesList',
data(){ data(){
return { return {
selectedEvents: [] selectedActivities: []
} }
}, },
components: { components: {
@ -127,27 +127,27 @@
}, },
props: { props: {
isLoading: false, isLoading: false,
totalEvents: 0, totalActivities: 0,
page: 1, page: 1,
eventsPerPage: 12, activitiesPerPage: 12,
events: Array activities: Array
}, },
methods: { methods: {
// ...mapActions('event', [ // ...mapActions('activity', [
// 'approve', // 'approve',
// 'notApprove' // 'notApprove'
// ]), // ]),
// approveEvent(eventId){ // approveActivity(activityId){
// this.approve(eventId); // this.approve(activityId);
// }, // },
// notApproveEvent(eventId){ // notApproveActivity(activityId){
// this.notApprove(eventId); // this.notApprove(activityId);
// }, // },
goToEventPage(eventId) { goToActivityPage(activityId) {
if (this.$route.params.collectionId == undefined) if (this.$route.params.collectionId == undefined)
this.$router.push(this.$routerHelper.getEventPath(eventId)); this.$router.push(this.$routerHelper.getActivityPath(activityId));
else else
this.$router.push(this.$routerHelper.getCollectionEventPath(this.$route.params.collectionId, eventId)); this.$router.push(this.$routerHelper.getCollectionActivityPath(this.$route.params.collectionId, activityId));
} }
} }
} }

View File

@ -66,9 +66,9 @@
<li> <li>
<router-link <router-link
tag="a" tag="a"
to="/events" to="/activities"
:class="activeRoute == 'EventsPage' ? 'is-active':''"> :class="activeRoute == 'ActivitiesPage' ? 'is-active':''">
<activities-icon /><span class="menu-text">{{ $i18n.get('events') }}</span> <activities-icon /><span class="menu-text">{{ $i18n.get('activities') }}</span>
</router-link> </router-link>
</li> </li>
<li> <li>

View File

@ -122,18 +122,18 @@
</router-link> </router-link>
</li> </li>
<li <li
:class="activeRoute == 'CollectionEventsPage' ? 'is-active':''" :class="activeRoute == 'CollectionActivitiesPage' ? 'is-active':''"
class="level-item"> class="level-item">
<router-link <router-link
tag="a" tag="a"
:to="{ path: $routerHelper.getCollectionEventsPath(id) }" :to="{ path: $routerHelper.getCollectionActivitiesPath(id) }"
:aria-label="$i18n.get('label_collection_events')"> :aria-label="$i18n.get('label_collection_activities')">
<b-tooltip <b-tooltip
:label="$i18n.get('events')" :label="$i18n.get('activities')"
position="is-bottom"> position="is-bottom">
<activities-icon /> <activities-icon />
</b-tooltip> </b-tooltip>
<!-- <span class="menu-text">{{ $i18n.get('events') }}</span> --> <!-- <span class="menu-text">{{ $i18n.get('activities') }}</span> -->
</router-link> </router-link>
</li> </li>

View File

@ -5,9 +5,9 @@
<div class="tile is-parent"> <div class="tile is-parent">
<article class="tile box is-child"> <article class="tile box is-child">
<div class="content"> <div class="content">
<h1 class="event-titles">{{ this.$i18n.get('info_logs_before') }}</h1> <h1 class="activity-titles">{{ this.$i18n.get('info_logs_before') }}</h1>
<div <div
v-for="(diff, key) in event.log_diffs" v-for="(diff, key) in activity.log_diffs"
v-if="diff.old" v-if="diff.old"
:key="key"> :key="key">
@ -88,9 +88,9 @@
<div class="tile is-parent"> <div class="tile is-parent">
<article class="tile box is-child"> <article class="tile box is-child">
<div class="content"> <div class="content">
<h1 class="event-titles">{{ this.$i18n.get('info_logs_after') }}</h1> <h1 class="activity-titles">{{ this.$i18n.get('info_logs_after') }}</h1>
<div <div
v-for="(diff, key) in event.log_diffs" v-for="(diff, key) in activity.log_diffs"
:key="key"> :key="key">
<p/> <p/>
@ -175,9 +175,9 @@
<script> <script>
export default { export default {
name: "EventSplit", name: "ActivitySplit",
props: { props: {
event: Object activity: Object
} }
} }
</script> </script>
@ -187,7 +187,7 @@
overflow: auto; overflow: auto;
} }
.event-titles { .activity-titles {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
color: #01295c; color: #01295c;

View File

@ -6,9 +6,9 @@
<article class="tile box is-child"> <article class="tile box is-child">
<div class="content"> <div class="content">
<h1 class="event-titles">{{ this.$i18n.get('info_changes') }}</h1> <h1 class="activity-titles">{{ this.$i18n.get('info_changes') }}</h1>
<div <div
v-for="(diff, key) in event.log_diffs" v-for="(diff, key) in activity.log_diffs"
v-if="diff.old" v-if="diff.old"
:key="key"> :key="key">
@ -87,7 +87,7 @@
<hr class="divider"> <hr class="divider">
<div <div
v-for="(diff, key) in event.log_diffs" v-for="(diff, key) in activity.log_diffs"
:key="key"> :key="key">
<p/> <p/>
@ -173,9 +173,9 @@
<script> <script>
export default { export default {
name: "EventUnified", name: "ActivityUnified",
props: { props: {
event: Object activity: Object
} }
} }
</script> </script>
@ -185,7 +185,7 @@
overflow: auto; overflow: auto;
} }
.event-titles { .activity-titles {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
color: #01295c; color: #01295c;

View File

@ -2,14 +2,14 @@
<div> <div>
<div <div
class="tile is-ancestor" class="tile is-ancestor"
v-if="event.log_diffs.constructor === Object && v-if="activity.log_diffs.constructor === Object &&
Object.keys(event.log_diffs).length > 0 || Object.keys(activity.log_diffs).length > 0 ||
event.log_diffs.length > 0"> activity.log_diffs.length > 0">
<div class="tile is-parent"> <div class="tile is-parent">
<article class="tile box is-child"> <article class="tile box is-child">
<div class="content"> <div class="content">
<div <div
v-for="(diff, key) in event.log_diffs" v-for="(diff, key) in activity.log_diffs"
:key="key"> :key="key">
<p/> <p/>
@ -80,9 +80,9 @@
<script> <script>
export default { export default {
name: "EventNoDiff", name: "ActivityNoDiff",
props: { props: {
event: Object activity: Object
} }
} }
</script> </script>

View File

@ -10,8 +10,8 @@ import ItemPage from '../pages/singles/item-page.vue'
import MetadataPage from '../pages/lists/metadata-page.vue' import MetadataPage from '../pages/lists/metadata-page.vue'
import FiltersPage from '../pages/lists/filters-page.vue' import FiltersPage from '../pages/lists/filters-page.vue'
import Page from '../pages/lists/taxonomies-page.vue' import Page from '../pages/lists/taxonomies-page.vue'
import EventsPage from '../pages/lists/events-page.vue' import ActivitiesPage from '../pages/lists/activities-page.vue'
import EventPage from '../pages/singles/event-page.vue' import ActivityPage from '../pages/singles/activity-page.vue'
import ExportPage from '../pages/singles/export-page.vue' import ExportPage from '../pages/singles/export-page.vue'
// Edition Form Components // Edition Form Components
@ -54,8 +54,8 @@ const routes = [
{ path: 'settings', component: CollectionEditionForm, name: 'CollectionEditionForm', meta: {title: i18nGet('title_collection_settings'), icon: 'folder-multiple'} }, { path: 'settings', component: CollectionEditionForm, name: 'CollectionEditionForm', meta: {title: i18nGet('title_collection_settings'), icon: 'folder-multiple'} },
{ path: 'metadata', component: MetadataList, name: 'MetadataList', meta: {title: i18nGet('title_collection_metadata_edition'), icon: 'folder-multiple'} }, { path: 'metadata', component: MetadataList, name: 'MetadataList', meta: {title: i18nGet('title_collection_metadata_edition'), icon: 'folder-multiple'} },
{ path: 'filters', component: FiltersList, name: 'FiltersList', meta: {title: i18nGet('title_collection_filters_edition'), icon: 'folder-multiple'} }, { path: 'filters', component: FiltersList, name: 'FiltersList', meta: {title: i18nGet('title_collection_filters_edition'), icon: 'folder-multiple'} },
{ path: 'events', component: EventsPage, name: 'CollectionEventsPage', meta: {title: i18nGet('title_collection_events'), icon: 'flash'} }, { path: 'activities', component: ActivitiesPage, name: 'CollectionActivitiesPage', meta: {title: i18nGet('title_collection_activities'), icon: 'flash'} },
{ path: 'events/:eventId', name: 'CollectionEventPage', component: EventPage, meta: {title: i18nGet('title_event_page'), icon: 'flash'} }, { path: 'activities/:activityId', name: 'CollectionActivityPage', component: ActivityPage, meta: {title: i18nGet('title_activity_page'), icon: 'flash'} },
{ path: 'sequence/:sequenceId', name: 'SavedSequenceEditionForm', component: ItemEditionForm, meta: {title: i18nGet('title_edit_item'), icon: 'folder-multiple'} }, { path: 'sequence/:sequenceId', name: 'SavedSequenceEditionForm', component: ItemEditionForm, meta: {title: i18nGet('title_edit_item'), icon: 'folder-multiple'} },
{ path: 'sequence/:sequenceId/:itemPosition', name: 'SequenceEditionForm', component: ItemEditionForm, meta: {title: i18nGet('title_edit_item'), icon: 'folder-multiple'} }, { path: 'sequence/:sequenceId/:itemPosition', name: 'SequenceEditionForm', component: ItemEditionForm, meta: {title: i18nGet('title_edit_item'), icon: 'folder-multiple'} },
] ]
@ -73,8 +73,8 @@ const routes = [
{ path: '/taxonomies/:taxonomyId/edit', name: 'TaxonomyEditionForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_taxonomy_edition_page'), icon: 'shape'} }, { path: '/taxonomies/:taxonomyId/edit', name: 'TaxonomyEditionForm', component: TaxonomyEditionForm, meta: {title: i18nGet('title_taxonomy_edition_page'), icon: 'shape'} },
{ path: '/taxonomies/:taxonomyId', redirect: '/taxonomies/:taxonomyId/edit' }, { path: '/taxonomies/:taxonomyId', redirect: '/taxonomies/:taxonomyId/edit' },
{ path: '/events', name: 'EventsPage', component: EventsPage, meta: {title: i18nGet('title_repository_events_page'), icon: 'flash'} }, { path: '/activities', name: 'ActivitiesPage', component: ActivitiesPage, meta: {title: i18nGet('title_repository_activities_page'), icon: 'flash'} },
{ path: '/events/:eventId', name: 'EventPage', component: EventPage, meta: {title: i18nGet('title_event_page'), icon: 'flash'} }, { path: '/activities/:activityId', name: 'ActivityPage', component: ActivityPage, meta: {title: i18nGet('title_activity_page'), icon: 'flash'} },
{ path: '/importers/', name: 'AvailableImportersPage', component: AvailableImportersPage, meta: {title: i18nGet('title_importers_page'), icon: 'import'} }, { path: '/importers/', name: 'AvailableImportersPage', component: AvailableImportersPage, meta: {title: i18nGet('title_importers_page'), icon: 'import'} },
{ path: '/importers/:importerSlug', name: 'ImporterEditionForm', component: ImporterEditionForm, meta: {title: i18nGet('title_importer_page'), icon: 'import'} }, { path: '/importers/:importerSlug', name: 'ImporterEditionForm', component: ImporterEditionForm, meta: {title: i18nGet('title_importer_page'), icon: 'import'} },

View File

@ -105,7 +105,7 @@ UserPrefsPlugin.install = function (Vue, options = {}) {
'items_per_page': 12, 'items_per_page': 12,
'collections_per_page': 12, 'collections_per_page': 12,
'taxonomies_per_page': 12, 'taxonomies_per_page': 12,
'events_per_page': 12, 'activities_per_page': 12,
'order': 'DESC', 'order': 'DESC',
'order_by': { 'order_by': {
slug: 'creation_date', slug: 'creation_date',
@ -184,8 +184,8 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getCollectionFiltersPath(collectionId) { getCollectionFiltersPath(collectionId) {
return '/collections/'+ collectionId + '/filters/'; return '/collections/'+ collectionId + '/filters/';
}, },
getCollectionEventsPath(collectionId) { getCollectionActivitiesPath(collectionId) {
return '/collections/'+ collectionId + '/events/'; return '/collections/'+ collectionId + '/activities/';
}, },
getItemsPath(query) { getItemsPath(query) {
return '/items/?' + qs.stringify(query); return '/items/?' + qs.stringify(query);
@ -202,17 +202,17 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getMetadataPath(query) { getMetadataPath(query) {
return '/metadata/?' + qs.stringify(query); return '/metadata/?' + qs.stringify(query);
}, },
getEventsPath(query) { getActivitiesPath(query) {
return '/events/?' + qs.stringify(query); return '/activities/?' + qs.stringify(query);
}, },
getAvailableImportersPath() { getAvailableImportersPath() {
return '/importers'; return '/importers';
}, },
getProcessesPage(highlightedProcess) { getProcessesPage(highlightedProcess) {
if (highlightedProcess) if (highlightedProcess)
return '/events?tab=processes&highlight=' + highlightedProcess; return '/activities?tab=processes&highlight=' + highlightedProcess;
else else
return '/events?tab=processes'; return '/activities?tab=processes';
}, },
// Singles // Singles
getCollectionPath(id) { getCollectionPath(id) {
@ -230,14 +230,14 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getTermPath(taxonomyId, termId) { getTermPath(taxonomyId, termId) {
return '/taxonomies/' + taxonomyId + '/terms/' + termId; return '/taxonomies/' + taxonomyId + '/terms/' + termId;
}, },
getEventPath(id) { getActivityPath(id) {
return '/events/' + id; return '/activities/' + id;
}, },
getImporterPath(importerType, sessionId) { getImporterPath(importerType, sessionId) {
return '/importers/' + importerType + '/' + sessionId; return '/importers/' + importerType + '/' + sessionId;
}, },
getCollectionEventPath(collectionId, eventId) { getCollectionActivityPath(collectionId, activityId) {
return '/collections/' + collectionId + '/events/' + eventId; return '/collections/' + collectionId + '/activities/' + activityId;
}, },
// New // New
getNewCollectionPath() { getNewCollectionPath() {
@ -267,8 +267,8 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getNewTermPath(taxonomyId) { getNewTermPath(taxonomyId) {
return '/taxonomies/' + taxonomyId + '/terms/new'; return '/taxonomies/' + taxonomyId + '/terms/new';
}, },
getNewEventPath() { getNewActivityPath() {
return '/events/new'; return '/activities/new';
}, },
getNewItemBulkAddPath(collectionId) { getNewItemBulkAddPath(collectionId) {
return '/collections/' + collectionId + '/bulk-add'; return '/collections/' + collectionId + '/bulk-add';
@ -289,8 +289,8 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getTermEditPath(taxonomyId, termId) { getTermEditPath(taxonomyId, termId) {
return '/taxonomies/' + taxonomyId + '/terms/' + termId + '/edit'; return '/taxonomies/' + taxonomyId + '/terms/' + termId + '/edit';
}, },
getEventEditPath(id) { getActivityEditPath(id) {
return '/events/' + id + '/edit'; return '/activities/' + id + '/edit';
}, },
getImporterEditionPath(importerType) { getImporterEditionPath(importerType) {
return '/importers/' + importerType; return '/importers/' + importerType;

View File

@ -6,7 +6,7 @@
'page-container': isRepositoryLevel 'page-container': isRepositoryLevel
}"> }">
<tainacan-title <tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('events') }]"/> :bread-crumb-items="[{ path: '', label: this.$i18n.get('activities') }]"/>
<div :class="{ 'above-subheader': isRepositoryLevel }"> <div :class="{ 'above-subheader': isRepositoryLevel }">
<div <div
@ -15,7 +15,7 @@
<ul> <ul>
<li <li
@click="onChangeTab('')" @click="onChangeTab('')"
:class="{ 'is-active': tab == undefined || tab == ''}"><a>{{ $i18n.get('events') }}</a></li> :class="{ 'is-active': tab == undefined || tab == ''}"><a>{{ $i18n.get('activities') }}</a></li>
<li <li
@click="onChangeTab('processes')" @click="onChangeTab('processes')"
:class="{ 'is-active': tab == 'processes'}"><a>{{ $i18n.get('processes') }}</a></li> :class="{ 'is-active': tab == 'processes'}"><a>{{ $i18n.get('processes') }}</a></li>
@ -26,13 +26,13 @@
:is-full-page="false" :is-full-page="false"
:active.sync="isLoading" :active.sync="isLoading"
:can-cancel="false"/> :can-cancel="false"/>
<events-list <activities-list
v-if="tab != 'processes'" v-if="tab != 'processes'"
:is-loading="isLoading" :is-loading="isLoading"
:total-events="totalEvents" :total-activities="totalActivities"
:page="eventsPage" :page="activitiesPage"
:events-per-page="eventsPerPage" :activities-per-page="activitiesPerPage"
:events="events"/> :activities="activities"/>
<processes-list <processes-list
v-if="tab == 'processes'" v-if="tab == 'processes'"
:is-loading="isLoading" :is-loading="isLoading"
@ -56,24 +56,24 @@
<!-- Footer --> <!-- Footer -->
<div <div
class="pagination-area" class="pagination-area"
v-if="tab != 'processes' && totalEvents > 0"> v-if="tab != 'processes' && totalActivities > 0">
<div class="shown-items"> <div class="shown-items">
{{ {{
$i18n.get('info_showing_events') + $i18n.get('info_showing_activities') +
(eventsPerPage * (eventsPage - 1) + 1) + (activitiesPerPage * (activitiesPage - 1) + 1) +
$i18n.get('info_to') + $i18n.get('info_to') +
getLastEventNumber() + getLastActivityNumber() +
$i18n.get('info_of') + totalEvents + '.' $i18n.get('info_of') + totalActivities + '.'
}} }}
</div> </div>
<div class="items-per-page"> <div class="items-per-page">
<b-field <b-field
horizontal horizontal
:label="$i18n.get('label_events_per_page')"> :label="$i18n.get('label_activities_per_page')">
<b-select <b-select
:value="eventsPerPage" :value="activitiesPerPage"
@input="onChangeEventsPerPage" @input="onChangeActivitiesPerPage"
:disabled="events.length <= 0"> :disabled="activities.length <= 0">
<option value="12">12</option> <option value="12">12</option>
<option value="24">24</option> <option value="24">24</option>
<option value="48">48</option> <option value="48">48</option>
@ -84,11 +84,11 @@
<div class="pagination"> <div class="pagination">
<b-pagination <b-pagination
@change="onPageChange" @change="onPageChange"
:total="totalEvents" :total="totalActivities"
:current.sync="eventsPage" :current.sync="activitiesPage"
order="is-centered" order="is-centered"
size="is-small" size="is-small"
:per-page="eventsPerPage"/> :per-page="activitiesPerPage"/>
</div> </div>
</div> </div>
<div <div
@ -134,38 +134,38 @@
</template> </template>
<script> <script>
import EventsList from "../../components/lists/events-list.vue"; import ActivitiesList from "../../components/lists/activities-list.vue";
import ProcessesList from "../../components/lists/processes-list.vue"; import ProcessesList from "../../components/lists/processes-list.vue";
import ActivitiesIcon from '../../components/other/activities-icon.vue'; import ActivitiesIcon from '../../components/other/activities-icon.vue';
import { mapActions, mapGetters } from 'vuex'; import { mapActions, mapGetters } from 'vuex';
import moment from 'moment' import moment from 'moment'
export default { export default {
name: 'EventsPage', name: 'ActivitiesPage',
data(){ data(){
return { return {
isLoading: false, isLoading: false,
totalEvents: 0, totalActivities: 0,
eventsPage: 1, activitiesPage: 1,
processesPage: 1, processesPage: 1,
eventsPerPage: 12, activitiesPerPage: 12,
processesPerPage: 12, processesPerPage: 12,
isRepositoryLevel: false, isRepositoryLevel: false,
tab: '' tab: ''
} }
}, },
components: { components: {
EventsList, ActivitiesList,
ProcessesList, ProcessesList,
ActivitiesIcon ActivitiesIcon
}, },
methods: { methods: {
...mapActions('event', [ ...mapActions('activity', [
'fetchEvents', 'fetchActivities',
'fetchCollectionEvents', 'fetchCollectionActivities',
]), ]),
...mapGetters('event', [ ...mapGetters('activity', [
'getEvents' 'getActivities'
]), ]),
...mapActions('bgprocess', [ ...mapActions('bgprocess', [
'fetchProcesses', 'fetchProcesses',
@ -179,23 +179,23 @@
this.loadProcesses(); this.loadProcesses();
this.$router.push({query: {tab: 'processes'}}); this.$router.push({query: {tab: 'processes'}});
} else { } else {
this.loadEvents(); this.loadActivities();
this.$router.push({query: {}}); this.$router.push({query: {}});
} }
}, },
onChangeEventsPerPage(value) { onChangeActivitiesPerPage(value) {
if (value != this.eventsPerPage) { if (value != this.activitiesPerPage) {
this.$userPrefs.set('events_per_page', value) this.$userPrefs.set('activities_per_page', value)
.then((newValue) => { .then((newValue) => {
this.eventsPerPage = newValue; this.activitiesPerPage = newValue;
}) })
.catch(() => { .catch(() => {
this.$console.log("Error settings user prefs for events per page") this.$console.log("Error settings user prefs for activities per page")
}); });
} }
this.eventsPerPage = value; this.activitiesPerPage = value;
this.loadEvents(); this.loadActivities();
}, },
onChangeProcessesPerPage(value) { onChangeProcessesPerPage(value) {
@ -217,27 +217,27 @@
this.processesPage = page; this.processesPage = page;
this.loadProcesses(); this.loadProcesses();
} else { } else {
this.eventsPage = page; this.activitiesPage = page;
this.loadEvents(); this.loadActivities();
} }
}, },
loadEvents() { loadActivities() {
this.isLoading = true; this.isLoading = true;
if(this.isRepositoryLevel) { if(this.isRepositoryLevel) {
this.fetchEvents({'page': this.eventsPage, 'eventsPerPage': this.eventsPerPage}) this.fetchActivities({'page': this.activitiesPage, 'activitiesPerPage': this.activitiesPerPage})
.then((res) => { .then((res) => {
this.isLoading = false; this.isLoading = false;
this.totalEvents = res.total; this.totalActivities = res.total;
}) })
.catch(() => { .catch(() => {
this.isLoading = false; this.isLoading = false;
}); });
} else { } else {
this.fetchCollectionEvents({'page': this.eventsPage, 'eventsPerPage': this.eventsPerPage, 'collectionId': this.$route.params.collectionId}) this.fetchCollectionActivities({'page': this.activitiesPage, 'activitiesPerPage': this.activitiesPerPage, 'collectionId': this.$route.params.collectionId})
.then((res) => { .then((res) => {
this.isLoading = false; this.isLoading = false;
this.totalEvents = res.total; this.totalActivities = res.total;
}) })
.catch(() => { .catch(() => {
this.isLoading = false; this.isLoading = false;
@ -256,9 +256,9 @@
this.isLoading = false; this.isLoading = false;
}); });
}, },
getLastEventNumber() { getLastActivityNumber() {
let last = (Number(this.eventsPerPage * (this.eventPage - 1)) + Number(this.eventsPerPage)); let last = (Number(this.activitiesPerPage * (this.activityPage - 1)) + Number(this.activitiesPerPage));
return last > this.totalEvents ? this.totalEvents : last; return last > this.totalActivities ? this.totalActivities : last;
}, },
getLastProcessesNumber() { getLastProcessesNumber() {
let last = (Number(this.processesPerPage * (this.processesPage - 1)) + Number(this.processesPerPage)); let last = (Number(this.processesPerPage * (this.processesPage - 1)) + Number(this.processesPerPage));
@ -266,41 +266,41 @@
} }
}, },
computed: { computed: {
events(){ activities(){
let eventsList = this.getEvents(); let activitiesList = this.getActivities();
for (let event of eventsList) for (let activity of activitiesList)
event['by'] = this.$i18n.get('info_by') + activity['by'] = this.$i18n.get('info_by') +
event['user_name'] + '<br>' + this.$i18n.get('info_date') + activity['user_name'] + '<br>' + this.$i18n.get('info_date') +
moment(event['log_date'], 'YYYY-MM-DD h:mm:ss').format('DD/MM/YYYY, hh:mm:ss'); moment(activity['log_date'], 'YYYY-MM-DD h:mm:ss').format('DD/MM/YYYY, hh:mm:ss');
return eventsList; return activitiesList;
}, },
processes(){ processes(){
return this.getProcesses(); return this.getProcesses();
} }
}, },
created() { created() {
this.eventsPerPage = this.$userPrefs.get('events_per_page'); this.activitiesPerPage = this.$userPrefs.get('activities_per_page');
this.processesPerPage = this.$userPrefs.get('processes_per_page'); this.processesPerPage = this.$userPrefs.get('processes_per_page');
this.isRepositoryLevel = (this.$route.params.collectionId === undefined); this.isRepositoryLevel = (this.$route.params.collectionId === undefined);
}, },
mounted(){ mounted(){
if (!this.isRepositoryLevel) if (!this.isRepositoryLevel)
this.$root.$emit('onCollectionBreadCrumbUpdate', [{ path: '', label: this.$i18n.get('events') }]); this.$root.$emit('onCollectionBreadCrumbUpdate', [{ path: '', label: this.$i18n.get('activities') }]);
if (this.$route.query.tab == 'processes' && this.isRepositoryLevel) if (this.$route.query.tab == 'processes' && this.isRepositoryLevel)
this.tab = 'processes'; this.tab = 'processes';
if (this.tab != 'processes') { if (this.tab != 'processes') {
if (this.eventsPerPage != this.$userPrefs.get('events_per_page')) if (this.activitiesPerPage != this.$userPrefs.get('activities_per_page'))
this.eventsPerPage = this.$userPrefs.get('events_per_page'); this.activitiesPerPage = this.$userPrefs.get('activities_per_page');
if (!this.eventsPerPage) { if (!this.activitiesPerPage) {
this.eventsPerPage = 12; this.activitiesPerPage = 12;
this.$userPrefs.set('events_per_page', 12); this.$userPrefs.set('activities_per_page', 12);
} }
this.loadEvents(); this.loadActivities();
} else { } else {
if (this.processesPerPage != this.$userPrefs.get('processes_per_page')) if (this.processesPerPage != this.$userPrefs.get('processes_per_page'))
this.processesPerPage = this.$userPrefs.get('processes_per_page'); this.processesPerPage = this.$userPrefs.get('processes_per_page');

View File

@ -6,13 +6,13 @@
:class="{ 'repository-level-page': $route.params.collectionId == undefined }"> :class="{ 'repository-level-page': $route.params.collectionId == undefined }">
<tainacan-title <tainacan-title
:bread-crumb-items="[ :bread-crumb-items="[
{ path: $routerHelper.getEventsPath(), label: $i18n.get('events') }, { path: $routerHelper.getActivitiesPath(), label: $i18n.get('activities') },
{ path: '', label: (event != undefined && event.title != undefined) ? event.title : $i18n.get('event') } { path: '', label: (activity != undefined && activity.title != undefined) ? activity.title : $i18n.get('activity') }
]"/> ]"/>
<h1 class="event-titles">{{ event.description }}</h1> <h1 class="activity-titles">{{ activity.description }}</h1>
<div <div
class="level" class="level"
v-if="event.title !== undefined && event.title.includes('updated')"> v-if="activity.title !== undefined && activity.title.includes('updated')">
<div class="level-left"/> <div class="level-left"/>
<div class="level-right"> <div class="level-right">
<div class="level-item"> <div class="level-item">
@ -46,14 +46,14 @@
<hr class="divider"> <hr class="divider">
<div v-if="event.title !== undefined && event.title.includes('updated')"> <div v-if="activity.title !== undefined && activity.title.includes('updated')">
<component <component
:is="comp" :is="comp"
:event="event"/> :activity="activity"/>
</div> </div>
<div v-else-if="event.title !== undefined"> <div v-else-if="activity.title !== undefined">
<no-diff :event="event"/> <no-diff :activity="activity"/>
</div> </div>
</div> </div>
@ -64,31 +64,31 @@
<script> <script>
import {mapActions, mapGetters} from 'vuex'; import {mapActions, mapGetters} from 'vuex';
import Split from '../../components/other/event/diff-exhibition/event-split.vue'; import Split from '../../components/other/activity/diff-exhibition/activity-split.vue';
import Unified from '../../components/other/event/diff-exhibition/event-unified.vue'; import Unified from '../../components/other/activity/diff-exhibition/activity-unified.vue';
import NoDiff from '../../components/other/event/unique-exhibition/event-nodiff.vue'; import NoDiff from '../../components/other/activity/unique-exhibition/activity-nodiff.vue';
import TainacanTitle from '../../components/navigation/tainacan-title.vue'; import TainacanTitle from '../../components/navigation/tainacan-title.vue';
export default { export default {
name: 'EventPage', name: 'ActivityPage',
data() { data() {
return { return {
eventId: Number, activityId: Number,
comp: 'Split', comp: 'Split',
} }
}, },
methods: { methods: {
...mapActions('event', [ ...mapActions('activity', [
'fetchEvent' 'fetchActivity'
]), ]),
...mapGetters('event', [ ...mapGetters('activity', [
'getEvent' 'getActivity'
]) ])
}, },
computed: { computed: {
event() { activity() {
return this.getEvent(); return this.getActivity();
} }
}, },
components: { components: {
@ -98,14 +98,14 @@
TainacanTitle, TainacanTitle,
}, },
created() { created() {
this.eventId = parseInt(this.$route.params.eventId); this.activityId = parseInt(this.$route.params.activityId);
this.fetchEvent(this.eventId).then(() => { this.fetchActivity(this.activityId).then(() => {
if (this.$route.params.collectionId != undefined) if (this.$route.params.collectionId != undefined)
this.$root.$emit('onCollectionBreadCrumbUpdate', [ this.$root.$emit('onCollectionBreadCrumbUpdate', [
{ path: this.$routerHelper.getCollectionEventsPath(this.$route.params.collectionId), label: this.$i18n.get('events') }, { path: this.$routerHelper.getCollectionActivitiesPath(this.$route.params.collectionId), label: this.$i18n.get('activities') },
{ path: '', label: this.event.title} { path: '', label: this.activity.title}
]); ]);
}); });
} }
@ -114,7 +114,7 @@
</script> </script>
<style> <style>
.event-titles { .activity-titles {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
color: #01295c; color: #01295c;

View File

@ -19,13 +19,13 @@ return apply_filters( 'tainacan-admin-i18n', [
'metadata' => __( 'Metadata', 'tainacan' ), 'metadata' => __( 'Metadata', 'tainacan' ),
'filters' => __( 'Filters', 'tainacan' ), 'filters' => __( 'Filters', 'tainacan' ),
'taxonomies' => __( 'Taxonomies', 'tainacan' ), 'taxonomies' => __( 'Taxonomies', 'tainacan' ),
'events' => __( 'Events', 'tainacan' ), 'activities' => __( 'Activities', 'tainacan' ),
'collection' => __( 'Collection', 'tainacan' ), 'collection' => __( 'Collection', 'tainacan' ),
'item' => __( 'Item', 'tainacan' ), 'item' => __( 'Item', 'tainacan' ),
'metadatum' => __( 'Metadata', 'tainacan' ), 'metadatum' => __( 'Metadata', 'tainacan' ),
'filter' => __( 'Filter', 'tainacan' ), 'filter' => __( 'Filter', 'tainacan' ),
'taxonomy' => __( 'Taxonomy', 'tainacan' ), 'taxonomy' => __( 'Taxonomy', 'tainacan' ),
'event' => __( 'Event', 'tainacan' ), 'activity' => __( 'Activity', 'tainacan' ),
'term' => __( 'Term', 'tainacan' ), 'term' => __( 'Term', 'tainacan' ),
'terms' => __( 'Terms', 'tainacan' ), 'terms' => __( 'Terms', 'tainacan' ),
'mapping' => __( 'Mapping', 'tainacan' ), 'mapping' => __( 'Mapping', 'tainacan' ),
@ -93,15 +93,15 @@ return apply_filters( 'tainacan-admin-i18n', [
'title_repository_filters_page' => __( 'Repository Filters', 'tainacan' ), 'title_repository_filters_page' => __( 'Repository Filters', 'tainacan' ),
'title_taxonomies_page' => __( 'Taxonomies', 'tainacan' ), 'title_taxonomies_page' => __( 'Taxonomies', 'tainacan' ),
'title_terms_page' => __( 'Terms', 'tainacan' ), 'title_terms_page' => __( 'Terms', 'tainacan' ),
'title_repository_events_page' => __( 'Repository Events', 'tainacan' ), 'title_repository_activities_page' => __( 'Repository Activities', 'tainacan' ),
'title_collection_page' => __( 'Collection', 'tainacan' ), 'title_collection_page' => __( 'Collection', 'tainacan' ),
'title_item_page' => __( 'Item', 'tainacan' ), 'title_item_page' => __( 'Item', 'tainacan' ),
'title_metadatum_page' => __( 'Metadata', 'tainacan' ), 'title_metadatum_page' => __( 'Metadata', 'tainacan' ),
'title_collection_events' => __( 'Collection Events', 'tainacan' ), 'title_collection_activities' => __( 'Collection Activities', 'tainacan' ),
'title_filter_page' => __( 'Filter', 'tainacan' ), 'title_filter_page' => __( 'Filter', 'tainacan' ),
'title_taxonomy_page' => __( 'Taxonomy', 'tainacan' ), 'title_taxonomy_page' => __( 'Taxonomy', 'tainacan' ),
'title_term_edition' => __( 'Term edition', 'tainacan' ), 'title_term_edition' => __( 'Term edition', 'tainacan' ),
'title_event_page' => __( 'Event', 'tainacan' ), 'title_activity_page' => __( 'Activity', 'tainacan' ),
'title_create_collection' => __( 'Collection Creation', 'tainacan' ), 'title_create_collection' => __( 'Collection Creation', 'tainacan' ),
'title_create_taxonomy_page' => __( 'Taxonomy Creation', 'tainacan' ), 'title_create_taxonomy_page' => __( 'Taxonomy Creation', 'tainacan' ),
'title_create_item_collection' => __( 'Create Item on Collection', 'tainacan' ), 'title_create_item_collection' => __( 'Create Item on Collection', 'tainacan' ),
@ -157,7 +157,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_button_delete_thumb' => __( 'Button Delete Thumbnail', 'tainacan' ), 'label_button_delete_thumb' => __( 'Button Delete Thumbnail', 'tainacan' ),
'label_collections_per_page' => __( 'Collections per Page:', 'tainacan' ), 'label_collections_per_page' => __( 'Collections per Page:', 'tainacan' ),
'label_taxonomies_per_page' => __( 'Taxonomies per Page:', 'tainacan' ), 'label_taxonomies_per_page' => __( 'Taxonomies per Page:', 'tainacan' ),
'label_events_per_page' => __( 'Events per Page:', 'tainacan' ), 'label_activities_per_page' => __( 'Activities per Page:', 'tainacan' ),
'label_items_per_page' => __( 'Items per Page:', 'tainacan' ), 'label_items_per_page' => __( 'Items per Page:', 'tainacan' ),
'label_processes_per_page' => __( 'Processes per Page:', 'tainacan' ), 'label_processes_per_page' => __( 'Processes per Page:', 'tainacan' ),
'label_active_metadata' => __( 'Active Metadata', 'tainacan' ), 'label_active_metadata' => __( 'Active Metadata', 'tainacan' ),
@ -204,8 +204,8 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_core_title' => __( 'Core Title', 'tainacan' ), 'label_core_title' => __( 'Core Title', 'tainacan' ),
'label_core_description' => __( 'Core Description', 'tainacan' ), 'label_core_description' => __( 'Core Description', 'tainacan' ),
'label_sorting' => __( 'Sorting', 'tainacan' ), 'label_sorting' => __( 'Sorting', 'tainacan' ),
'label_event_date' => __( 'Event date', 'tainacan' ), 'label_activity_date' => __( 'Activity date', 'tainacan' ),
'label_event_title' => __( 'Event', 'tainacan' ), 'label_activity_title' => __( 'Activity', 'tainacan' ),
'label_header_image' => __( 'Header Image', 'tainacan' ), 'label_header_image' => __( 'Header Image', 'tainacan' ),
'label_empty_header_image' => __( 'Empty Header Image', 'tainacan' ), 'label_empty_header_image' => __( 'Empty Header Image', 'tainacan' ),
'label_enable_cover_page' => __( 'Enable Cover Page', 'tainacan' ), 'label_enable_cover_page' => __( 'Enable Cover Page', 'tainacan' ),
@ -405,7 +405,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_showing_items' => __( 'Showing items ', 'tainacan' ), 'info_showing_items' => __( 'Showing items ', 'tainacan' ),
'info_showing_collections' => __( 'Showing collections ', 'tainacan' ), 'info_showing_collections' => __( 'Showing collections ', 'tainacan' ),
'info_showing_taxonomies' => __( 'Showing taxonomies ', 'tainacan' ), 'info_showing_taxonomies' => __( 'Showing taxonomies ', 'tainacan' ),
'info_showing_events' => __( 'Showing events ', 'tainacan' ), 'info_showing_activities' => __( 'Showing activities ', 'tainacan' ),
'info_showing_processes' => __( 'Showing processes ', 'tainacan' ), 'info_showing_processes' => __( 'Showing processes ', 'tainacan' ),
'info_warning_remove_from_trash_first' => __( 'Remove this item from trash first' ), 'info_warning_remove_from_trash_first' => __( 'Remove this item from trash first' ),
'info_to' => __( ' to ', 'tainacan' ), 'info_to' => __( ' to ', 'tainacan' ),
@ -421,7 +421,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_warning_taxonomy_not_saved' => __( 'Are you sure? The taxonomy is not saved, changes will be lost.', 'tainacan' ), 'info_warning_taxonomy_not_saved' => __( 'Are you sure? The taxonomy is not saved, changes will be lost.', 'tainacan' ),
'info_warning_terms_not_saved' => __( 'Are you sure? There are terms not saved, changes will be lost.', 'tainacan' ), 'info_warning_terms_not_saved' => __( 'Are you sure? There are terms not saved, changes will be lost.', 'tainacan' ),
'info_warning_orphan_terms' => __( 'Are you sure? This term is parent of other terms. These will be converted to root terms.', 'tainacan' ), 'info_warning_orphan_terms' => __( 'Are you sure? This term is parent of other terms. These will be converted to root terms.', 'tainacan' ),
'info_no_events' => __( 'No events', 'tainacan' ), 'info_no_activities' => __( 'No activities', 'tainacan' ),
'info_logs_before' => __( 'Before updating', 'tainacan' ), 'info_logs_before' => __( 'Before updating', 'tainacan' ),
'info_logs_after' => __( 'What was updated', 'tainacan' ), 'info_logs_after' => __( 'What was updated', 'tainacan' ),
'info_there_is_no_metadatum' => __( 'There is no metadata here yet.', 'tainacan' ), 'info_there_is_no_metadatum' => __( 'There is no metadata here yet.', 'tainacan' ),

View File

@ -0,0 +1,82 @@
import axios from '../../../axios/axios'
export const fetchActivities = ({ commit }, { page, activitiesPerPage } ) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/logs?paged=${page}&perpage=${activitiesPerPage}&context=edit`)
.then(res => {
let activities = res.data;
commit('setActivities', activities);
resolve({
activities: activities,
total: res.headers['x-wp-total']
});
})
.catch(error => reject(error));
});
};
export const fetchCollectionActivities = ({ commit }, { page, activitiesPerPage, collectionId }) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/collection/${collectionId}/logs?paged=${page}&perpage=${activitiesPerPage}&context=edit`)
.then(res => {
let activities = res.data;
commit('setActivities', activities);
resolve({
activities: activities,
total: res.headers['x-wp-total']
});
})
.catch(error => reject(error));
});
};
export const fetchActivity = ({ commit }, activityId) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/logs/${activityId}?context=edit`)
.then(res => {
let activity = res.data;
commit('setActivity', activity);
resolve({
activity: activity
});
})
.catch(error => reject(error));
});
};
export const fetchActivityTitle = ({ commit }, activityId) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/logs/${activityId}?fetch_only=title`)
.then(res => {
let eventTitle = res.data;
commit('setActivityTitle', eventTitle.title);
resolve(eventTitle.title);
})
.catch(error => reject(error));
})
};
export const approve = ({commit}, activityId) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/logs/${activityId}/approve`)
.then(res => {
let activity = res.data;
this.$console.log(activity);
})
.catch(error => reject(error))
});
};
export const notApprove = ({commit}, activityId) => {
};

View File

@ -0,0 +1,11 @@
export const getActivities = state => {
return state.activities;
};
export const getActivity = state => {
return state.activity;
};
export const getActivityTitle = state => {
return state.eventTitle;
};

View File

@ -3,8 +3,8 @@ import * as getters from './getters';
import * as mutations from './mutations'; import * as mutations from './mutations';
const state = { const state = {
events: [], activities: [],
event: {}, activity: {},
eventTitle: String, eventTitle: String,
}; };

View File

@ -0,0 +1,11 @@
export const setActivities = (state, activities) => {
state.activities = activities;
};
export const setActivity = (state, activity) => {
state.activity = activity;
};
export const setActivityTitle = (state, eventTitle) => {
state.eventTitle = eventTitle;
};

View File

@ -1,82 +0,0 @@
import axios from '../../../axios/axios'
export const fetchEvents = ({ commit }, { page, eventsPerPage } ) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/logs?paged=${page}&perpage=${eventsPerPage}&context=edit`)
.then(res => {
let events = res.data;
commit('setEvents', events);
resolve({
events: events,
total: res.headers['x-wp-total']
});
})
.catch(error => reject(error));
});
};
export const fetchCollectionEvents = ({ commit }, { page, eventsPerPage, collectionId }) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/collection/${collectionId}/logs?paged=${page}&perpage=${eventsPerPage}&context=edit`)
.then(res => {
let events = res.data;
commit('setEvents', events);
resolve({
events: events,
total: res.headers['x-wp-total']
});
})
.catch(error => reject(error));
});
};
export const fetchEvent = ({ commit }, eventId) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/logs/${eventId}?context=edit`)
.then(res => {
let event = res.data;
commit('setEvent', event);
resolve({
event: event
});
})
.catch(error => reject(error));
});
};
export const fetchEventTitle = ({ commit }, eventId) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/logs/${eventId}?fetch_only=title`)
.then(res => {
let eventTitle = res.data;
commit('setEventTitle', eventTitle.title);
resolve(eventTitle.title);
})
.catch(error => reject(error));
})
};
export const approve = ({commit}, eventId) => {
return new Promise((resolve, reject) => {
axios.tainacan.get(`/logs/${eventId}/approve`)
.then(res => {
let event = res.data;
this.$console.log(event);
})
.catch(error => reject(error))
});
};
export const notApprove = ({commit}, eventId) => {
};

View File

@ -1,11 +0,0 @@
export const getEvents = state => {
return state.events;
};
export const getEvent = state => {
return state.event;
};
export const getEventTitle = state => {
return state.eventTitle;
};

View File

@ -1,11 +0,0 @@
export const setEvents = (state, events) => {
state.events = events;
};
export const setEvent = (state, event) => {
state.event = event;
};
export const setEventTitle = (state, eventTitle) => {
state.eventTitle = eventTitle;
};

View File

@ -7,7 +7,7 @@ import metadata from './modules/metadata/';
import filter from './modules/filter/'; import filter from './modules/filter/';
import search from './modules/search/'; import search from './modules/search/';
import taxonomy from './modules/taxonomy/'; import taxonomy from './modules/taxonomy/';
import event from './modules/event'; import activity from './modules/activity';
import importer from './modules/importer'; import importer from './modules/importer';
import bgprocess from './modules/bgprocess'; import bgprocess from './modules/bgprocess';
import bulkedition from './modules/bulk-edition'; import bulkedition from './modules/bulk-edition';
@ -30,7 +30,7 @@ export default new Vuex.Store({
filter, filter,
search, search,
taxonomy, taxonomy,
event, activity,
importer, importer,
bgprocess, bgprocess,
bulkedition bulkedition