summaryrefslogtreecommitdiff
path: root/modules/tag/helpers
diff options
context:
space:
mode:
authorNathan Kinkade <nath@nkinka.de>2013-03-19 16:41:42 +0000
committerNathan Kinkade <nath@nkinka.de>2013-03-19 16:41:42 +0000
commit3908e37d965fa76ea774e76ddf42365a872a5f27 (patch)
tree457e1a1e465f83855eee96ba287cd91f1623395c /modules/tag/helpers
parent711651f727e093cc7357a6bbff6bd992fd6dfd80 (diff)
parent1eab94f6062b5f54ea5d9db01d968e7195f3de9d (diff)
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/tag/helpers')
-rw-r--r--modules/tag/helpers/tag_event.php41
-rw-r--r--modules/tag/helpers/tag_theme.php4
2 files changed, 13 insertions, 32 deletions
diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php
index d62ae36e..927153aa 100644
--- a/modules/tag/helpers/tag_event.php
+++ b/modules/tag/helpers/tag_event.php
@@ -69,19 +69,14 @@ class tag_event_Core {
}
static function item_edit_form($item, $form) {
- $url = url::site("tags/autocomplete");
- $form->script("")
- ->text("$('form input[name=tags]').ready(function() {
- $('form input[name=tags]').gallery_autocomplete(
- '$url', {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1});
- });");
-
$tag_names = array();
foreach (tag::item_tags($item) as $tag) {
$tag_names[] = $tag->name;
}
$form->edit_item->input("tags")->label(t("Tags (comma separated)"))
->value(implode(", ", $tag_names));
+
+ $form->script("")->text(self::_get_autocomplete_js());
}
static function item_edit_form_completed($item, $form) {
@@ -111,38 +106,21 @@ class tag_event_Core {
static function add_photos_form($album, $form) {
$group = $form->add_photos;
- if (!is_object($group->uploadify)) {
- return;
- }
$group->input("tags")
->label(t("Add tags to all uploaded files"))
->value("");
- $group->uploadify->script_data("tags", "");
-
- $autocomplete_url = url::site("tags/autocomplete");
- $group->script("")
- ->text("$('input[name=tags]')
- .gallery_autocomplete(
- '$autocomplete_url',
- {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1}
- );
- $('input[name=tags]')
- .change(function (event) {
- $('#g-uploadify').uploadifySettings('scriptData', {'tags': $(this).val()});
- });");
+
+ $group->script("")->text(self::_get_autocomplete_js());
}
- static function add_photos_form_completed($album, $form) {
+ static function add_photos_form_completed($item, $form) {
$group = $form->add_photos;
- if (!is_object($group->uploadify)) {
- return;
- }
- foreach (explode(",", $form->add_photos->tags->value) as $tag_name) {
+ foreach (explode(",", $group->tags->value) as $tag_name) {
$tag_name = trim($tag_name);
if ($tag_name) {
- $tag = tag::add($album, $tag_name);
+ $tag = tag::add($item, $tag_name);
}
}
}
@@ -162,4 +140,9 @@ class tag_event_Core {
$block->content->metadata = $info;
}
}
+
+ private static function _get_autocomplete_js() {
+ $url = url::site("tags/autocomplete");
+ return "$('input[name=\"tags\"]').gallery_autocomplete('$url', {multiple: true});";
+ }
}
diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php
index 81d1352f..143af6c1 100644
--- a/modules/tag/helpers/tag_theme.php
+++ b/modules/tag/helpers/tag_theme.php
@@ -19,9 +19,7 @@
*/
class tag_theme_Core {
static function head($theme) {
- return $theme->css("jquery.autocomplete.css")
- . $theme->script("jquery.autocomplete.js")
- . $theme->css("tag.css");
+ return $theme->css("tag.css");
}
static function admin_head($theme) {