Allow to edit account description in place
authorJoey Schulze <joey@infodrom.org>
Mon, 17 Jul 2017 22:18:07 +0000 (00:18 +0200)
committerJoey Schulze <joey@infodrom.org>
Mon, 17 Jul 2017 22:18:07 +0000 (00:18 +0200)
class/accounting.class.php
src/InfoCon/account/list.wml

index b127b78..d506fee 100644 (file)
@@ -8,6 +8,10 @@ class Accounting extends AccountTable {
     parent::__construct('account', $id);
   }
 
     parent::__construct('account', $id);
   }
 
-}
+  public function ajaxEditDescr(Array $data)
+  {
+    if (!strlen($data['content'])) return false;
+    return $this->modify('descr', $data['content']);
+  }
 
 
-?>
+}
index adf4c54..292cbca 100644 (file)
@@ -70,8 +70,12 @@ function filter_account()
     $out .= sprintf ("<tr class=\"t%d\">", $color);
     $out .= sprintf ("<td width=\"10%%\" align=\"right\">%s</td>", $date);
     $out .= sprintf ("<td width=\"10%%\" align=\"center\">%s</td>", $row['category']);
     $out .= sprintf ("<tr class=\"t%d\">", $color);
     $out .= sprintf ("<td width=\"10%%\" align=\"right\">%s</td>", $date);
     $out .= sprintf ("<td width=\"10%%\" align=\"center\">%s</td>", $row['category']);
-    $out .= sprintf ("<td width=\"70%%\"><a href=\"edit.php?id=%d%s\" target=\"_new\">%s</a></td>",
-           $row['id'], $add, $descr[0]);
+    if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mozilla/') === false)
+      $out .= sprintf ("<td width=\"70%%\"><a href=\"edit.php?id=%d%s\" target=\"_new\">%s</a></td>",
+                      $row['id'], $add, $descr[0]);
+    else
+      $out .= sprintf ("<td width=\"70%%\"><span route=\"Accounting/EditDescr\" item_id=\"%d\" text=\"%s\">%s</span></td>",
+                      $row['id'], $add, $descr[0]);
     $out .= sprintf ("<td width=\"10%%\" align=\"right\" class=\"%s\">%5.2f</td>",
       $row[$value]>0?"in":"out", $row[$value]);
     $sum += $row[$value];
     $out .= sprintf ("<td width=\"10%%\" align=\"right\" class=\"%s\">%5.2f</td>",
       $row[$value]>0?"in":"out", $row[$value]);
     $sum += $row[$value];
@@ -156,6 +160,7 @@ $(function(){
     });
     $('body').append('<script type="text/javascript" src="../../jquery.udraggable.js"><\/script>');
     $('body').append('<script type="text/javascript" src="../../jquery.event.ue.js"><\/script>');
     });
     $('body').append('<script type="text/javascript" src="../../jquery.udraggable.js"><\/script>');
     $('body').append('<script type="text/javascript" src="../../jquery.event.ue.js"><\/script>');
+    $('body').append('<script type="text/javascript" src="../../jquery.editable.js"><\/script>');
 });
 
 //+ Jonas Raoni Soares Silva
 });
 
 //+ Jonas Raoni Soares Silva
@@ -202,6 +207,7 @@ function filter_popup()
                             'ajax=1&'+$('#filter_popup form').serialize(),
                             function(data){
                                 $('table.border tbody').html(UTF8.decode(data));
                             'ajax=1&'+$('#filter_popup form').serialize(),
                             function(data){
                                 $('table.border tbody').html(UTF8.decode(data));
+                                make_editable('table.smallfont tr span');
                             });
                      return false;
                  });
                             });
                      return false;
                  });
@@ -212,6 +218,7 @@ function filter_popup()
                             function(data){
                                 $('table.border tbody').html(UTF8.decode(data));
                                 $('#filter_popup').hide();
                             function(data){
                                 $('table.border tbody').html(UTF8.decode(data));
                                 $('#filter_popup').hide();
+                                make_editable('table.smallfont tr span');
                             });
                      return false;
                  });
                             });
                      return false;
                  });