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]);
|
var regex = new RegExp(regexContent[1], regexContent[2]);
|
||||||
if (name.length == 0 || !regex.test(name)) {
|
if (name.length == 0 || !regex.test(name)) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
var errorMessage = $("#parameter_name_error").text();
|
var newMessage = $("#nameErrorMessage").clone();
|
||||||
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>";
|
|
||||||
$("#message-container").empty();
|
$("#message-container").empty();
|
||||||
$("#message-container").append(addedDiv);
|
$("#message-container").append(newMessage);
|
||||||
|
newMessage.removeClass("hidden");
|
||||||
$('html, body').animate({
|
$('html, body').animate({
|
||||||
scrollTop: $("#message-container").offset().top
|
scrollTop: $("#message-container").offset().top
|
||||||
}, 750);
|
}, 750);
|
||||||
|
@ -203,5 +203,6 @@ $smarty->assign('editingVoteId', $editingVoteId);
|
|||||||
$smarty->assign('message', $message);
|
$smarty->assign('message', $message);
|
||||||
$smarty->assign('admin', false);
|
$smarty->assign('admin', false);
|
||||||
$smarty->assign('parameter_name_regex', NAME_REGEX);
|
$smarty->assign('parameter_name_regex', NAME_REGEX);
|
||||||
|
$smarty->assign('parameter_name_error', _('Name is incorrect.'));
|
||||||
|
|
||||||
$smarty->display('studs.tpl');
|
$smarty->display('studs.tpl');
|
||||||
|
@ -6,13 +6,16 @@
|
|||||||
|
|
||||||
{block name=main}
|
{block name=main}
|
||||||
|
|
||||||
|
|
||||||
<div id="message-container">
|
<div id="message-container">
|
||||||
{if !empty($message)}
|
{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>
|
<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}
|
{/if}
|
||||||
</div>
|
</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}
|
{include 'part/poll_info.tpl' admin=$admin}
|
||||||
|
|
||||||
@ -45,7 +48,6 @@
|
|||||||
|
|
||||||
<div class="hidden">
|
<div class="hidden">
|
||||||
<p id="parameter_name_regex">{$parameter_name_regex}</p>
|
<p id="parameter_name_regex">{$parameter_name_regex}</p>
|
||||||
<p id="parameter_name_error">{__('Error','Name is incorrect.')|var_dump}</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user