translate poll types and predefined answers

This commit is contained in:
jelhan 2014-10-24 00:39:07 +02:00
parent ec79f68f5c
commit 57b46a03f1
6 changed files with 67 additions and 42 deletions

View file

@ -8,13 +8,13 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
pollTypes: function(){
return [
Ember.Object.create({
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id : "FindADate",
label : "Find a date"
labelTranslation : "pollTypes.findADate.label"
}),
Ember.Object.create({
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id : "MakeAPoll",
label : "Make a poll"
labelTranslation : "pollTypes.makeAPoll.label"
})
];
}.property(),

View file

@ -20,41 +20,46 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
answerTypes: function() {
return [
Ember.Object.create({
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id : "YesNo",
label : "yes, no",
labelTranslation : "answerTypes.yesNo.label",
answers : [
{
label: "yes",
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id: "yes",
labelTranslation: "answerTypes.yes.label",
icon: "glyphicon glyphicon-thumbs-up"
},
{
label: "no",
}),
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id: "no",
labelTranslation: "answerTypes.no.label",
icon: "glyphicon glyphicon-thumbs-down"
}
})
]
}),
Ember.Object.create({
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id : "YesNoMaybe",
label : "yes, no, maybe",
labelTranslation : "answerTypes.yesNoMaybe.label",
answers : [
{
label: "yes",
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id: "yes",
labelTranslation: "answerTypes.yes.label",
icon: "glyphicon glyphicon-thumbs-up"
},
{
label: "maybe",
}),
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id: "maybe",
labelTranslation: "answerTypes.maybe.label",
icon: "glyphicon glyphicon-hand-right"
},
{
label: "no",
}),
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id: "no",
labelTranslation: "answerTypes.no.label",
icon: "glyphicon glyphicon-thumbs-down"
}
})
]
}),
Ember.Object.create({
Em.Object.extend(Em.I18n.TranslateableProperties, {}).create({
id : "FreeText",
label : "free text",
labelTranslation : "answerTypes.freeText.label",
answers : []
})
];

View file

@ -1,5 +1,11 @@
export default {
"en": {
"answerTypes.yes.label": "yes",
"answerTypes.no.label": "no",
"answerTypes.maybe.label": "maybe",
"answerTypes.freeText.label": "free text",
"answerTypes.yesNo.label": "yes, no",
"answerTypes.yesNoMaybe.label": "yes, no, maybe",
"create.index.input.pollType.label": "poll type",
"create.index.input.pollType.prompt": "Please select a poll type",
"create.meta.input.title.label": "title",
@ -11,6 +17,7 @@ export default {
"create.options.add-another-option": "add another option",
"create.options.error.notEnoughOptions": "you must enter atleast two options",
"create.options.defineTimes.label": "define times?",
"create.options.input.moreOptions.label": "add another option",
"create.options-datetime.datetimes.label": "datetimes",
"create.options-datetime.datetimes.hint": "Hours and minutes have to be seperated by a color (e.g. 12:30). You have to enter atleast one valid time for each date.",
"create.options-datetime.more-inputs": "more inputs for time",
@ -57,9 +64,17 @@ export default {
"poll.input.newUserName.placeholder": "Enter your name...",
"poll.save": "save",
"poll.share": "Share the link and invite other people to participate in your poll.",
"poll.share.notice": "Everyone who knows the link could read the data. If your poll consists private data you may only share the link via encrypted channels like PGP encrypted email or instant messaging with OTR."
"poll.share.notice": "Everyone who knows the link could read the data. If your poll consists private data you may only share the link via encrypted channels like PGP encrypted email or instant messaging with OTR.",
"pollTypes.findADate.label": "Find a date",
"pollTypes.makeAPoll.label": "Make a poll",
},
"de": {
"answerTypes.yes.label": "ja",
"answerTypes.no.label": "nein",
"answerTypes.maybe.label": "vielleicht",
"answerTypes.freeText.label": "Freitext",
"answerTypes.yesNo.label": "ja, nein",
"answerTypes.yesNoMaybe.label": "ja, nein, vielleicht",
"create.index.input.pollType.label": "Umfragetyp",
"create.index.input.pollType.prompt": "Bitte wähle den Typ deiner Umfrage",
"create.meta.input.title.label": "de: title",
@ -71,6 +86,7 @@ export default {
"create.options.add-another-option": "Mehr Optionen",
"create.options.error.notEnoughOptions": "mindestens zwei Optionen",
"create.options.defineTimes.label": "de: define times?",
"create.options.input.moreOptions.label": "de: add another option",
"create.options-datetime.datetimes.label": "de: datetimes",
"create.options-datetime.datetimes.hint": "de: Hours and minutes have to be seperated by a color (e.g. 12:30). You have to enter atleast one valid time for each date.",
"create.options-datetime.more-inputs": "Mehr Zeiten eingeben",
@ -117,6 +133,8 @@ export default {
"poll.input.newUserName.placeholder": "de: Enter your name...",
"poll.save": "speichern",
"poll.share": "Gib den Link weiter und lade so Andere zu deiner Umfrage ein.",
"poll.share.notice": "Jeder, der den Link kennt, kann die Daten deiner Umfrage lesen. Falls deine Umfrage private Daten enthält, überlege dir, ob du ihn nur per verschlüsselter Mail oder Chat mit End-to-End-Verschlüsselung weitergeben möchtest."
"poll.share.notice": "Jeder, der den Link kennt, kann die Daten deiner Umfrage lesen. Falls deine Umfrage private Daten enthält, überlege dir, ob du ihn nur per verschlüsselter Mail oder Chat mit End-to-End-Verschlüsselung weitergeben möchtest.",
"pollTypes.findADate.label": "Einen Termin finden",
"pollTypes.makeAPoll.label": "Eine Umfrage erstellen",
}
};

View file

@ -16,13 +16,14 @@
{{error-field enoughOptions}}
{{/if}}
{{/input}}
<div class="form-group">
<button {{action "moreOptions" target="view"}} class="btn btn-default"> add another option </button>
</div>
{{/form-for}}
<div class="form-group">
<button {{action "moreOptions" target="view"}} class="btn btn-default"> {{t 'create.options.input.moreOptions.label'}} </button>
</div>
{{#form-for controller}}
{{submit 'next'}}
{{/form-for}}
{{/if}}

View file

@ -67,7 +67,7 @@
<div class="radio">
<label>
{{radio-button checked=newUserSelection.value value=answer}}
<span {{bind-attr class="answer.label"}}>
<span {{bind-attr class="answer.id"}}>
<span {{bind-attr class="answer.icon"}}></span>
{{answer.label}}
</span>

View file

@ -1,10 +1,11 @@
export default Ember.View.extend({
title: '',
actions: {
moreOptions: function(){
// create new Option
this.get('controller.model.options').pushObject({title: ''});
}
}
title: '',
actions: {
moreOptions: function(){
console.log('runs');
// create new Option
this.get('controller.model.options').pushObject({title: ''});
}
}
});