maiha-sexy_auto_complete 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README +6 -2
- data/Rakefile +55 -3
- data/lib/{auto_complete.rb → sexy_auto_complete.rb} +2 -2
- data/lib/{auto_complete → sexy_auto_complete}/controller.rb +1 -1
- data/lib/{auto_complete → sexy_auto_complete}/helper.rb +1 -1
- metadata +12 -14
- data/MIT-LICENSE +0 -20
- data/files/multicontrols.js +0 -37
- data/init.rb +0 -16
- data/install.rb +0 -1
- data/uninstall.rb +0 -1
data/README
CHANGED
@@ -39,7 +39,7 @@ Example
|
|
39
39
|
|
40
40
|
[controller]
|
41
41
|
class UserController < ApplicationController
|
42
|
-
include
|
42
|
+
include SexyAutoComplete
|
43
43
|
|
44
44
|
def auto_complete_pref_id
|
45
45
|
# form value is set to @input automatically
|
@@ -58,7 +58,7 @@ With ActiveScaffold
|
|
58
58
|
|
59
59
|
[controller]
|
60
60
|
class AutoCompleteController < ApplicationController
|
61
|
-
include
|
61
|
+
include SexyAutoComplete
|
62
62
|
|
63
63
|
def pref_id
|
64
64
|
conds = ["id::varchar ~* ?", Regexp.escape(@input)]
|
@@ -80,4 +80,8 @@ Advanced Settings
|
|
80
80
|
If you want normal exception, override this method to return nil.
|
81
81
|
|
82
82
|
|
83
|
+
Note
|
84
|
+
====
|
85
|
+
* auto_complete plugin is also needed in Rails2
|
86
|
+
|
83
87
|
Copyright (c) 2008 maiha@wota.jp, released under the MIT license
|
data/Rakefile
CHANGED
@@ -5,18 +5,70 @@ require 'rake/rdoctask'
|
|
5
5
|
desc 'Default: run unit tests.'
|
6
6
|
task :default => :test
|
7
7
|
|
8
|
-
desc 'Test the
|
8
|
+
desc 'Test the sexy_auto_complete plugin.'
|
9
9
|
Rake::TestTask.new(:test) do |t|
|
10
10
|
t.libs << 'lib'
|
11
11
|
t.pattern = 'test/**/*_test.rb'
|
12
12
|
t.verbose = true
|
13
13
|
end
|
14
14
|
|
15
|
-
desc 'Generate documentation for the
|
15
|
+
desc 'Generate documentation for the sexy_auto_complete plugin.'
|
16
16
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
17
17
|
rdoc.rdoc_dir = 'rdoc'
|
18
|
-
rdoc.title = '
|
18
|
+
rdoc.title = 'DslAccessor'
|
19
19
|
rdoc.options << '--line-numbers' << '--inline-source'
|
20
20
|
rdoc.rdoc_files.include('README')
|
21
21
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
22
|
end
|
23
|
+
|
24
|
+
|
25
|
+
######################################################################
|
26
|
+
### for gem
|
27
|
+
|
28
|
+
require 'rubygems'
|
29
|
+
require 'rake/gempackagetask'
|
30
|
+
|
31
|
+
GEM_NAME = "sexy_auto_complete"
|
32
|
+
AUTHOR = "maiha"
|
33
|
+
EMAIL = "maiha@wota.jp"
|
34
|
+
HOMEPAGE = "http://github.com/maiha/sexy_auto_complete"
|
35
|
+
SUMMARY = "Rails plugin for better auto_complete, especially it gets along with ActiveScaffold nested forms"
|
36
|
+
GEM_VERSION = "0.2"
|
37
|
+
|
38
|
+
spec = Gem::Specification.new do |s|
|
39
|
+
# s.rubyforge_project = 'merb'
|
40
|
+
s.name = GEM_NAME
|
41
|
+
s.version = GEM_VERSION
|
42
|
+
s.platform = Gem::Platform::RUBY
|
43
|
+
s.has_rdoc = true
|
44
|
+
s.extra_rdoc_files = ["README", "LICENSE"]
|
45
|
+
s.summary = SUMMARY
|
46
|
+
s.description = s.summary
|
47
|
+
s.author = AUTHOR
|
48
|
+
s.email = EMAIL
|
49
|
+
s.homepage = HOMEPAGE
|
50
|
+
s.require_path = 'lib'
|
51
|
+
s.files = %w(LICENSE README Rakefile) + Dir.glob("{core_ext,lib,spec,tasks,test}/**/*")
|
52
|
+
end
|
53
|
+
|
54
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
55
|
+
pkg.gem_spec = spec
|
56
|
+
end
|
57
|
+
|
58
|
+
desc "Install the gem"
|
59
|
+
task :install do
|
60
|
+
Merb::RakeHelper.install(GEM_NAME, :version => GEM_VERSION)
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Uninstall the gem"
|
64
|
+
task :uninstall do
|
65
|
+
Merb::RakeHelper.uninstall(GEM_NAME, :version => GEM_VERSION)
|
66
|
+
end
|
67
|
+
|
68
|
+
desc "Create a gemspec file"
|
69
|
+
task :gemspec do
|
70
|
+
File.open("#{GEM_NAME}.gemspec", "w") do |file|
|
71
|
+
file.puts spec.to_ruby
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: maiha-sexy_auto_complete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: "0.
|
4
|
+
version: "0.2"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- maiha
|
@@ -9,31 +9,29 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2009-02-24 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
16
|
-
description:
|
16
|
+
description: Rails plugin for better auto_complete, especially it gets along with ActiveScaffold nested forms
|
17
17
|
email: maiha@wota.jp
|
18
18
|
executables: []
|
19
19
|
|
20
20
|
extensions: []
|
21
21
|
|
22
|
-
extra_rdoc_files:
|
23
|
-
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
- LICENSE
|
24
25
|
files:
|
25
|
-
-
|
26
|
+
- LICENSE
|
26
27
|
- README
|
27
28
|
- Rakefile
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
- lib/
|
32
|
-
- lib/auto_complete/controller.rb
|
33
|
-
- lib/auto_complete/helper.rb
|
29
|
+
- lib/sexy_auto_complete
|
30
|
+
- lib/sexy_auto_complete/helper.rb
|
31
|
+
- lib/sexy_auto_complete/controller.rb
|
32
|
+
- lib/sexy_auto_complete.rb
|
34
33
|
- tasks/auto_complete_tasks.rake
|
35
34
|
- test/auto_complete_test.rb
|
36
|
-
- uninstall.rb
|
37
35
|
has_rdoc: true
|
38
36
|
homepage: http://github.com/maiha/sexy_auto_complete
|
39
37
|
post_install_message:
|
@@ -59,6 +57,6 @@ rubyforge_project:
|
|
59
57
|
rubygems_version: 1.2.0
|
60
58
|
signing_key:
|
61
59
|
specification_version: 2
|
62
|
-
summary:
|
60
|
+
summary: Rails plugin for better auto_complete, especially it gets along with ActiveScaffold nested forms
|
63
61
|
test_files: []
|
64
62
|
|
data/MIT-LICENSE
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2008 [name of plugin creator]
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/files/multicontrols.js
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
function getElementsByAttributeName(node, attrname)
|
2
|
-
{
|
3
|
-
var a = [];
|
4
|
-
var re = new RegExp('\\b' + attrname + '\\b');
|
5
|
-
var els = node.getElementsByTagName("*");
|
6
|
-
for(var i=0,j=els.length; i<j; i++)
|
7
|
-
if(els[i].getAttribute(attrname)) a.push(els[i]);
|
8
|
-
return a;
|
9
|
-
}
|
10
|
-
|
11
|
-
Object.extend(Ajax.Autocompleter.prototype,{
|
12
|
-
selectEntry: function() {
|
13
|
-
this.active = false;
|
14
|
-
var defs = getElementsByAttributeName(this.getCurrentEntry(), 'connect');
|
15
|
-
|
16
|
-
if (defs.length == 0) {
|
17
|
-
this.updateElement(this.getCurrentEntry());
|
18
|
-
} else {
|
19
|
-
for (var i = 0; i < defs.length; i++) {
|
20
|
-
var connectid = defs[i].getAttribute("connect");
|
21
|
-
if ($(connectid)) {
|
22
|
-
if ($(connectid).tagName == "INPUT"){
|
23
|
-
$(connectid).value = defs[i].childNodes[0].nodeValue;
|
24
|
-
} else {
|
25
|
-
$(connectid).innerHTML = defs[i].childNodes[0].nodeValue;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
31
|
-
if (this.options.afterUpdateElement)
|
32
|
-
this.options.afterUpdateElement(this.element, this.getCurrentEntry());
|
33
|
-
|
34
|
-
this.element.focus();
|
35
|
-
}
|
36
|
-
});
|
37
|
-
|
data/init.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# install javascripts
|
2
|
-
|
3
|
-
src = File.dirname(__FILE__) + "/files/multicontrols.js"
|
4
|
-
dst = RAILS_ROOT + "/public/javascripts/multicontrols.js"
|
5
|
-
if !File.exist?(dst) or File.mtime(dst) < File.mtime(src)
|
6
|
-
if (logger = ActionController::Base.logger)
|
7
|
-
logger.debug "[AutoComplete plugin] install multicontrols.js to #{dst}"
|
8
|
-
end
|
9
|
-
FileUtils.cp(src, dst)
|
10
|
-
end
|
11
|
-
|
12
|
-
# apply new methods to ApplicationHelper
|
13
|
-
|
14
|
-
ApplicationHelper.module_eval do
|
15
|
-
include AutoComplete::Helper
|
16
|
-
end
|
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|