Skip to content

Commit

Permalink
feat: Refactor examples, add Français locale
Browse files Browse the repository at this point in the history
Proposal so one could feature-flag on "examples/" to work on styling
and a clear separation between example and the application.

PR: #313
  • Loading branch information
renoirb authored and clarkdo committed Apr 24, 2018
1 parent 301a74e commit f3881ec
Show file tree
Hide file tree
Showing 31 changed files with 606 additions and 329 deletions.
2 changes: 1 addition & 1 deletion client/components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class Navbar extends Vue {
@MenuGetter menus
async beforeMount () {
let {data: menus} = await axios.get('/hpi/menus')
let {data: menus} = await axios.get('/hpi/ui/menu')
if (Array.isArray(menus) && menus.length) {
this.$store.dispatch('menu/addAll', this.translateMenus(menus))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
</el-col>
<el-col :xs="24" :sm="{span: 10, offset: 2}">
<el-form-item :label="$t('activity.area')" prop="region">
<el-select v-model="formData.region" :placeholder="$t('activity.holder.area')">
<el-option :label="$t('activity.city.sh')" value="shanghai"></el-option>
<el-option :label="$t('activity.city.bj')" value="beijing"></el-option>
<el-select v-model="formData.region" filterable allow-create :placeholder="$t('activity.holder.area')">
<el-option
v-for="item in cities"
v-if="!item.disabled"
:key="item.label"
:label="$t(item.label)"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
Expand Down Expand Up @@ -112,7 +117,7 @@ const ExampleGetter = namespace('examples/index', Getter)
default () {
return {
account: '',
region: '',
region: 'activity.city.ly',
date1: '',
date2: '',
delivery: false,
Expand Down Expand Up @@ -161,8 +166,18 @@ const ExampleGetter = namespace('examples/index', Getter)
export default class NewActivity extends Vue {
@ExampleGetter labels
@ExampleGetter organizers
@ExampleGetter cities
submit (formName) {
/**
* Example of how we can see each field value
*/
let formData = {}
for (const v of Object.keys(this.formData)) {
formData[v] = this.formData[v]
}
console.log('NewActivity submit formData', formData)
this.$refs[formName].validate((valid) => {
if (valid) {
this.$message.success(this.$t('activity.success'))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
91 changes: 4 additions & 87 deletions client/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,96 +8,13 @@
"captchaPlaceholder": "Captcha",
"login": "Login"
},
"activity": {
"title": {
"create": "Create Activity"
},
"account": "Account",
"date": "Date",
"type": "Type",
"area": "Area",
"priority": "Priority",
"organizer": "Organizer",
"desc": "Description",
"tag": "Tag",
"rate": "Rate",
"create": "Create",
"reset": "Reset",
"holder": {
"area": "Pls select area",
"tag": "Pls select tag",
"date": "Pls Select date",
"time": "Pls Select time"
},
"label": {
"tag": {
"st": "Ticket",
"reduction": "Discount",
"points": "Points"
}
},
"city": {
"sh": "Shanghai",
"bj": "Beijing"
},
"instDist": "JD",
"price": "Discount",
"rights": "Rights",
"medium": "Medium",
"high": "High",
"rule": {
"account": {
"required": "Pls input account name",
"length": "Length is no longer than 6"
},
"region": {
"required": "Pls select region"
},
"date1": {
"required": "Pls select date"
},
"date2": {
"required": "Pls select time"
},
"type": {
"required": "Pls select at least on type"
},
"priority": {
"required": "Pls select priority"
},
"rate": {
"required": "Pls select rate"
},
"desc": {
"required": "Pls input description"
}
},
"success": "Create successfully!",
"failed": "Create failure!"
},
"example": {
"title1": "Button, Counter, Radio (City is a Vuex demo)",
"title2": "Radio, Checkbox, Input, Multi-Select",
"title3": "Cascader, Switch, Slider",
"title4": "Data Form",
"food": "Food",
"counter": "Counter",
"city": "City",
"inPh": "Please input",
"selPh": "Please select",
"pop": "Popover"
},
"nav": {
"home": "Home",
"activity": "Demo",
"demo": "Components",
"list": "Table List",
"create": "Creation Form",
"charts": "Charts",
"about": "About"
"home": "Home"
},
"head": {
"pwd": "Password",
"exit": "Exit"
}
},
"tagline":
"Application boilerplate based on Vue.js 2.x, Koa 2.x, Element-UI, Axios, Vue i18n and Nuxt.js"
}
96 changes: 96 additions & 0 deletions client/locales/examples/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"login": {
"userPlaceholder": "User Name (admin)",
"pwdPlaceholder": "Password (admin)"
},
"activity": {
"title": {
"create": "Create Activity"
},
"account": "Account",
"date": "Date",
"type": "Type",
"area": "Area",
"priority": "Priority",
"organizer": "Organizer",
"desc": "Description",
"tag": "Tag",
"rate": "Rate",
"create": "Create",
"reset": "Reset",
"holder": {
"area": "Pls select area",
"tag": "Pls select tag",
"date": "Pls Select date",
"time": "Pls Select time"
},
"label": {
"tag": {
"st": "Ticket",
"reduction": "Discount",
"points": "Points"
}
},
"city": {
"sh": "ShangHai",
"bj": "BeiJing",
"gz": "GuangZhou",
"ly": "Lyster",
"sz": "ShenZhen"
},
"instDist": "JD",
"price": "Discount",
"rights": "Rights",
"medium": "Medium",
"high": "High",
"rule": {
"account": {
"required": "Pls input account name",
"length": "Length is no longer than 6"
},
"region": {
"required": "Pls select region"
},
"date1": {
"required": "Pls select date"
},
"date2": {
"required": "Pls select time"
},
"type": {
"required": "Pls select at least on type"
},
"priority": {
"required": "Pls select priority"
},
"rate": {
"required": "Pls select rate"
},
"desc": {
"required": "Pls input description"
}
},
"success": "Create successfully!",
"failed": "Create failure!"
},
"example": {
"title1": "Button, Counter, Radio (City is a Vuex demo)",
"title2": "Radio, Checkbox, Input, Multi-Select",
"title3": "Cascader, Switch, Slider",
"title4": "Data Form",
"food": "Food",
"counter": "Counter",
"city": "City",
"inPh": "Please input",
"selPh": "Please select",
"pop": "Popover"
},
"nav": {
"kitchenSink": "Kitchen Sink examples",
"demo": "Components",
"list": "Table List",
"create": "Creation Form",
"charts": "Charts",
"about": "About"
}
}
97 changes: 97 additions & 0 deletions client/locales/examples/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"login": {
"userPlaceholder": "Nom d’utilisateur (admin)",
"pwdPlaceholder": "Mot de passe (admin)"
},
"activity": {
"title": {
"create": "Créer une activité"
},
"account": "Compte",
"date": "Date",
"type": "Type",
"area": "Région",
"priority": "Priorité",
"organizer": "Organisateur",
"desc": "Description",
"tag": "Étiquette",
"rate": "Appréciation",
"create": "Créer",
"reset": "Réinitialiser",
"holder": {
"area": "Choisir une région",
"tag": "Choisir une étiquette",
"date": "Choisir une date",
"time": "Choisir un moment"
},
"label": {
"tag": {
"st": "Billet",
"reduction": "Rabais",
"points": "Points"
}
},
"city": {
"sh": "ShangHai",
"bj": "BeiJing",
"gz": "GuangZhou",
"ly": "Lyster",
"sz": "ShenZhen"
},
"instDist": "JD",
"price": "Rabais",
"rights": "Droit",
"medium": "Médium",
"high": "Élevé",
"rule": {
"account": {
"required": "Veuillez spécifier un nom d’utilisateur",
"length": "Il y a un maximum de 6 caractères"
},
"region": {
"required": "Veuillez spécifier une région"
},
"date1": {
"required": "Veuillez spécifier une date"
},
"date2": {
"required": "Veuillez spécifier un moment"
},
"type": {
"required": "Il faut au moins avoir choisi un Type"
},
"priority": {
"required": "Veuillez choisir une priorité"
},
"rate": {
"required": "Vous devez absolument donner votre degré d’appréciation"
},
"desc": {
"required": "Veuillez entrer une description"
}
},
"success": "L’Activité crée!",
"failed": "Il a été impossible de créer l’activité, désolé!"
},
"example": {
"title1":
"Button, Counter, Radio (Le champ City est un demo d’usage de Vuex)",
"title2": "Radio, Checkbox, Input, Multi-Select",
"title3": "Cascader, Switch, Slider",
"title4": "Formulaire de données exemple",
"food": "Nourriture",
"counter": "Compteur",
"city": "Ville",
"inPh": "Veuillez entrer",
"selPh": "Veuillez choisir",
"pop": "Mise en avant"
},
"nav": {
"kitchenSink": "Examples dans Kitchen Sink",
"demo": "Components",
"list": "Données tabulaires",
"create": "Forumlaire de création",
"charts": "Chartes et graphiques",
"about": "À propos"
}
}
Loading

0 comments on commit f3881ec

Please sign in to comment.