[Jifty-commit] r4207 - in jifty/trunk: lib/Jifty/Plugin
share/plugins/Jifty/Plugin/AutoReference
share/plugins/Jifty/Plugin/AutoReference/web
share/plugins/Jifty/Plugin/AutoReference/web/static
share/plugins/Jifty/Plugin/AutoReference/web/static/js
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Thu Oct 4 00:02:00 EDT 2007
Author: sterling
Date: Thu Oct 4 00:01:59 2007
New Revision: 4207
Added:
jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/
jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/
jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/
jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/js/
jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/AutoReference.pm
Log:
r12840 at riddle: andrew | 2007-10-03 23:01:09 -0500
Adding missing JavaScript file and cleaning up a method left-over from testing.
Modified: jifty/trunk/lib/Jifty/Plugin/AutoReference.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/AutoReference.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/AutoReference.pm Thu Oct 4 00:01:59 2007
@@ -37,10 +37,6 @@
Jifty->web->add_javascript(qw/ autoreference.js /);
}
-sub static_root {
- return Jifty::Util->app_root.'/share/plugins/Jifty/Plugin/AutoReference/web/static';
-}
-
sub _auto_reference_autocompleter {
my ($column, $from) = @_;
Added: jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js
==============================================================================
--- (empty file)
+++ jifty/trunk/share/plugins/Jifty/Plugin/AutoReference/web/static/js/autoreference.js Thu Oct 4 00:01:59 2007
@@ -0,0 +1,38 @@
+if (!Jifty.Plugin) Jifty.Plugin = {};
+
+Jifty.Plugin.AutoReference = Class.create();
+Object.extend(Object.extend(Jifty.Plugin.AutoReference.prototype, Jifty.Autocompleter.prototype), {
+ initialize: function(field, hiddenField, div) {
+ this.hiddenField = $(hiddenField);
+
+ // Copied from Jifty.Autocompleter.initialize
+ this.field = $(field);
+ this.action = Form.Element.getAction(this.hiddenField);
+ this.url = '/__jifty/autocomplete.xml';
+
+ Event.observe(this.field, "focus", this.onFocus.bindAsEventListener(this));
+ this.baseInitialize(this.field, $(div), {
+ minChars: "0",
+ beforeShow: this.beforeShow,
+ beforeHide: this.beforeHide,
+ frequency: 0.1,
+ onShow: this.onShow,
+ onHide: this.onHide,
+ updateElement: this.updateElment,
+ afterUpdateElement: this.afterUpdate
+ });
+ },
+
+ updateElement: function(selection) {
+ var label = Element.collectTextNodes(document.getElementsByClassName('informal', selection)[0]);
+ var value = Element.collectTextNodes(document.getElementsByClassName('hidden_value', selection)[0]);
+
+ this.field.value = label;
+ this.hiddenField.value = value;
+ },
+
+ afterUpdate: function(field, selection) {
+
+ Form.Element.validate(this.hiddenField);
+ }
+});
More information about the Jifty-commit
mailing list