Improving edit link visibility

This commit is contained in:
Antonin 2016-04-27 00:12:21 +02:00
parent ada0471b27
commit 6d6334aa6d
3 changed files with 25 additions and 3 deletions

View File

@ -23,11 +23,15 @@ class Message {
var $type;
var $message;
var $link;
var $linkTitle;
var $linkIcon;
function __construct($type, $message, $link=null) {
function __construct($type, $message, $link=null, $linkTitle=null, $linkIcon=null) {
$this->type = $type;
$this->message = $message;
$this->link = $link;
$this->linkTitle = $linkTitle;
$this->linkIcon = $linkIcon;
}
}

View File

@ -141,7 +141,12 @@ if ($accessGranted) {
$editedVoteUniqueId = filter_input(INPUT_POST, 'edited_vote', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => POLL_REGEX]]);
$sessionService->set(USER_REMEMBER_VOTES_KEY, $poll_id, $editedVoteUniqueId);
$urlEditVote = Utils::getUrlSondage($poll_id, false, $editedVoteUniqueId);
$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);
$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,
__('Poll results', 'Edit the line:').' '.$name,
'glyphicon-pencil');
} else {
$message = new Message('success', __('studs', 'Update vote succeeded'));
}

View File

@ -15,7 +15,20 @@
{* Messages *}
<div id="message-container">
{if !empty($message)}
<div class="alert alert-dismissible alert-{$message->type|html} hidden-print" role="alert">{$message->message|html}{if $message->link != null}<br/><a href="{$message->link}">{$message->link}</a>{/if}<button type="button" class="close" data-dismiss="alert" aria-label="{__('Generic', 'CLose')}"><span aria-hidden="true">&times;</span></button></div>
<div class="alert alert-dismissible alert-{$message->type|html} hidden-print" role="alert">
{$message->message|html}
{if $message->link != null}
<div class="input-group input-group-sm">
<span class="input-group-btn">
<a {if $message->linkTitle != null} title="{$message->linkTitle|escape}" {/if} class="btn btn-default btn-sm" href="{$message->link}">
{if $message->linkIcon != null}<i class="glyphicon glyphicon-pencil"></i>{if $message->linkTitle != null}<span class="sr-only">{$message->linkTitle|escape}</span>{/if}{/if}
</a>
</span>
<input type="text" aria-hidden="true" value="{$message->link}" class="form-control" readonly="readonly" >
</div>
{/if}
<button type="button" class="close" data-dismiss="alert" aria-label="{__('Generic', 'CLose')}"><span aria-hidden="true">&times;</span></button>
</div>
{/if}
</div>
<div id="nameErrorMessage" class="hidden alert alert-dismissible alert-danger hidden-print" role="alert">{__('Error', 'The name is invalid.')}<button type="button" class="close" data-dismiss="alert" aria-label="{__('Generic', 'CLose')}"><span aria-hidden="true">&times;</span></button></div>