diff options
| author | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-24 11:24:43 -0700 | 
|---|---|---|
| committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-07-24 11:24:43 -0700 | 
| commit | fa1d32e6466d8c6ffe77d163e2da9c71688a3c61 (patch) | |
| tree | d4025073bcad2bf49cbb36afa7e0eae24e55d3f7 /modules/tag/controllers | |
| parent | 0e9b80d2efb942167fef269441e65722abac5f54 (diff) | |
Partial implementation of ticket #80. Provide auto complete and suggestions on the tag add form in the tag sidebar block.  Updated the xss golden file as well.  Still to do figure out how toget it into the edit popup dialog
Diffstat (limited to 'modules/tag/controllers')
| -rw-r--r-- | modules/tag/controllers/tags.php | 17 | 
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/tag/controllers/tags.php b/modules/tag/controllers/tags.php index 5dd07935..a600ea1a 100644 --- a/modules/tag/controllers/tags.php +++ b/modules/tag/controllers/tags.php @@ -78,4 +78,21 @@ class Tags_Controller extends REST_Controller {      return tag::get_add_form($item);    } + +  public function autocomplete() { +    $tags = array(); +    $tag_parts = preg_split("#[,\s;]+# ", $this->input->get("q")); +    $limit = $this->input->get("limit"); +    $tag_part = end($tag_parts); +    $tag_list = ORM::factory("tag") +      ->like("name", "{$tag_part}%", false) +      ->orderby("name", "ASC") +      ->limit($limit) +      ->find_all(); +    foreach ($tag_list as $tag) { +      $tags[] = $tag->name; +    } + +    print implode("\n", $tags); +  }  }  | 
