+

Improve add group's categorie user interface

Benjamin Renard [2016-09-12 21:19:16]
Improve add group's categorie user interface
Filename
inc/myco.js
index.html
diff --git a/inc/myco.js b/inc/myco.js
index cc0a5e5..d4f84f3 100644
--- a/inc/myco.js
+++ b/inc/myco.js
@@ -307,6 +307,7 @@ on_categories_go_back_group_btn_click=function(e) {
 }

 on_categories_group_add_btn_click=function(e) {
+  e.preventDefault();
   name=$('#add_category input')[0].value;

   if (jQuery.type(name)!='string' || name=='') {
@@ -322,6 +323,7 @@ on_categories_group_add_btn_click=function(e) {
     group.addCategory(new Category(name));
     $('#add_category input')[0].value='';
     refresh_group_categories(group);
+    $('#add_category input').focus();
   }
 }

@@ -1077,6 +1079,7 @@ $( document ).ready( function() {
   $('#nav-search-form input').bind('input',on_nav_search_form_input);

   $('#view-group-categories span.input-group-addon').bind('click',on_categories_group_add_btn_click);
+  $('#view-group-categories form').bind('submit',on_categories_group_add_btn_click);
   $("#view-group-categories button.go-back-group").bind('click',on_categories_go_back_group_btn_click);

   view_home();
diff --git a/index.html b/index.html
index 2ceabbb..14196b5 100644
--- a/index.html
+++ b/index.html
@@ -339,10 +339,12 @@ span.cat-color {
     <div class='col-xs-6'>
       <ul>
       </ul>
-      <div id="add_category" class='input-group'>
-        <input type='text' class="form-control" placeholder='nom'/>
-        <span class="input-group-addon"><span class="glyphicon glyphicon-plus"></span></span>
-      </div>
+      <form class="form-horizontal" role="form">
+        <div id="add_category" class='input-group'>
+          <input type='text' class="form-control" placeholder='nom'/>
+          <span class="input-group-addon"><span class="glyphicon glyphicon-plus"></span></span>
+        </div>
+      </form>
     </div>
   </div>
   <div id='cats-chart'></div>
ViewGit