Add edit link with vote update

This commit is contained in:
Antonin 2015-04-07 17:58:45 +02:00
parent fbf448c415
commit 84e3a93645
3 changed files with 9 additions and 1 deletions

View File

@ -133,7 +133,13 @@ if (!empty($_POST['save'])) { // Save edition of an old vote
// Update vote
$result = $pollService->updateVote($poll_id, $editedVote, $name, $choices);
if ($result) {
$message = new Message('success', _('Update vote successfully.'));
if ($poll->editable == Editable::EDITABLE_BY_OWN) {
$editedVoteUniqId = filter_input(INPUT_POST, 'edited_vote', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]);
$urlEditVote = Utils::getUrlSondage($poll_id, false, $editedVoteUniqId);
$message = new Message('success', __('studs', "Your vote has been registered successfully, but be careful: regarding this poll options, you need to keep this personal link to edit your own vote:"), $urlEditVote);
} else {
$message = new Message('success', _('Update vote successfully.'));
}
sendUpdateNotification($poll, $mailService, $name, UPDATE_VOTE);
} else {
$message = new Message('danger', _('Update vote failed.'));

View File

@ -39,6 +39,7 @@
<td class="bg-info" style="padding:5px">
<div class="input-group input-group-sm" id="edit">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input type="hidden" name="edited_vote" value="{$vote->uniqId}"/>
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{__('Genric', 'Your name')}" placeholder="{__('Genric', 'Your name')}" />
</div>
</td>

View File

@ -85,6 +85,7 @@
<td class="bg-info" style="padding:5px">
<div class="input-group input-group-sm" id="edit">
<span class="input-group-addon"><span class="glyphicon glyphicon-user"></span></span>
<input type="hidden" name="edited_vote" value="{$vote->uniqId}"/>
<input type="text" id="name" name="name" value="{$vote->name|html}" class="form-control" title="{__('Generic', 'Your name')}" placeholder="{__('Generic', 'Your name')}" />
</div>
</td>