From b3d79da0a6fcfd34461a54147ad2e1666a22679d Mon Sep 17 00:00:00 2001 From: Antonin Date: Thu, 26 Mar 2015 17:09:52 +0100 Subject: [PATCH] Changing message creation logic. --- js/app/studs.js | 8 +++----- studs.php | 1 + tpl/studs.tpl | 6 ++++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/js/app/studs.js b/js/app/studs.js index 7a32203..a41f156 100644 --- a/js/app/studs.js +++ b/js/app/studs.js @@ -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 = ""; + 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); diff --git a/studs.php b/studs.php index 461d86d..1bfbb52 100644 --- a/studs.php +++ b/studs.php @@ -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'); diff --git a/tpl/studs.tpl b/tpl/studs.tpl index b83f36a..2c9b381 100644 --- a/tpl/studs.tpl +++ b/tpl/studs.tpl @@ -6,13 +6,16 @@ {block name=main} +
{if !empty($message)} {/if}
+ -{* Global informations about the current poll *} + + {* Global informations about the current poll *} {include 'part/poll_info.tpl' admin=$admin} @@ -45,7 +48,6 @@