Improve add group's categorie user interface
Benjamin Renard

Benjamin Renard commited on 2016-09-12 21:19:16
Showing 2 changed files, with 5 additions and 0 deletions.

... ...
@@ -307,6 +307,7 @@ on_categories_go_back_group_btn_click=function(e) {
307 307
 }
308 308
 
309 309
 on_categories_group_add_btn_click=function(e) {
310
+  e.preventDefault();
310 311
   name=$('#add_category input')[0].value;
311 312
   
312 313
   if (jQuery.type(name)!='string' || name=='') {
... ...
@@ -322,6 +323,7 @@ on_categories_group_add_btn_click=function(e) {
322 323
     group.addCategory(new Category(name));
323 324
     $('#add_category input')[0].value='';
324 325
     refresh_group_categories(group);
326
+    $('#add_category input').focus();
325 327
   }
326 328
 }
327 329
 
... ...
@@ -1077,6 +1079,7 @@ $( document ).ready( function() {
1077 1079
   $('#nav-search-form input').bind('input',on_nav_search_form_input);
1078 1080
   
1079 1081
   $('#view-group-categories span.input-group-addon').bind('click',on_categories_group_add_btn_click);
1082
+  $('#view-group-categories form').bind('submit',on_categories_group_add_btn_click);
1080 1083
   $("#view-group-categories button.go-back-group").bind('click',on_categories_go_back_group_btn_click);
1081 1084
   
1082 1085
   view_home();
... ...
@@ -339,10 +339,12 @@ span.cat-color {
339 339
     <div class='col-xs-6'>
340 340
       <ul>
341 341
       </ul>
342
+      <form class="form-horizontal" role="form">
342 343
         <div id="add_category" class='input-group'>
343 344
           <input type='text' class="form-control" placeholder='nom'/>
344 345
           <span class="input-group-addon"><span class="glyphicon glyphicon-plus"></span></span>
345 346
         </div>
347
+      </form>
346 348
     </div>
347 349
   </div>
348 350
   <div id='cats-chart'></div>
349 351