summaryrefslogtreecommitdiff
path: root/modules/tag/helpers
diff options
context:
space:
mode:
authorChad Kieffer <ckieffer@gmail.com>2009-07-25 09:25:31 -0600
committerChad Kieffer <ckieffer@gmail.com>2009-07-25 09:25:31 -0600
commiteca46d76a7832f771d377edb3939ea1aded2fac9 (patch)
treed4f0323202c7eb6eab60ff6e14f9905b625e349b /modules/tag/helpers
parent63511316be51f193d37c4f3b9dd3455a9ab60de8 (diff)
parent50d6cc0150b930d79d3e8b90956ffa9655fcc9c5 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
Diffstat (limited to 'modules/tag/helpers')
-rw-r--r--modules/tag/helpers/tag.php2
-rw-r--r--modules/tag/helpers/tag_event.php12
-rw-r--r--modules/tag/helpers/tag_theme.php6
3 files changed, 14 insertions, 6 deletions
diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php
index 5efa6a19..be5461a4 100644
--- a/modules/tag/helpers/tag.php
+++ b/modules/tag/helpers/tag.php
@@ -104,7 +104,7 @@ class tag_Core {
($item->is_photo() ? t("Add tag to photo") : t("Add tag to movie"));
$group = $form->group("add_tag")->label("Add Tag");
- $group->input("name")->label($label)->rules("required|length[1,64]");
+ $group->input("name")->label($label)->rules("required");
$group->hidden("item_id")->value($item->id);
$group->submit("")->value(t("Add Tag"));
return $form;
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index d13d1340..58034900 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -64,9 +64,15 @@ class tag_event_Core {
tag::compact();
}
- static function item_edit_form($item, $form) {
+ static function item_edit_form($item, $view) {
+ $url = url::site("tags/autocomplete");
+ $view->script[] = "$('#gEditFormContainer form').ready(function() {
+ $('#gEditFormContainer form input[id=tags]').autocomplete(
+ '$url', {max: 30, formatResult: formatTagAutoCompleteResult}
+ );
+ });";
$tag_value = implode("; ", tag::item_tags($item));
- $form->edit_item->input("tags")->label(t("Tags (separate by , or ;)"))
+ $view->form->edit_item->input("tags")->label(t("Tags (separate by , or ;)"))
->value($tag_value);
}
@@ -74,7 +80,7 @@ class tag_event_Core {
tag::clear_all($item);
foreach (preg_split("/[,;]/", $form->edit_item->tags->value) as $tag_name) {
if ($tag_name) {
- tag::add($item, $tag_name);
+ tag::add($item, str_replace(" ", ".", $tag_name));
}
}
tag::compact();
diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php
index fe30354f..1bce9bd8 100644
--- a/modules/tag/helpers/tag_theme.php
+++ b/modules/tag/helpers/tag_theme.php
@@ -19,11 +19,13 @@
*/
class tag_theme_Core {
static function head($theme) {
- $theme->script("modules/tag/js/tag.js");
+ $theme->css("jquery.autocomplete.css");
+ $theme->script("jquery.autocomplete.js");
+ $theme->script("tag.js");
}
static function admin_head($theme) {
- $theme->script("modules/tag/js/tag.js");
+ $theme->script("tag.js");
}
static function sidebar_blocks($theme) {