visibilty as a view property + missing translations

This commit is contained in:
jelhan 2014-10-23 17:55:04 +02:00
parent a4eb466099
commit 533f70b5ee
4 changed files with 49 additions and 31 deletions

View file

@ -216,7 +216,7 @@ export default Ember.ObjectController.extend(Ember.Validations.Mixin, {
}
}
},
/*
* have to manually rerun validation when encryption key is present in model
* otherwise ember-validation is not using correct values for properties in

View file

@ -54,6 +54,7 @@ export default {
"index.hoster.text": "You don't have to trust our server. You could easily host croodle yourself. All you need is a web space with PHP and SSL encryption enabled. You find the source code and installation instructions on <a href=\"https://github.com/jelhan/croodle\">GitHub</a>.",
"poll.created-time": "created on {{creationDate}}",
"poll.evaluation.label": "Evaluation",
"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."
@ -113,6 +114,7 @@ export default {
"index.hoster.text": "Du musst uns nicht vertrauen. Du kannst Croodle einfach auf deinem eigenen Server installieren. Ein Server mit einigen Megabyte Speicherplatz, PHP und SSL-Verschlüsselung ist ausreichend. Den Programmcode und Installationsanweisungen findest du auf <a href=\"https://github.com/jelhan/croodle\">GitHub</a>.",
"poll.created-time": "Erstellt am {{creationDate}}.",
"poll.evaluation.label": "Auswertung",
"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."

View file

@ -45,19 +45,16 @@
<tbody>
<tr class='newUser'>
{{! ToDo:
should be all together in just one form;
not in several forms for each input.
This work-around is due to a problem of
ember-forms in dealing with propertys of
handlebar each helper
}}
<td>
{{#form-for controller}}
{{input newUserName
label=" "
placeholder="Enter your name..."
}}
{{#input newUserName}}
{{input-field newUserName
placeholderTranslation="poll.input.newUserName.placeholder"
}}
{{#if view.showError}}
{{error-field newUserName}}
{{/if}}
{{/input}}
{{/form-for}}
</td>
{{#each newUserSelection in controller.newUserSelections}}
@ -112,25 +109,27 @@
{{#unless isFreeText}}
<tr class='evaluation evaluation-header'>
<td {{bind-attr colspan=fullRowColspan}}>
{{t "poll.evaluation.label"}}
{{t "poll.evaluation.label"}} <button {{action "switchEvaluationVisibility" target="view"}} class="btn btn-default"> {{view.showEvaluationLabel}} </button>
</td>
</tr>
{{#each answer in evaluation}}
<tr class='evaluation'>
<td>
{{answer.label}}
</td>
{{#each option in answer.options}}
{{#if view.showEvaluation}}
{{#each answer in evaluation}}
<tr class='evaluation'>
<td>
{{option}}
{{answer.label}}
</td>
{{/each}}
<td>&nbsp;</td>
</tr>
{{/each}}
{{#each option in answer.options}}
<td>
{{option}}
</td>
{{/each}}
<td>&nbsp;</td>
</tr>
{{/each}}
{{/if}}
{{/unless}}
</tbody>
</table>

View file

@ -1,13 +1,30 @@
export default Ember.View.extend({
showEvaluation: false,
actions: {
switchEvaluationVisibility: function() {
if (this.get('showEvaluation') === true) {
this.set('showEvaluation', false);
}
else {
this.set('showEvaluation', true);
}
}
},
didInsertElement : function(){
this._super();
Ember.run.scheduleOnce('afterRender', this, function(){
$('.user-selections-table').floatThead({});
});
$('.evaluation:not(.evaluation-header)').toggle();
$('.evaluation-header').click(function(){
$('.evaluation:not(.evaluation-header)').toggle();
});
}
},
showEvaluationLabel: function() {
if (this.get('showEvaluation')) {
return "hide";
}
else {
return "show";
}
}.property('showEvaluation')
});