Skip to content

Commit

Permalink
[SDPA-3491] publication author field bug fix. (#605)
Browse files Browse the repository at this point in the history
* [SDPA-3491] Added fix for apublication authors name and showing multiple authors in authorinfo, print & storybook.
  • Loading branch information
MdNadimHossain authored Dec 2, 2019
1 parent 1330112 commit 468f2c8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions examples/vic-gov-au/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ require('dotenv').config()

process.env.DEBUG = 'nuxt:*' // display nuxt.js logs
process.env.APP_ROOT_PATH = '.' // Set the example app root path, for this example app config only.
process.env.CONTENT_API_SERVER = 'http://nginx-php-content-vic-pr-752.lagoon.vicsdp.amazee.io/'

export default {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ export default {
RplDescriptionList
},
props: {
author: String,
author: Array,
date: String,
copyright: String,
locale: { default: 'en-au', type: String }
},
computed: {
informationListing () {
const terms = []
if (this.author) {
terms.push({ term: 'Author', description: this.author })
const pluralize = require('pluralize')
if (this.author && this.author.length > 0) {
terms.push({ term: pluralize('Author', this.author.length), description: this.author.join(', ') })
}
if (this.date) {
terms.push({ term: 'Date', description: this.formatDate(this.date, 'MMMM YYYY') })
Expand Down
2 changes: 1 addition & 1 deletion packages/components/Organisms/Publication/stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ storiesOf('Organisms/Publication', module)
/>`,
props: {
author: {
default: text('Author', 'Department of Premier and Cabinet')
default: ['Department of Premier and Cabinet']
},
date: {
default: text('Date', '2018-03-23T09:00:00.000+10:00')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ export default {
},
publishingInfo () {
if (this.publication.type === 'node--publication') {
const author = this.publication.field_publication_authors && this.publication.field_publication_authors.length > 0 ? this.publication.field_publication_authors.join(', ') : ''
const authorsName = this.publication.field_publication_authors ? this.publication.field_publication_authors : ''
const author = authorsName && authorsName.length > 0 ? authorsName.map((authors) => authors.name) : []
const date = this.publication.field_publication_date
const copyright = this.publication.field_license_type ? this.publication.field_license_type.description : ''
return (author || date || copyright) ? { author, date, copyright } : null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default {
computed: {
publishingInfo () {
if (this.page.type === 'node--publication') {
const author = this.page.field_publication_authors && this.page.field_publication_authors.length > 0 ? this.page.field_publication_authors.join(', ') : ''
const authorsName = this.page.field_publication_authors ? this.page.field_publication_authors : ''
const author = authorsName && authorsName.length > 0 ? authorsName.map((authors) => authors.name) : []
const date = this.page.field_publication_date
const copyright = this.page.field_license_type ? this.page.field_license_type.description : ''
return (author || date || copyright) ? { author, date, copyright } : null
Expand Down
3 changes: 2 additions & 1 deletion packages/ripple-nuxt-tide/modules/publication/tide.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ module.exports = {
'field_landing_page_component',
'field_landing_page_component.field_paragraph_accordion',
'field_landing_page_component.field_complex_image_media',
'field_landing_page_component.field_complex_image_media.field_media_image'
'field_landing_page_component.field_complex_image_media.field_media_image',
'field_publication_authors'
],
publicationPage: [
'field_node_primary_site',
Expand Down

0 comments on commit 468f2c8

Please sign in to comment.