Commit 1740a1d9 authored by DAVID Titouan's avatar DAVID Titouan Committed by Thomas Citharel
Browse files

issue 240 desactivation checkbox resultat public

changement du nom de l'option "resultat visible" dans password en "seul les votes sont proteges"

correction de l'ajout du js pour issue240

correction test pour desactivation dynamique du champ
parent 81922099
......@@ -137,6 +137,7 @@ if (isset($_POST['update_poll_info'])) {
$hidden = isset($_POST['hidden']) ? $inputService->filterBoolean($_POST['hidden']) : false;
if ($hidden !== $poll->hidden) {
$poll->hidden = $hidden;
$poll->results_publicly_visible = false;
$updated = true;
}
} elseif ($field === 'removePassword') {
......@@ -153,7 +154,10 @@ if (isset($_POST['update_poll_info'])) {
$poll->password_hash = PasswordHasher::hash($password);
$updated = true;
}
if ($resultsPubliclyVisible !== $poll->results_publicly_visible) {
if ($poll->password_hash == null || $poll->hidden == true){
$poll->results_publicly_visible = false;
}
if ($resultsPubliclyVisible != $poll->results_publicly_visible && $poll->password_hash != null && $poll->hidden == false) {
$poll->results_publicly_visible = $resultsPubliclyVisible;
$updated = true;
}
......
......@@ -103,4 +103,8 @@ $(document).ready(function () {
return false;
});
$('#password').on('keyup change', function () {
if($('#password').val() && !($('#hidden').attr('checked'))){$('#resultsPubliclyVisible').removeAttr('disabled');}
else {$('#resultsPubliclyVisible').attr('disabled','disabled');};
});
});
......@@ -128,6 +128,7 @@
"Cancel the rules edit": "Nullañ embann an aotreoù",
"Results are hidden.": "Kuzhet eo an disoc'hoù.",
"Results are visible.": "Gwelus eo an disoc'hoù.",
"Only votes are protected": "Only votes are protected",
"Password protected": "Gwarezet gant ur ger-tremen",
"Votes protected by password": "Gwarezet eo ar mouezhioù gant ur ger-tremen",
"No password": "Ger-tremen ebet",
......
......@@ -128,6 +128,7 @@
"Cancel the rules edit": "Abbruch, Regeln nicht ändern",
"Results are hidden": "Ergebnisse werden ausgeblendet",
"Results are visible": "Ergebnisse sind sichtbar",
"Only votes are protected": "Only votes are protected",
"Password protected": "Passwortgeschützt",
"Votes protected by password": "Wertungen sind passwortgeschützt",
"No password": "Kein Passwort",
......
......@@ -128,6 +128,7 @@
"Cancel the rules edit": "Cancel the rules edit",
"Results are hidden": "Results are hidden",
"Results are visible": "Results are visible",
"Only votes are protected": "Only votes are protected",
"Password protected": "Password protected",
"Votes protected by password": "Votes protected by password",
"No password": "No password",
......
......@@ -128,6 +128,7 @@
"Cancel the rules edit": "ES_Annuler le changement de permissions",
"Results are hidden": "Los resutaldos no son visibles",
"Results are visible": "Los resultados son visibles",
"Only votes are protected": "Only votes are protected",
"Password protected": "ES_Protégé par mot de passe",
"Votes protected by password": "ES_Votes protégés par mot de passe",
"No password": "ES_Pas de mot de passe",
......
......@@ -128,6 +128,7 @@
"Cancel the rules edit": "Annuler le changement de permissions",
"Results are hidden": "Les résultats sont cachés",
"Results are visible": "Les résultats sont visibles",
"Only votes are protected": "Seul les votes sont protégés",
"Password protected": "Protégé par mot de passe",
"Votes protected by password": "Votes protégés par mot de passe",
"No password": "Pas de mot de passe",
......
......@@ -128,6 +128,7 @@
"Cancel the rules edit": "Annullare le modifica dei permessi",
"Results are hidden": "I risultati sono nascosti",
"Results are visible": "I risultati sono visibili",
"Only votes are protected": "Solo voti sono protetti",
"Password protected": "Protetto da una password",
"Votes protected by password": "Voti protetti da una password",
"No password": "Nessuna password",
......
......@@ -128,6 +128,7 @@
"Cancel the rules edit": "Regels bewerken annuleren",
"Results are hidden": "Resultaten zijn verborgen.",
"Results are visible": "Resultaten zijn zichtbaar.",
"Only votes are protected": "Only votes are protected",
"Password protected": "Beveiligd met een wachtwoord",
"Votes protected by password": "Stemmen beveiligd met een wachtwoord",
"No password": "Geen wachtwoord",
......
......@@ -128,6 +128,7 @@
"Cancel the rules edit": "Anullar lo cambiament de permissions",
"Results are hidden": "Los resultats son amagats",
"Results are visible": "Los resultats son visibles",
"Only votes are protected": "Only votes are protected",
"Password protected": "Protegit per senhal",
"Votes protected by password": "Vòtes protegits per senhal",
"No password": "Pas cap de senhal",
......
......@@ -154,8 +154,8 @@
{/if}
<div id="password_information">
<div class="input-group">
<input type="checkbox" id="resultsPubliclyVisible" name="resultsPubliclyVisible" {if $poll->results_publicly_visible}checked="checked"{/if}/>
<label for="resultsPubliclyVisible">{__('PollInfo', 'Results are visible')}</label>
<input type="checkbox" id="resultsPubliclyVisible" name="resultsPubliclyVisible" {if $poll->results_publicly_visible && $poll->hidden == false && (!empty($poll->password_hash))}checked="checked" {elseif ($poll->hidden == true || empty($poll->password_hash))} disabled="disabled"{/if}/>
<label for="resultsPubliclyVisible">{__('PollInfo', 'Only votes are protected')}</label>
</div>
<div class="input-group">
<input type="text" class="form-control" id="password" name="password"/>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment