[Jifty-commit] r5914 - in JiftyX-ExpenseApp/trunk: lib/Jifty/Plugin/ExpenseApp/Model

Jifty commits jifty-commit at lists.jifty.org
Fri Oct 10 12:47:54 EDT 2008


Author: gugod
Date: Fri Oct 10 12:47:53 2008
New Revision: 5914

Modified:
   JiftyX-ExpenseApp/trunk/   (props changed)
   JiftyX-ExpenseApp/trunk/lib/Jifty/Plugin/ExpenseApp/Model/Expense.pm

Log:
 r24485 at yra:  gugod | 2008-10-10 10:08:49 +0800
 autocomplete category values by its own values.
 


Modified: JiftyX-ExpenseApp/trunk/lib/Jifty/Plugin/ExpenseApp/Model/Expense.pm
==============================================================================
--- JiftyX-ExpenseApp/trunk/lib/Jifty/Plugin/ExpenseApp/Model/Expense.pm	(original)
+++ JiftyX-ExpenseApp/trunk/lib/Jifty/Plugin/ExpenseApp/Model/Expense.pm	Fri Oct 10 12:47:53 2008
@@ -54,4 +54,17 @@
     return 0;
 }
 
+sub autocomplete_category {
+    my ($self, $value) = @_;
+
+    my $c = Jifty::Plugin::ExpenseApp::Model::ExpenseCollection->new;
+    $c->limit(
+        column => "category",
+        operator => "MATCHES",
+        value => $value
+    );
+
+    return map { $_->category } @{ $c->items_array_ref }
+}
+
 1;


More information about the Jifty-commit mailing list