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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,8 +10,8 @@ import ItemPage from '../pages/singles/item-page.vue'
import MetadataPage from '../pages/lists/metadata-page.vue'
import FiltersPage from '../pages/lists/filters-page.vue'
import Page from '../pages/lists/taxonomies-page.vue'
import EventsPage from '../pages/lists/events-page.vue'
import EventPage from '../pages/singles/event-page.vue'
import ActivitiesPage from '../pages/lists/activities-page.vue'
import ActivityPage from '../pages/singles/activity-page.vue'
import ExportPage from '../pages/singles/export-page.vue'
// 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: '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: 'events', component: EventsPage, name: 'CollectionEventsPage', meta: {title: i18nGet('title_collection_events'), icon: 'flash'} },
{ path: 'events/:eventId', name: 'CollectionEventPage', component: EventPage, meta: {title: i18nGet('title_event_page'), icon: 'flash'} },
{ path: 'activities', component: ActivitiesPage, name: 'CollectionActivitiesPage', meta: {title: i18nGet('title_collection_activities'), 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/: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', redirect: '/taxonomies/:taxonomyId/edit' },
{ path: '/events', name: 'EventsPage', component: EventsPage, meta: {title: i18nGet('title_repository_events_page'), icon: 'flash'} },
{ path: '/events/:eventId', name: 'EventPage', component: EventPage, meta: {title: i18nGet('title_event_page'), icon: 'flash'} },
{ path: '/activities', name: 'ActivitiesPage', component: ActivitiesPage, meta: {title: i18nGet('title_repository_activities_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/: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,
'collections_per_page': 12,
'taxonomies_per_page': 12,
'events_per_page': 12,
'activities_per_page': 12,
'order': 'DESC',
'order_by': {
slug: 'creation_date',
@ -184,8 +184,8 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getCollectionFiltersPath(collectionId) {
return '/collections/'+ collectionId + '/filters/';
},
getCollectionEventsPath(collectionId) {
return '/collections/'+ collectionId + '/events/';
getCollectionActivitiesPath(collectionId) {
return '/collections/'+ collectionId + '/activities/';
},
getItemsPath(query) {
return '/items/?' + qs.stringify(query);
@ -202,17 +202,17 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getMetadataPath(query) {
return '/metadata/?' + qs.stringify(query);
},
getEventsPath(query) {
return '/events/?' + qs.stringify(query);
getActivitiesPath(query) {
return '/activities/?' + qs.stringify(query);
},
getAvailableImportersPath() {
return '/importers';
},
getProcessesPage(highlightedProcess) {
if (highlightedProcess)
return '/events?tab=processes&highlight=' + highlightedProcess;
return '/activities?tab=processes&highlight=' + highlightedProcess;
else
return '/events?tab=processes';
return '/activities?tab=processes';
},
// Singles
getCollectionPath(id) {
@ -230,14 +230,14 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getTermPath(taxonomyId, termId) {
return '/taxonomies/' + taxonomyId + '/terms/' + termId;
},
getEventPath(id) {
return '/events/' + id;
getActivityPath(id) {
return '/activities/' + id;
},
getImporterPath(importerType, sessionId) {
return '/importers/' + importerType + '/' + sessionId;
},
getCollectionEventPath(collectionId, eventId) {
return '/collections/' + collectionId + '/events/' + eventId;
getCollectionActivityPath(collectionId, activityId) {
return '/collections/' + collectionId + '/activities/' + activityId;
},
// New
getNewCollectionPath() {
@ -267,8 +267,8 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getNewTermPath(taxonomyId) {
return '/taxonomies/' + taxonomyId + '/terms/new';
},
getNewEventPath() {
return '/events/new';
getNewActivityPath() {
return '/activities/new';
},
getNewItemBulkAddPath(collectionId) {
return '/collections/' + collectionId + '/bulk-add';
@ -289,8 +289,8 @@ RouterHelperPlugin.install = function (Vue, options = {}) {
getTermEditPath(taxonomyId, termId) {
return '/taxonomies/' + taxonomyId + '/terms/' + termId + '/edit';
},
getEventEditPath(id) {
return '/events/' + id + '/edit';
getActivityEditPath(id) {
return '/activities/' + id + '/edit';
},
getImporterEditionPath(importerType) {
return '/importers/' + importerType;

View File

@ -6,7 +6,7 @@
'page-container': isRepositoryLevel
}">
<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
@ -15,7 +15,7 @@
<ul>
<li
@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
@click="onChangeTab('processes')"
:class="{ 'is-active': tab == 'processes'}"><a>{{ $i18n.get('processes') }}</a></li>
@ -26,13 +26,13 @@
:is-full-page="false"
:active.sync="isLoading"
:can-cancel="false"/>
<events-list
<activities-list
v-if="tab != 'processes'"
:is-loading="isLoading"
:total-events="totalEvents"
:page="eventsPage"
:events-per-page="eventsPerPage"
:events="events"/>
:total-activities="totalActivities"
:page="activitiesPage"
:activities-per-page="activitiesPerPage"
:activities="activities"/>
<processes-list
v-if="tab == 'processes'"
:is-loading="isLoading"
@ -56,24 +56,24 @@
<!-- Footer -->
<div
class="pagination-area"
v-if="tab != 'processes' && totalEvents > 0">
v-if="tab != 'processes' && totalActivities > 0">
<div class="shown-items">
{{
$i18n.get('info_showing_events') +
(eventsPerPage * (eventsPage - 1) + 1) +
$i18n.get('info_showing_activities') +
(activitiesPerPage * (activitiesPage - 1) + 1) +
$i18n.get('info_to') +
getLastEventNumber() +
$i18n.get('info_of') + totalEvents + '.'
getLastActivityNumber() +
$i18n.get('info_of') + totalActivities + '.'
}}
</div>
<div class="items-per-page">
<b-field
horizontal
:label="$i18n.get('label_events_per_page')">
:label="$i18n.get('label_activities_per_page')">
<b-select
:value="eventsPerPage"
@input="onChangeEventsPerPage"
:disabled="events.length <= 0">
:value="activitiesPerPage"
@input="onChangeActivitiesPerPage"
:disabled="activities.length <= 0">
<option value="12">12</option>
<option value="24">24</option>
<option value="48">48</option>
@ -84,11 +84,11 @@
<div class="pagination">
<b-pagination
@change="onPageChange"
:total="totalEvents"
:current.sync="eventsPage"
:total="totalActivities"
:current.sync="activitiesPage"
order="is-centered"
size="is-small"
:per-page="eventsPerPage"/>
:per-page="activitiesPerPage"/>
</div>
</div>
<div
@ -134,38 +134,38 @@
</template>
<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 ActivitiesIcon from '../../components/other/activities-icon.vue';
import { mapActions, mapGetters } from 'vuex';
import moment from 'moment'
export default {
name: 'EventsPage',
name: 'ActivitiesPage',
data(){
return {
isLoading: false,
totalEvents: 0,
eventsPage: 1,
totalActivities: 0,
activitiesPage: 1,
processesPage: 1,
eventsPerPage: 12,
activitiesPerPage: 12,
processesPerPage: 12,
isRepositoryLevel: false,
tab: ''
}
},
components: {
EventsList,
ActivitiesList,
ProcessesList,
ActivitiesIcon
},
methods: {
...mapActions('event', [
'fetchEvents',
'fetchCollectionEvents',
...mapActions('activity', [
'fetchActivities',
'fetchCollectionActivities',
]),
...mapGetters('event', [
'getEvents'
...mapGetters('activity', [
'getActivities'
]),
...mapActions('bgprocess', [
'fetchProcesses',
@ -179,23 +179,23 @@
this.loadProcesses();
this.$router.push({query: {tab: 'processes'}});
} else {
this.loadEvents();
this.loadActivities();
this.$router.push({query: {}});
}
},
onChangeEventsPerPage(value) {
onChangeActivitiesPerPage(value) {
if (value != this.eventsPerPage) {
this.$userPrefs.set('events_per_page', value)
if (value != this.activitiesPerPage) {
this.$userPrefs.set('activities_per_page', value)
.then((newValue) => {
this.eventsPerPage = newValue;
this.activitiesPerPage = newValue;
})
.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.loadEvents();
this.activitiesPerPage = value;
this.loadActivities();
},
onChangeProcessesPerPage(value) {
@ -217,27 +217,27 @@
this.processesPage = page;
this.loadProcesses();
} else {
this.eventsPage = page;
this.loadEvents();
this.activitiesPage = page;
this.loadActivities();
}
},
loadEvents() {
loadActivities() {
this.isLoading = true;
if(this.isRepositoryLevel) {
this.fetchEvents({'page': this.eventsPage, 'eventsPerPage': this.eventsPerPage})
this.fetchActivities({'page': this.activitiesPage, 'activitiesPerPage': this.activitiesPerPage})
.then((res) => {
this.isLoading = false;
this.totalEvents = res.total;
this.totalActivities = res.total;
})
.catch(() => {
this.isLoading = false;
});
} 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) => {
this.isLoading = false;
this.totalEvents = res.total;
this.totalActivities = res.total;
})
.catch(() => {
this.isLoading = false;
@ -256,9 +256,9 @@
this.isLoading = false;
});
},
getLastEventNumber() {
let last = (Number(this.eventsPerPage * (this.eventPage - 1)) + Number(this.eventsPerPage));
return last > this.totalEvents ? this.totalEvents : last;
getLastActivityNumber() {
let last = (Number(this.activitiesPerPage * (this.activityPage - 1)) + Number(this.activitiesPerPage));
return last > this.totalActivities ? this.totalActivities : last;
},
getLastProcessesNumber() {
let last = (Number(this.processesPerPage * (this.processesPage - 1)) + Number(this.processesPerPage));
@ -266,41 +266,41 @@
}
},
computed: {
events(){
let eventsList = this.getEvents();
activities(){
let activitiesList = this.getActivities();
for (let event of eventsList)
event['by'] = this.$i18n.get('info_by') +
event['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');
for (let activity of activitiesList)
activity['by'] = this.$i18n.get('info_by') +
activity['user_name'] + '<br>' + this.$i18n.get('info_date') +
moment(activity['log_date'], 'YYYY-MM-DD h:mm:ss').format('DD/MM/YYYY, hh:mm:ss');
return eventsList;
return activitiesList;
},
processes(){
return this.getProcesses();
}
},
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.isRepositoryLevel = (this.$route.params.collectionId === undefined);
},
mounted(){
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)
this.tab = 'processes';
if (this.tab != 'processes') {
if (this.eventsPerPage != this.$userPrefs.get('events_per_page'))
this.eventsPerPage = this.$userPrefs.get('events_per_page');
if (this.activitiesPerPage != this.$userPrefs.get('activities_per_page'))
this.activitiesPerPage = this.$userPrefs.get('activities_per_page');
if (!this.eventsPerPage) {
this.eventsPerPage = 12;
this.$userPrefs.set('events_per_page', 12);
if (!this.activitiesPerPage) {
this.activitiesPerPage = 12;
this.$userPrefs.set('activities_per_page', 12);
}
this.loadEvents();
this.loadActivities();
} else {
if (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 }">
<tainacan-title
:bread-crumb-items="[
{ path: $routerHelper.getEventsPath(), label: $i18n.get('events') },
{ path: '', label: (event != undefined && event.title != undefined) ? event.title : $i18n.get('event') }
{ path: $routerHelper.getActivitiesPath(), label: $i18n.get('activities') },
{ 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
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-right">
<div class="level-item">
@ -46,14 +46,14 @@
<hr class="divider">
<div v-if="event.title !== undefined && event.title.includes('updated')">
<div v-if="activity.title !== undefined && activity.title.includes('updated')">
<component
:is="comp"
:event="event"/>
:activity="activity"/>
</div>
<div v-else-if="event.title !== undefined">
<no-diff :event="event"/>
<div v-else-if="activity.title !== undefined">
<no-diff :activity="activity"/>
</div>
</div>
@ -64,31 +64,31 @@
<script>
import {mapActions, mapGetters} from 'vuex';
import Split from '../../components/other/event/diff-exhibition/event-split.vue';
import Unified from '../../components/other/event/diff-exhibition/event-unified.vue';
import NoDiff from '../../components/other/event/unique-exhibition/event-nodiff.vue';
import Split from '../../components/other/activity/diff-exhibition/activity-split.vue';
import Unified from '../../components/other/activity/diff-exhibition/activity-unified.vue';
import NoDiff from '../../components/other/activity/unique-exhibition/activity-nodiff.vue';
import TainacanTitle from '../../components/navigation/tainacan-title.vue';
export default {
name: 'EventPage',
name: 'ActivityPage',
data() {
return {
eventId: Number,
activityId: Number,
comp: 'Split',
}
},
methods: {
...mapActions('event', [
'fetchEvent'
...mapActions('activity', [
'fetchActivity'
]),
...mapGetters('event', [
'getEvent'
...mapGetters('activity', [
'getActivity'
])
},
computed: {
event() {
return this.getEvent();
activity() {
return this.getActivity();
}
},
components: {
@ -98,14 +98,14 @@
TainacanTitle,
},
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)
this.$root.$emit('onCollectionBreadCrumbUpdate', [
{ path: this.$routerHelper.getCollectionEventsPath(this.$route.params.collectionId), label: this.$i18n.get('events') },
{ path: '', label: this.event.title}
{ path: this.$routerHelper.getCollectionActivitiesPath(this.$route.params.collectionId), label: this.$i18n.get('activities') },
{ path: '', label: this.activity.title}
]);
});
}
@ -114,7 +114,7 @@
</script>
<style>
.event-titles {
.activity-titles {
font-size: 20px;
font-weight: 500;
color: #01295c;

View File

@ -19,13 +19,13 @@ return apply_filters( 'tainacan-admin-i18n', [
'metadata' => __( 'Metadata', 'tainacan' ),
'filters' => __( 'Filters', 'tainacan' ),
'taxonomies' => __( 'Taxonomies', 'tainacan' ),
'events' => __( 'Events', 'tainacan' ),
'activities' => __( 'Activities', 'tainacan' ),
'collection' => __( 'Collection', 'tainacan' ),
'item' => __( 'Item', 'tainacan' ),
'metadatum' => __( 'Metadata', 'tainacan' ),
'filter' => __( 'Filter', 'tainacan' ),
'taxonomy' => __( 'Taxonomy', 'tainacan' ),
'event' => __( 'Event', 'tainacan' ),
'activity' => __( 'Activity', 'tainacan' ),
'term' => __( 'Term', 'tainacan' ),
'terms' => __( 'Terms', 'tainacan' ),
'mapping' => __( 'Mapping', 'tainacan' ),
@ -74,7 +74,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'finish' => __( 'Finish', 'tainacan' ),
'select_to_create' => __( 'select to create', 'tainacan' ),
'new_action' => __( 'New action', 'tainacan' ),
'clear_radio' => __( 'Clear selected radio', 'tainacan'),
'clear_radio' => __( 'Clear selected radio', 'tainacan' ),
// Wordpress Status
'publish' => __( 'Publish', 'tainacan' ),
@ -93,15 +93,15 @@ return apply_filters( 'tainacan-admin-i18n', [
'title_repository_filters_page' => __( 'Repository Filters', 'tainacan' ),
'title_taxonomies_page' => __( 'Taxonomies', '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_item_page' => __( 'Item', 'tainacan' ),
'title_metadatum_page' => __( 'Metadata', 'tainacan' ),
'title_collection_events' => __( 'Collection Events', 'tainacan' ),
'title_collection_activities' => __( 'Collection Activities', 'tainacan' ),
'title_filter_page' => __( 'Filter', 'tainacan' ),
'title_taxonomy_page' => __( 'Taxonomy', '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_taxonomy_page' => __( 'Taxonomy Creation', 'tainacan' ),
'title_create_item_collection' => __( 'Create Item on Collection', 'tainacan' ),
@ -120,7 +120,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'title_export_item_page' => __( 'Export Item', 'tainacan' ),
'title_export_page' => __( 'Export', 'tainacan' ),
'title_processes_page' => __( 'Processes', 'tainacan' ),
'title_item_bulk_add' => __( 'Bulk Add Items', 'tainacan' ),
'title_item_bulk_add' => __( 'Bulk Add Items', 'tainacan' ),
// Labels (used mainly on Aria Labels and Inputs)
'label_clean' => __( 'Clear', 'tainacan' ),
@ -147,7 +147,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_button_view' => __( 'Button View', 'tainacan' ),
'label_button_edit' => __( 'Button Edit', 'tainacan' ),
'label_button_delete' => __( 'Button Delete', 'tainacan' ),
'label_button_untrash' => __( 'Button Remove from Trash', 'tainacan'),
'label_button_untrash' => __( 'Button Remove from Trash', 'tainacan' ),
'label_button_delete_header_image' => __( 'Button Delete Header Image', 'tainacan' ),
'label_button_edit_thumb' => __( 'Button Edit Thumbnail', 'tainacan' ),
'label_button_edit_header_image' => __( 'Button Edit Header Image', 'tainacan' ),
@ -157,7 +157,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_button_delete_thumb' => __( 'Button Delete Thumbnail', 'tainacan' ),
'label_collections_per_page' => __( 'Collections 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_processes_per_page' => __( 'Processes per Page:', 'tainacan' ),
'label_active_metadata' => __( 'Active Metadata', 'tainacan' ),
@ -201,16 +201,16 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_no_parent_term' => __( 'No parent term', 'tainacan' ),
'label_term_without_name' => __( 'Term without name', 'tainacan' ),
'label_inherited' => __( 'Inherited', 'tainacan' ),
'label_core_title' => __( 'Core Title', 'tainacan' ),
'label_core_title' => __( 'Core Title', 'tainacan' ),
'label_core_description' => __( 'Core Description', 'tainacan' ),
'label_sorting' => __( 'Sorting', 'tainacan' ),
'label_event_date' => __( 'Event date', 'tainacan' ),
'label_event_title' => __( 'Event', 'tainacan' ),
'label_activity_date' => __( 'Activity date', 'tainacan' ),
'label_activity_title' => __( 'Activity', 'tainacan' ),
'label_header_image' => __( 'Header Image', 'tainacan' ),
'label_empty_header_image' => __( 'Empty Header Image', 'tainacan' ),
'label_enable_cover_page' => __( 'Enable Cover Page', 'tainacan' ),
'label_cover_page' => __( 'Cover Page', 'tainacan' ),
'label_comment_status' => __( 'Allow Comments', 'tainacan' ),
'label_comment_status' => __( 'Allow Comments', 'tainacan' ),
'label_default_displayed_metadata' => __( 'Default Displayed Metadata', 'tainacan' ),
'label_display' => __( 'Display on Listing', 'tainacan' ),
'label_display_default' => __( 'Display by default', 'tainacan' ),
@ -295,35 +295,35 @@ return apply_filters( 'tainacan-admin-i18n', [
'label_progress' => __( 'Progress', 'tainacan' ),
'label_process_completed' => __( 'Process completed', 'tainacan' ),
'label_stop_process' => __( 'Stop process', 'tainacan' ),
'label_process_failed' => __( 'Process failed', 'tainacan' ),
'label_process_failed' => __( 'Process failed', 'tainacan' ),
'label_max_options_to_show' => __( 'Max options to show', 'tainacan' ),
'label_unamed_process' => __( 'Unamed process', 'tainacan' ),
'label_unamed_process' => __( 'Unamed process', 'tainacan' ),
'label_semantic_uri' => __( 'Semantic Uri', 'tainacan' ),
'label_view_collection' => __( 'View collection', 'tainacan' ),
'label_view_collection' => __( 'View collection', 'tainacan' ),
'label_view_more' => __( 'View more', 'tainacan' ),
'label_log_file' => __( 'Log file', 'tainacan' ),
'label_error_log_file' => __( 'Error Log file', 'tainacan' ),
'label_import_items' => __( 'Import items', 'tainacan' ),
'label_hide_filters' => __( 'Hide filters menu', 'tainacan' ),
'label_show_filters' => __( 'Show filters menu', 'tainacan' ),
'label_error_log_file' => __( 'Error Log file', 'tainacan' ),
'label_import_items' => __( 'Import items', 'tainacan' ),
'label_hide_filters' => __( 'Hide filters menu', 'tainacan' ),
'label_show_filters' => __( 'Show filters menu', 'tainacan' ),
'label_select_all_items' => __( 'Select all items', 'tainacan' ),
'label_select_all' => __( 'Select all', 'tainacan' ),
'label_untrash_selected_items' => __( 'Recover from trash', 'tainacan' ),
'label_value_not_informed' => __( 'Value not informed.', 'tainacan' ),
'label_value_not_informed' => __( 'Value not informed.', 'tainacan' ),
'label_description_not_informed' => __( 'Description not informed.', 'tainacan' ),
'label_hide_metadata' => __( 'Hide metadata', 'tainacan' ),
'label_show_metadata' => __( 'Show metadata', 'tainacan' ),
'label_hide_metadata' => __( 'Hide metadata', 'tainacan' ),
'label_show_metadata' => __( 'Show metadata', 'tainacan' ),
'label_all_terms' => __( 'All terms', 'tainacan' ),
'label_selected_terms' => __( 'Selected terms', 'tainacan'),
'label_editing_item_number' => __( 'Editing item n.', 'tainacan'),
'label_sequence_editing_item' => __( 'Sequence editing: Item', 'tainacan'),
'label_files_remaining' => __( 'files remaining.', 'tainacan'),
'label_file_remaining' => __( 'file remaining.', 'tainacan'),
'label_upload_file_prepare_items' => __( 'Uploading files and preparing items', 'tainacan'),
'label_bulk_edit_items' => __( 'Bulk edit items', 'tainacan'),
'label_sequence_edit_items' => __( 'Sequence edit items', 'tainacan'),
'label_documents_upload' => __( 'Documents upload', 'tainacan'),
'label_added_items' => __( 'Added items', 'tainacan'),
'label_selected_terms' => __( 'Selected terms', 'tainacan' ),
'label_editing_item_number' => __( 'Editing item n.', 'tainacan' ),
'label_sequence_editing_item' => __( 'Sequence editing: Item', 'tainacan' ),
'label_files_remaining' => __( 'files remaining.', 'tainacan' ),
'label_file_remaining' => __( 'file remaining.', 'tainacan' ),
'label_upload_file_prepare_items' => __( 'Uploading files and preparing items', 'tainacan' ),
'label_bulk_edit_items' => __( 'Bulk edit items', 'tainacan' ),
'label_sequence_edit_items' => __( 'Sequence edit items', 'tainacan' ),
'label_documents_upload' => __( 'Documents upload', 'tainacan' ),
'label_added_items' => __( 'Added items', 'tainacan' ),
// Instructions. More complex sentences to guide user and placeholders
'instruction_delete_selected_collections' => __( 'Delete selected collections', 'tainacan' ),
@ -359,7 +359,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'instruction_select_collection_fetch_items' => __( 'Select a collection to fecth items', 'tainacan' ),
'instruction_select_a_action' => __( 'Select a action', 'tainacan' ),
'instruction_parent_term' => __( 'Type to search a Parent Term to choose.', 'tainacan' ),
'instruction_type_existing_term' => __( 'Type to add an existing term...', 'tainacan' ),
'instruction_type_existing_term' => __( 'Type to add an existing term...', 'tainacan' ),
// Info. Other feedback to user.
'info_error_invalid_date' => __( 'Invalid date', 'tainacan' ),
@ -372,7 +372,7 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_no_taxonomy_draft' => __( 'No draft taxonomy found.', 'tainacan' ),
'info_no_taxonomy_trash' => __( 'No taxonomy in trash.', 'tainacan' ),
'info_no_taxonomy_created' => __( 'No taxonomy was created in this repository.', 'tainacan' ),
'info_no_terms_created_on_taxonomy' => __( 'No term was created for this taxonomy.', 'tainacan' ),
'info_no_terms_created_on_taxonomy' => __( 'No term was created for this taxonomy.', 'tainacan' ),
'info_no_item_created' => __( 'No item was created in this collection.', 'tainacan' ),
'info_no_item_draft' => __( 'No draft item found.', 'tainacan' ),
'info_no_item_trash' => __( 'No item in trash.', 'tainacan' ),
@ -405,9 +405,9 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_showing_items' => __( 'Showing items ', 'tainacan' ),
'info_showing_collections' => __( 'Showing collections ', '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_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_of' => __( ' of ', 'tainacan' ),
'info_created_by' => __( 'Created by: ', '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_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_no_events' => __( 'No events', 'tainacan' ),
'info_no_activities' => __( 'No activities', 'tainacan' ),
'info_logs_before' => __( 'Before updating', 'tainacan' ),
'info_logs_after' => __( 'What was updated', 'tainacan' ),
'info_there_is_no_metadatum' => __( 'There is no metadata here yet.', 'tainacan' ),
@ -460,46 +460,46 @@ return apply_filters( 'tainacan-admin-i18n', [
'info_unknown_date' => __( 'Unknown date.', 'tainacan' ),
'info_there_are_no_metadata_to_search' => __( 'There are no metadata to search', 'tainacan' ),
'info_there_are_no_metadata_in_repository_level' => __( 'There are no metadata in repository level', 'tainacan' ),
'info_import_collection' => __( 'Import from external sources.', 'tainacan' ),
'info_import_items' => __( 'Import items from external sources.', 'tainacan' ),
'info_bulk_add_items' => __( 'Bulk add documents from your computer as items.', 'tainacan' ),
'info_import_collection' => __( 'Import from external sources.', 'tainacan' ),
'info_import_items' => __( 'Import items from external sources.', 'tainacan' ),
'info_bulk_add_items' => __( 'Bulk add documents from your computer as items.', 'tainacan' ),
'info_editing_items_in_bulk' => __( 'Bulk edit items', 'tainacan' ),
'info_by_inner' => __( 'by', 'tainacan' ),
'info_items_selected' => __( 'items selected', 'tainacan' ),
'info_items_affected' => __( 'items affected', 'tainacan' ),
'info_item_affected' => __( 'item affected', 'tainacan'),
'info_item_affected' => __( 'item affected', 'tainacan' ),
'info_no_parent_term_found' => __( 'No valid parent term was found with this name.', 'tainacan' ),
'info_warning_changing_parent_term' => __( 'Warning! Changing parent term will reload the terms list, thus uncheking any selection.', 'tainacan' ),
'info_warning_selected_items_remove_from_trash' => __( 'Do you really want to remove from trash the selected items?', 'tainacan'),
'info_no_options_avialable_filtering' => __( 'No options for this filtering.', 'tainacan'),
'info_no_options_found' => __( 'No options found.', 'tainacan'),
'info_warning_selected_items_remove_from_trash' => __( 'Do you really want to remove from trash the selected items?', 'tainacan' ),
'info_no_options_avialable_filtering' => __( 'No options for this filtering.', 'tainacan' ),
'info_no_options_found' => __( 'No options found.', 'tainacan' ),
'info_all_files_uploaded' => __( 'All files uploaded.', 'tainacan' ),
'info_there_are' => __( 'There are', 'tainacan' ),
'info_items_being_edited' => __( 'items being edited', 'tainacan' ),
'info_there_is' => __( 'There is', 'tainacan' ),
'info_item_being_edited' => __( 'item being edited', 'tainacan' ),
'info_no_preview_found' => __( 'No preview was found.', 'tainacan' ),
'info_leaving_bulk_edition' => __( 'You are leaving the bulk edition now.', 'tainacan' ),
'info_all_files_uploaded' => __( 'All files uploaded.', 'tainacan'),
'info_there_are' => __( 'There are', 'tainacan'),
'info_items_being_edited' => __( 'items being edited', 'tainacan'),
'info_there_is' => __( 'There is', 'tainacan'),
'info_item_being_edited' => __( 'item being edited', 'tainacan'),
'info_no_preview_found' => __( 'No preview was found.', 'tainacan'),
'info_leaving_bulk_edition' => __( 'You are leaving the bulk edition now.', 'tainacan'),
// Tainacan Metadatum Types
'tainacan-text' => __( 'Text', 'tainacan' ),
'tainacan-textarea' => __( 'Text area', 'tainacan' ),
'tainacan-date' => __( 'Date', 'tainacan' ),
'tainacan-numeric' => __( 'Numeric', 'tainacan' ),
'tainacan-selectbox' => __( 'Select box', 'tainacan' ),
'tainacan-relationship' => __( 'Relationship', 'tainacan' ),
'tainacan-taxonomy' => __( 'Taxonomy', 'tainacan' ),
'tainacan-compound' => __( 'Compound', 'tainacan' ),
'tainacan-text' => __( 'Text', 'tainacan' ),
'tainacan-textarea' => __( 'Text area', 'tainacan' ),
'tainacan-date' => __( 'Date', 'tainacan' ),
'tainacan-numeric' => __( 'Numeric', 'tainacan' ),
'tainacan-selectbox' => __( 'Select box', 'tainacan' ),
'tainacan-relationship' => __( 'Relationship', 'tainacan' ),
'tainacan-taxonomy' => __( 'Taxonomy', 'tainacan' ),
'tainacan-compound' => __( 'Compound', 'tainacan' ),
// Tainacan Filter Types
'tainacan-filter-custom-interval' => __( 'Custom Interval', 'tainacan' ),
'tainacan-filter-selectbox' => __( 'Select Box', 'tainacan' ),
'tainacan-filter-autocomplete' => __( 'Autocomplete', 'tainacan' ),
'tainacan-filter-taginput' => __( 'Tag Input', 'tainacan' ),
'tainacan-filter-checkbox' => __( 'Check Box', 'tainacan' ),
'tainacan-filter-taxonomy-taginput' => __( 'Taxonomy Tag Input', 'tainacan' ),
'tainacan-filter-taxonomy-checkbox' => __( 'Taxonomy Check Box', 'tainacan' ),
'tainacan-filter-taxonomy-selectbox' => __( 'Taxonomy Select Box', 'tainacan' )
'tainacan-filter-custom-interval' => __( 'Custom Interval', 'tainacan' ),
'tainacan-filter-selectbox' => __( 'Select Box', 'tainacan' ),
'tainacan-filter-autocomplete' => __( 'Autocomplete', 'tainacan' ),
'tainacan-filter-taginput' => __( 'Tag Input', 'tainacan' ),
'tainacan-filter-checkbox' => __( 'Check Box', 'tainacan' ),
'tainacan-filter-taxonomy-taginput' => __( 'Taxonomy Tag Input', 'tainacan' ),
'tainacan-filter-taxonomy-checkbox' => __( 'Taxonomy Check Box', 'tainacan' ),
'tainacan-filter-taxonomy-selectbox' => __( 'Taxonomy Select Box', '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';
const state = {
events: [],
event: {},
activities: [],
activity: {},
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 search from './modules/search/';
import taxonomy from './modules/taxonomy/';
import event from './modules/event';
import activity from './modules/activity';
import importer from './modules/importer';
import bgprocess from './modules/bgprocess';
import bulkedition from './modules/bulk-edition';
@ -30,7 +30,7 @@ export default new Vuex.Store({
filter,
search,
taxonomy,
event,
activity,
importer,
bgprocess,
bulkedition