Localise categories

This commit is contained in:
Matt Rider 2019-08-14 13:57:39 +02:00
parent f711a9c288
commit ee93efd6d9
9 changed files with 67 additions and 16 deletions

View File

@ -10,4 +10,4 @@ type Category {
posts: [Post]! @relation(name: "CATEGORIZED", direction: "IN") posts: [Post]! @relation(name: "CATEGORIZED", direction: "IN")
postCount: Int! @cypher(statement: "MATCH (this)<-[:CATEGORIZED]-(r:Post) RETURN COUNT(r)") postCount: Int! @cypher(statement: "MATCH (this)<-[:CATEGORIZED]-(r:Post) RETURN COUNT(r)")
} }

View File

@ -180,13 +180,13 @@ import Factory from './factories'
f.create('Category', { f.create('Category', {
id: 'cat1', id: 'cat1',
name: 'Just For Fun', name: 'Just For Fun',
slug: 'justforfun', slug: 'just-for-fun',
icon: 'smile', icon: 'smile',
}), }),
f.create('Category', { f.create('Category', {
id: 'cat2', id: 'cat2',
name: 'Happyness & Values', name: 'Happiness & Values',
slug: 'happyness-values', slug: 'happiness-values',
icon: 'heart-o', icon: 'heart-o',
}), }),
f.create('Category', { f.create('Category', {
@ -204,13 +204,13 @@ import Factory from './factories'
f.create('Category', { f.create('Category', {
id: 'cat5', id: 'cat5',
name: 'Animal Protection', name: 'Animal Protection',
slug: 'animalprotection', slug: 'animal-protection',
icon: 'paw', icon: 'paw',
}), }),
f.create('Category', { f.create('Category', {
id: 'cat6', id: 'cat6',
name: 'Humanrights Justice', name: 'Human Rights & Justice',
slug: 'humanrights-justice', slug: 'human-rights-justice',
icon: 'balance-scale', icon: 'balance-scale',
}), }),
f.create('Category', { f.create('Category', {
@ -246,19 +246,19 @@ import Factory from './factories'
f.create('Category', { f.create('Category', {
id: 'cat12', id: 'cat12',
name: 'IT, Internet & Data Privacy', name: 'IT, Internet & Data Privacy',
slug: 'it-internet-dataprivacy', slug: 'it-internet-data-privacy',
icon: 'mouse-pointer', icon: 'mouse-pointer',
}), }),
f.create('Category', { f.create('Category', {
id: 'cat13', id: 'cat13',
name: 'Art, Curlure & Sport', name: 'Art, Culture & Sport',
slug: 'art-culture-sport', slug: 'art-culture-sport',
icon: 'paint-brush', icon: 'paint-brush',
}), }),
f.create('Category', { f.create('Category', {
id: 'cat14', id: 'cat14',
name: 'Freedom of Speech', name: 'Freedom of Speech',
slug: 'freedomofspeech', slug: 'freedom-of-speech',
icon: 'bullhorn', icon: 'bullhorn',
}), }),
f.create('Category', { f.create('Category', {
@ -270,7 +270,7 @@ import Factory from './factories'
f.create('Category', { f.create('Category', {
id: 'cat16', id: 'cat16',
name: 'Global Peace & Nonviolence', name: 'Global Peace & Nonviolence',
slug: 'globalpeace-nonviolence', slug: 'global-peace-nonviolence',
icon: 'angellist', icon: 'angellist',
}), }),
]) ])

View File

@ -43,11 +43,13 @@ c.updatedAt = category.updatedAt.`$date`
MATCH (c:Category) MATCH (c:Category)
WHERE (c.icon = "categories-justforfun") WHERE (c.icon = "categories-justforfun")
SET c.icon = 'smile' SET c.icon = 'smile'
SET c.slug = 'just-for-fun'
; ;
MATCH (c:Category) MATCH (c:Category)
WHERE (c.icon = "categories-luck") WHERE (c.icon = "categories-luck")
SET c.icon = 'heart-o' SET c.icon = 'heart-o'
SET c.slug = 'happiness-values'
; ;
MATCH (c:Category) MATCH (c:Category)
@ -63,11 +65,14 @@ SET c.icon = 'tree'
MATCH (c:Category) MATCH (c:Category)
WHERE (c.icon = "categories-animal-justice") WHERE (c.icon = "categories-animal-justice")
SET c.icon = 'paw' SET c.icon = 'paw'
SET c.slug = 'animal-protection'
; ;
MATCH (c:Category) MATCH (c:Category)
WHERE (c.icon = "categories-human-rights") WHERE (c.icon = "categories-human-rights")
SET c.icon = 'balance-scale' SET c.icon = 'balance-scale'
SET c.slug = 'human-rights-justice'
; ;
MATCH (c:Category) MATCH (c:Category)
@ -98,6 +103,7 @@ SET c.icon = 'flash'
MATCH (c:Category) MATCH (c:Category)
WHERE (c.icon = "categories-internet") WHERE (c.icon = "categories-internet")
SET c.icon = 'mouse-pointer' SET c.icon = 'mouse-pointer'
SET c.slug = 'it-internet-data-privacy'
; ;
MATCH (c:Category) MATCH (c:Category)
@ -108,6 +114,7 @@ SET c.icon = 'paint-brush'
MATCH (c:Category) MATCH (c:Category)
WHERE (c.icon = "categories-freedom-of-speech") WHERE (c.icon = "categories-freedom-of-speech")
SET c.icon = 'bullhorn' SET c.icon = 'bullhorn'
SET c.slug = 'freedom-of-speech'
; ;
MATCH (c:Category) MATCH (c:Category)
@ -118,4 +125,5 @@ SET c.icon = 'shopping-cart'
MATCH (c:Category) MATCH (c:Category)
WHERE (c.icon = "categories-peace") WHERE (c.icon = "categories-peace")
SET c.icon = 'angellist' SET c.icon = 'angellist'
SET c.slug = 'global-peace-nonviolence'
; ;

View File

@ -117,7 +117,7 @@ MERGE (e:EmailAddress {
verifiedAt: toString(datetime()) verifiedAt: toString(datetime())
}) })
MERGE (e)-[:BELONGS_TO]->(u) MERGE (e)-[:BELONGS_TO]->(u)
MERGE (u)<-[:PRIMARY_EMAIL]-(e) MERGE (u)-[:PRIMARY_EMAIL]->(e)
WITH u, user, user.badgeIds AS badgeIds WITH u, user, user.badgeIds AS badgeIds
UNWIND badgeIds AS badgeId UNWIND badgeIds AS badgeId
MATCH (b:Badge {id: badgeId}) MATCH (b:Badge {id: badgeId})

View File

@ -10,7 +10,7 @@
:disabled="isDisabled(category.id)" :disabled="isDisabled(category.id)"
> >
<ds-icon :name="category.icon" /> <ds-icon :name="category.icon" />
{{ category.name }} {{ $t(`contribution.category.name.${category.slug}`) }}
</ds-button> </ds-button>
</ds-flex-item> </ds-flex-item>
</div> </div>
@ -88,6 +88,7 @@ export default {
return CategoryQuery() return CategoryQuery()
}, },
result(result) { result(result) {
console.log('result', result)
this.categories = result.data.Category this.categories = result.data.Category
}, },
}, },

View File

@ -5,7 +5,7 @@
<ds-heading tag="h4">{{ $t('filter-posts.categories.header') }}</ds-heading> <ds-heading tag="h4">{{ $t('filter-posts.categories.header') }}</ds-heading>
<ds-space margin-bottom="large" /> <ds-space margin-bottom="large" />
</ds-flex> </ds-flex>
<ds-flex> <ds-flex :gutter="{ lg: 'small' }">
<ds-flex-item <ds-flex-item
:width="{ base: '100%', sm: '100%', md: '100%', lg: '5%' }" :width="{ base: '100%', sm: '100%', md: '100%', lg: '5%' }"
class="categories-menu-item" class="categories-menu-item"
@ -47,7 +47,9 @@
</ds-flex-item> </ds-flex-item>
<ds-flex> <ds-flex>
<ds-flex-item class="categories-menu-item"> <ds-flex-item class="categories-menu-item">
<label class="category-labels">{{ category.name }}</label> <label class="category-labels">
{{ $t(`contribution.category.name.${category.slug}`) }}
</label>
</ds-flex-item> </ds-flex-item>
<ds-space margin-bottom="xx-large" /> <ds-space margin-bottom="xx-large" />
</ds-flex> </ds-flex>

View File

@ -4,7 +4,7 @@ export default () => {
return gql(`{ return gql(`{
Category { Category {
id id
name slug
icon icon
} }
}`) }`)

View File

@ -436,6 +436,26 @@
"cry": "Zum Weinen", "cry": "Zum Weinen",
"angry": "Verärgert", "angry": "Verärgert",
"emoted": "angegeben" "emoted": "angegeben"
},
"category": {
"name": {
"freedom-of-speech": "Redefreiheit",
"consumption-sustainability": "Verbrauch & Nachhaltigkeit",
"global-peace-nonviolence": "Globaler Frieden & Gewaltlosigkeit",
"just-for-fun": "Nur zum Spaß",
"happiness-values": "Glück & Werte",
"health-wellbeing": "Gesundheit & Wohlbefinden",
"environment-nature": "Umwelt & Natur",
"animal-protection": "Schutz der Tiere",
"human-rights-justice": "Menschenrechte & Gerechtigkeit",
"education-sciences": "Bildung & Wissenschaft",
"cooperation-development": "Zusammenarbeit & Entwicklung",
"democracy-politics": "Demokratie & Politik",
"economy-finances": "Wirtschaft & Finanzen",
"energy-technology": "Energie & Technologie",
"it-internet-data-privacy": "IT, Internet & Datenschutz",
"art-culture-sport": "Kunst, Kultur & Sport"
}
} }
}, },
"changelog": { "changelog": {

View File

@ -436,6 +436,26 @@
"cry": "Cry", "cry": "Cry",
"angry": "Angry", "angry": "Angry",
"emoted": "emoted" "emoted": "emoted"
},
"category": {
"name": {
"freedom-of-speech": "Freedom of Speech",
"consumption-sustainability": "Consumption & Sustainability",
"global-peace-nonviolence": "Global Peace & Nonviolence",
"just-for-fun": "Just for Fun",
"happiness-values": "Happiness & Values",
"health-wellbeing": "Health & Wellbeing",
"environment-nature": "Environment & Nature",
"animal-protection": "Animal Protection",
"human-rights-justice": "Human Rights & Justice",
"education-sciences": "Education & Sciences",
"cooperation-development": "Cooperation & Development",
"democracy-politics": "Democracy & Politics",
"economy-finances": "Economy & Finances",
"energy-technology": "Energy & Technology",
"it-internet-data-privacy": "IT, Internet & Data Privacy",
"art-culture-sport": "Art, Culture, & Sport"
}
} }
}, },
"changelog": { "changelog": {