Changing message creation logic.
This commit is contained in:
parent
e4ec0c8105
commit
b3d79da0a6
@ -6,12 +6,10 @@ $(document).ready(function() {
|
||||
var regex = new RegExp(regexContent[1], regexContent[2]);
|
||||
if (name.length == 0 || !regex.test(name)) {
|
||||
event.preventDefault();
|
||||
var errorMessage = $("#parameter_name_error").text();
|
||||
var addedDiv = "<div class='alert alert-dismissible alert-danger' role='alert'>";
|
||||
addedDiv += errorMessage;
|
||||
addedDiv += "<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>×</span></button></div>";
|
||||
var newMessage = $("#nameErrorMessage").clone();
|
||||
$("#message-container").empty();
|
||||
$("#message-container").append(addedDiv);
|
||||
$("#message-container").append(newMessage);
|
||||
newMessage.removeClass("hidden");
|
||||
$('html, body').animate({
|
||||
scrollTop: $("#message-container").offset().top
|
||||
}, 750);
|
||||
|
@ -203,5 +203,6 @@ $smarty->assign('editingVoteId', $editingVoteId);
|
||||
$smarty->assign('message', $message);
|
||||
$smarty->assign('admin', false);
|
||||
$smarty->assign('parameter_name_regex', NAME_REGEX);
|
||||
$smarty->assign('parameter_name_error', _('Name is incorrect.'));
|
||||
|
||||
$smarty->display('studs.tpl');
|
||||
|
@ -6,13 +6,16 @@
|
||||
|
||||
{block name=main}
|
||||
|
||||
|
||||
<div id="message-container">
|
||||
{if !empty($message)}
|
||||
<div class="alert alert-dismissible alert-{$message->type|html}" role="alert">{$message->message|html}<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="nameErrorMessage" class="hidden alert alert-dismissible alert-danger" role="alert">{__('PollInfo\\The name is invalid.')}<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button></div>
|
||||
|
||||
{* Global informations about the current poll *}
|
||||
|
||||
{* Global informations about the current poll *}
|
||||
|
||||
{include 'part/poll_info.tpl' admin=$admin}
|
||||
|
||||
@ -45,7 +48,6 @@
|
||||
|
||||
<div class="hidden">
|
||||
<p id="parameter_name_regex">{$parameter_name_regex}</p>
|
||||
<p id="parameter_name_error">{__('Error','Name is incorrect.')|var_dump}</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user