Add the error class only on the input zone

WHen you type an invalid room name
master
Daniel Berteaud 11 years ago
parent 146b126bc7
commit e56dbad9e6
  1. 7
      public/js/vroom.js
  2. 32
      templates/default/index.html.ep

@ -243,7 +243,10 @@ function initIndex(){
e.preventDefault(); e.preventDefault();
// Do not submit if we know the name is invalid // Do not submit if we know the name is invalid
if (!$('#roomName').val().match(/^[\w\-]{0,49}$/)){ if (!$('#roomName').val().match(/^[\w\-]{0,49}$/)){
$('#roomName').notify(locale.ERROR_NAME_INVALID, 'error'); $('#roomName').parent().parent().notify(locale.ERROR_NAME_INVALID, {
class: 'error',
position: 'bottom center'
});
} }
else{ else{
$.ajax({ $.ajax({
@ -263,7 +266,7 @@ function initIndex(){
$('#conflictModal').modal('show'); $('#conflictModal').modal('show');
} }
else{ else{
$('#roomName').notify(data.msg, 'error'); $('#roomName').parent().parent().notify(data.msg, 'error');
} }
}, },
error: function(){ error: function(){

@ -11,23 +11,23 @@
</h2> </h2>
<form id="createRoom" class="form-inline" action="<%= $self->get_url('/create') %>" method="post"> <form id="createRoom" class="form-inline" action="<%= $self->get_url('/create') %>" method="post">
<fieldset> <fieldset>
<div class="control-group"> <div class="input-group input-group-lg">
<div class="input-group input-group-lg"> <span class="input-group-addon hidden-xs">
<span class="input-group-addon hidden-xs"> <strong class="text-muted">
<strong class="text-muted"> <%
<% my $url = $self->url_for('/')->to_abs;
my $url = $self->url_for('/')->to_abs; $url =~ s/^https?:\/\///;
$url =~ s/^https?:\/\///; $url .= ($url =~ m/\/$/)? '':'/';
$url .= ($url =~ m/\/$/)? '':'/'; %>
%> <%= $url %>
<%= $url %> </strong>
</strong> </span>
</span> <div class="control-group">
<input id="roomName" name="roomName" type="text" placeholder="<%=l 'ROOM_NAME' %>" class="form-control help" data-toggle="tooltip" data-placement="bottom" title="<%=l 'RANDOM_IF_EMPTY' %>" autofocus> <input id="roomName" name="roomName" type="text" placeholder="<%=l 'ROOM_NAME' %>" class="form-control input-lg help" data-toggle="tooltip" data-placement="bottom" title="<%=l 'RANDOM_IF_EMPTY' %>" autofocus>
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-log-in"></span></button>
</span>
</div> </div>
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-log-in"></span></button>
</span>
</div> </div>
</fieldset> </fieldset>
</form> </form>

Loading…
Cancel
Save