diff --git a/package-lock.json b/package-lock.json index d00f0327..8a08b8cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "datastore-search", - "version": "1.9.3", + "version": "1.9.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "datastore-search", - "version": "1.9.3", + "version": "1.9.4", "dependencies": { "@hennge/vue3-pagination": "^1.0.17", "@heroicons/vue": "^2.0.16", diff --git a/package.json b/package.json index 8ae023b0..399ccffc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datastore-search", - "version": "1.9.3", + "version": "1.9.4", "type": "module", "scripts": { "start": "npm run dev", diff --git a/src/components/ActivityResult.vue b/src/components/ActivityResult.vue index e89331dd..6c27dd8d 100644 --- a/src/components/ActivityResult.vue +++ b/src/components/ActivityResult.vue @@ -18,21 +18,15 @@ import axios from 'axios'; {{ $t('message.back_to_results') }} - + {{ $t('message.back_to_results') }} -
+
-

+

{{ activity.title_narrative }}

@@ -46,9 +40,7 @@ import axios from 'axios'; />
- {{ $t('message.view') }}: + {{ $t('message.view') }}:
-

+

{{ activity.description_narrative }}

@@ -85,17 +77,12 @@ import axios from 'axios';
{{ $t('message.participating_organisations') }}: {{ org }} | @@ -181,8 +168,7 @@ export default { requestData: function () { const axiosConfig = { headers: { - 'Ocp-Apim-Subscription-Key': import.meta.env - .VUE_ENV_APIM_API_KEY, + 'Ocp-Apim-Subscription-Key': import.meta.env.VUE_ENV_APIM_API_KEY, }, }; @@ -205,212 +191,162 @@ export default { ].join(','); const baseUrl = `${domain}/dss/activity/select?wt=json&sort=iati_identifier asc&fl=${fields}*&rows=1&q=`; - axios - .get(baseUrl + 'iati_identifier:"' + id + '"', axiosConfig) - .then(({ data }) => { - if (data.response.numFound === 0) { - this.$router.push({ name: 'NotFound' }); - } else { - this.activity = data.response.docs[0]; + axios.get(baseUrl + 'iati_identifier:"' + id + '"', axiosConfig).then(({ data }) => { + if (data.response.numFound === 0) { + this.$router.push({ name: 'NotFound' }); + } else { + this.activity = data.response.docs[0]; - if ('description_narrative' in this.activity) { - if ( - 'description_narrative_xml_lang' in - this.activity - ) { - for (const narrativeKey in this.activity - .description_narrative_xml_lang) { - if ( - this.activity - .description_narrative_xml_lang[ - narrativeKey - ] === this.global.state.language - ) { - const langDescriptionNarrative = - this.activity.description_narrative[ - narrativeKey - ]; - this.activity.description_narrative.splice( - narrativeKey, - 1 - ); - this.activity.description_narrative.unshift( - langDescriptionNarrative - ); - break; - } + if ('description_narrative' in this.activity) { + if ('description_narrative_xml_lang' in this.activity) { + for (const narrativeKey in this.activity + .description_narrative_xml_lang) { + if ( + this.activity.description_narrative_xml_lang[narrativeKey] === + this.global.state.language + ) { + const langDescriptionNarrative = + this.activity.description_narrative[narrativeKey]; + this.activity.description_narrative.splice(narrativeKey, 1); + this.activity.description_narrative.unshift( + langDescriptionNarrative + ); + break; } } - this.activity.description_narrative = - this.activity.description_narrative[0]; - } else { - this.activity.description_narrative = this.$t( - 'message.description_not_provided' - ); } - if ('title_narrative' in this.activity) { - if ('title_narrative_xml_lang' in this.activity) { - for (const narrativeKey in this.activity - .title_narrative_xml_lang) { - if ( - this.activity.title_narrative_xml_lang[ - narrativeKey - ] === this.global.state.language - ) { - const langTitleNarrative = - this.activity.title_narrative[ - narrativeKey - ]; - this.activity.title_narrative.splice( - narrativeKey, - 1 - ); - this.activity.title_narrative.unshift( - langTitleNarrative - ); - break; - } + this.activity.description_narrative = + this.activity.description_narrative[0]; + } else { + this.activity.description_narrative = this.$t( + 'message.description_not_provided' + ); + } + if ('title_narrative' in this.activity) { + if ('title_narrative_xml_lang' in this.activity) { + for (const narrativeKey in this.activity.title_narrative_xml_lang) { + if ( + this.activity.title_narrative_xml_lang[narrativeKey] === + this.global.state.language + ) { + const langTitleNarrative = + this.activity.title_narrative[narrativeKey]; + this.activity.title_narrative.splice(narrativeKey, 1); + this.activity.title_narrative.unshift(langTitleNarrative); + break; } } - this.activity.title_narrative = - this.activity.title_narrative[0]; - } else { - this.activity.title_narrative = this.$t( - 'message.title_not_provided' - ); } - if ('reporting_org_narrative' in this.activity) { - if ( - 'reporting_org_narrative_xml_lang' in - this.activity - ) { - for (const narrativeKey in this.activity - .reporting_org_narrative_xml_lang) { - if ( - this.activity - .reporting_org_narrative_xml_lang[ - narrativeKey - ] === this.global.state.language - ) { - const langReportingOrgNarrative = - this.activity - .reporting_org_narrative[ - narrativeKey - ]; - this.activity.reporting_org_narrative.splice( - narrativeKey, - 1 - ); - this.activity.reporting_org_narrative.unshift( - langReportingOrgNarrative - ); - break; - } + this.activity.title_narrative = this.activity.title_narrative[0]; + } else { + this.activity.title_narrative = this.$t('message.title_not_provided'); + } + if ('reporting_org_narrative' in this.activity) { + if ('reporting_org_narrative_xml_lang' in this.activity) { + for (const narrativeKey in this.activity + .reporting_org_narrative_xml_lang) { + if ( + this.activity.reporting_org_narrative_xml_lang[narrativeKey] === + this.global.state.language + ) { + const langReportingOrgNarrative = + this.activity.reporting_org_narrative[narrativeKey]; + this.activity.reporting_org_narrative.splice(narrativeKey, 1); + this.activity.reporting_org_narrative.unshift( + langReportingOrgNarrative + ); + break; } } - this.activity.reporting_org_narrative = - this.activity.reporting_org_narrative[0]; - } else { - this.activity.reporting_org_narrative = this.$t( - 'message.name_not_provided' - ); } - if ('participating_org_narrative' in this.activity) { - if ( - 'participating_org_narrative_xml_lang' in - this.activity - ) { - let orderedParticipatingOrgs = []; - for (const narrativeKey in this.activity - .participating_org_narrative_xml_lang) { - if ( - this.activity - .participating_org_narrative_xml_lang[ - narrativeKey - ] === this.global.state.language - ) { - orderedParticipatingOrgs.push( - this.activity - .participating_org_narrative[ - narrativeKey - ] - ); - } + this.activity.reporting_org_narrative = + this.activity.reporting_org_narrative[0]; + } else { + this.activity.reporting_org_narrative = this.$t( + 'message.name_not_provided' + ); + } + if ('participating_org_narrative' in this.activity) { + if ('participating_org_narrative_xml_lang' in this.activity) { + let orderedParticipatingOrgs = []; + for (const narrativeKey in this.activity + .participating_org_narrative_xml_lang) { + if ( + this.activity.participating_org_narrative_xml_lang[ + narrativeKey + ] === this.global.state.language + ) { + orderedParticipatingOrgs.push( + this.activity.participating_org_narrative[narrativeKey] + ); } - for (const narrativeKey in this.activity - .participating_org_narrative_xml_lang) { - if ( - this.activity - .participating_org_narrative_xml_lang[ - narrativeKey - ] !== this.global.state.language - ) { - orderedParticipatingOrgs.push( - this.activity - .participating_org_narrative[ - narrativeKey - ] - ); - } + } + for (const narrativeKey in this.activity + .participating_org_narrative_xml_lang) { + if ( + this.activity.participating_org_narrative_xml_lang[ + narrativeKey + ] !== this.global.state.language + ) { + orderedParticipatingOrgs.push( + this.activity.participating_org_narrative[narrativeKey] + ); } - this.activity.participating_org_narrative = - orderedParticipatingOrgs; } - } else { - this.activity.participating_org_narrative = [ - this.$t('message.not_provided'), - ]; + this.activity.participating_org_narrative = orderedParticipatingOrgs; } + } else { + this.activity.participating_org_narrative = [ + this.$t('message.not_provided'), + ]; + } - this.dates = { - plannedStart: null, - actualStart: null, - plannedEnd: null, - actualEnd: null, - }; + this.dates = { + plannedStart: null, + actualStart: null, + plannedEnd: null, + actualEnd: null, + }; - const activityDateTypes = { - planned_start: '1', - actual_start: '2', - planned_end: '3', - actual_end: '4', - }; + const activityDateTypes = { + planned_start: '1', + actual_start: '2', + planned_end: '3', + actual_end: '4', + }; - for (const key in this.activity['activity_date_type']) { - const dt = - this.activity['activity_date_iso_date'][key]; + for (const key in this.activity['activity_date_type']) { + const dt = this.activity['activity_date_iso_date'][key]; - switch (this.activity['activity_date_type'][key]) { - case activityDateTypes.planned_start: - this.dates['plannedStart'] = dt; - break; - case activityDateTypes.actual_start: - this.dates['actualStart'] = dt; - break; - case activityDateTypes.planned_end: - this.dates['plannedEnd'] = dt; - break; - case activityDateTypes.actual_end: - this.dates['actualEnd'] = dt; - break; - } + switch (this.activity['activity_date_type'][key]) { + case activityDateTypes.planned_start: + this.dates['plannedStart'] = dt; + break; + case activityDateTypes.actual_start: + this.dates['actualStart'] = dt; + break; + case activityDateTypes.planned_end: + this.dates['plannedEnd'] = dt; + break; + case activityDateTypes.actual_end: + this.dates['actualEnd'] = dt; + break; } + } - const titleEl = document.querySelector('head title'); - titleEl.textContent = `${this.activity.title_narrative} - IATI Datastore Search`; + const titleEl = document.querySelector('head title'); + titleEl.textContent = `${this.activity.title_narrative} - IATI Datastore Search`; - const descEl = document.querySelector( - 'head meta[name="description"]' - ); - descEl.setAttribute( - 'content', - `IATI identifier: ${this.activity.iati_identifier}, ` + - `Publisher: ${this.activity.reporting_org_narrative}, ` + - `Description: ${this.activity.description_narrative}, ` + - `Participating organisations: ${this.activity.participating_org_narrative}` - ); - } - }); + const descEl = document.querySelector('head meta[name="description"]'); + descEl.setAttribute( + 'content', + `IATI identifier: ${this.activity.iati_identifier}, ` + + `Publisher: ${this.activity.reporting_org_narrative}, ` + + `Description: ${this.activity.description_narrative}, ` + + `Participating organisations: ${this.activity.participating_org_narrative}` + ); + } + }); }, }, };