autocomplete-off 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile +5 -5
- data/Gemfile.lock +45 -1
- data/README.rdoc +2 -1
- data/Rakefile +7 -15
- data/VERSION +1 -1
- data/autocomplete-off.gemspec +19 -4
- data/lib/autocomplete-off.rb +11 -2
- data/spec/autocomplete-off_spec.rb +50 -0
- data/spec/spec_helper.rb +19 -0
- metadata +64 -9
- data/test/helper.rb +0 -17
- data/test/test_autocomplete-off.rb +0 -5
data/Gemfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
source "http://rubygems.org"
|
2
|
-
|
3
|
-
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
2
|
+
gem "actionpack", ">= 3.0.0"
|
3
|
+
gem "activesupport", ">= 3.0.0"
|
5
4
|
|
6
|
-
# Add dependencies to develop your gem here.
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
5
|
group :development do
|
9
6
|
gem "bundler", "~> 1.0.0"
|
10
7
|
gem "jeweler", "~> 1.6.2"
|
8
|
+
gem 'simplecov', '>= 0.3.8', :require => false
|
9
|
+
gem "rspec", "~> 2.6.0"
|
10
|
+
gem "yard", "~> 0.6.0"
|
11
11
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,60 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
+
abstract (1.0.0)
|
5
|
+
actionpack (3.0.8)
|
6
|
+
activemodel (= 3.0.8)
|
7
|
+
activesupport (= 3.0.8)
|
8
|
+
builder (~> 2.1.2)
|
9
|
+
erubis (~> 2.6.6)
|
10
|
+
i18n (~> 0.5.0)
|
11
|
+
rack (~> 1.2.1)
|
12
|
+
rack-mount (~> 0.6.14)
|
13
|
+
rack-test (~> 0.5.7)
|
14
|
+
tzinfo (~> 0.3.23)
|
15
|
+
activemodel (3.0.8)
|
16
|
+
activesupport (= 3.0.8)
|
17
|
+
builder (~> 2.1.2)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
activesupport (3.0.8)
|
20
|
+
builder (2.1.2)
|
21
|
+
diff-lcs (1.1.2)
|
22
|
+
erubis (2.6.6)
|
23
|
+
abstract (>= 1.0.0)
|
4
24
|
git (1.2.5)
|
25
|
+
i18n (0.5.0)
|
5
26
|
jeweler (1.6.2)
|
6
27
|
bundler (~> 1.0)
|
7
28
|
git (>= 1.2.5)
|
8
29
|
rake
|
9
|
-
|
30
|
+
rack (1.2.3)
|
31
|
+
rack-mount (0.6.14)
|
32
|
+
rack (>= 1.0.0)
|
33
|
+
rack-test (0.5.7)
|
34
|
+
rack (>= 1.0)
|
35
|
+
rake (0.9.2)
|
36
|
+
rspec (2.6.0)
|
37
|
+
rspec-core (~> 2.6.0)
|
38
|
+
rspec-expectations (~> 2.6.0)
|
39
|
+
rspec-mocks (~> 2.6.0)
|
40
|
+
rspec-core (2.6.4)
|
41
|
+
rspec-expectations (2.6.0)
|
42
|
+
diff-lcs (~> 1.1.2)
|
43
|
+
rspec-mocks (2.6.0)
|
44
|
+
simplecov (0.4.2)
|
45
|
+
simplecov-html (~> 0.4.4)
|
46
|
+
simplecov-html (0.4.5)
|
47
|
+
tzinfo (0.3.27)
|
48
|
+
yard (0.6.8)
|
10
49
|
|
11
50
|
PLATFORMS
|
12
51
|
ruby
|
13
52
|
|
14
53
|
DEPENDENCIES
|
54
|
+
actionpack (>= 3.0.0)
|
55
|
+
activesupport (>= 3.0.0)
|
15
56
|
bundler (~> 1.0.0)
|
16
57
|
jeweler (~> 1.6.2)
|
58
|
+
rspec (~> 2.6.0)
|
59
|
+
simplecov (>= 0.3.8)
|
60
|
+
yard (~> 0.6.0)
|
data/README.rdoc
CHANGED
@@ -21,7 +21,8 @@ Or if you want to use it as plugin
|
|
21
21
|
It works right out of the box. Just install, restart your server and see it working.
|
22
22
|
|
23
23
|
== Features
|
24
|
-
|
24
|
+
|
25
|
+
* Handle input tag with type text or password or email and add default autocomplete=off for default
|
25
26
|
|
26
27
|
== Maintainers
|
27
28
|
|
data/Rakefile
CHANGED
@@ -25,21 +25,13 @@ Jeweler::Tasks.new do |gem|
|
|
25
25
|
end
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
27
27
|
|
28
|
-
require '
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
test.verbose = true
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
32
|
end
|
34
33
|
|
35
|
-
task :default => :
|
34
|
+
task :default => :spec
|
36
35
|
|
37
|
-
require '
|
38
|
-
Rake::
|
39
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
40
|
-
|
41
|
-
rdoc.rdoc_dir = 'rdoc'
|
42
|
-
rdoc.title = "autocomplete-off #{version}"
|
43
|
-
rdoc.rdoc_files.include('README*')
|
44
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
45
|
-
end
|
36
|
+
require 'yard'
|
37
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/autocomplete-off.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{autocomplete-off}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Alexander Dreher"]
|
12
|
-
s.date = %q{2011-06-
|
12
|
+
s.date = %q{2011-06-08}
|
13
13
|
s.description = %q{Adds `autocomplete="off"` html attribute to FormHelper generated input tags by default.}
|
14
14
|
s.email = %q{alexdreher@lxmedia.net}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,8 +27,8 @@ Gem::Specification.new do |s|
|
|
27
27
|
"autocomplete-off.gemspec",
|
28
28
|
"init.rb",
|
29
29
|
"lib/autocomplete-off.rb",
|
30
|
-
"
|
31
|
-
"
|
30
|
+
"spec/autocomplete-off_spec.rb",
|
31
|
+
"spec/spec_helper.rb"
|
32
32
|
]
|
33
33
|
s.homepage = %q{http://github.com/phatworx/autocomplete-off}
|
34
34
|
s.licenses = ["MIT"]
|
@@ -40,15 +40,30 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.specification_version = 3
|
41
41
|
|
42
42
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
43
|
+
s.add_runtime_dependency(%q<actionpack>, [">= 3.0.0"])
|
44
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
|
43
45
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
44
46
|
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
47
|
+
s.add_development_dependency(%q<simplecov>, [">= 0.3.8"])
|
48
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
|
49
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
45
50
|
else
|
51
|
+
s.add_dependency(%q<actionpack>, [">= 3.0.0"])
|
52
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
46
53
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
47
54
|
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
55
|
+
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
56
|
+
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
57
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
48
58
|
end
|
49
59
|
else
|
60
|
+
s.add_dependency(%q<actionpack>, [">= 3.0.0"])
|
61
|
+
s.add_dependency(%q<activesupport>, [">= 3.0.0"])
|
50
62
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
51
63
|
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
64
|
+
s.add_dependency(%q<simplecov>, [">= 0.3.8"])
|
65
|
+
s.add_dependency(%q<rspec>, ["~> 2.6.0"])
|
66
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
52
67
|
end
|
53
68
|
end
|
54
69
|
|
data/lib/autocomplete-off.rb
CHANGED
@@ -1,13 +1,22 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'active_support/concern'
|
3
|
+
require 'action_view/helpers/capture_helper'
|
4
|
+
require 'action_view/helpers/tag_helper'
|
5
|
+
|
1
6
|
module ActionView
|
2
7
|
module Helpers
|
3
8
|
module TagHelper
|
9
|
+
|
10
|
+
# rename original method for extending
|
11
|
+
alias_method :tag_without_autocomplete_off, :tag
|
12
|
+
|
4
13
|
# This re-opens the tag method which is used by every form builder helper
|
5
14
|
# to disable browsers autocomplete by default.
|
6
15
|
#
|
7
16
|
# Fields can use the browsers autocomplete by explicitly setting ":autocomplete => 'on'"
|
8
17
|
def tag(name, options = nil, open = false, escape = true)
|
9
|
-
options['autocomplete'] ||= 'off' if name == 'input'
|
10
|
-
|
18
|
+
options['autocomplete'] ||= 'off' if options.is_a?(Hash) and name.to_s == 'input' and ['password', 'text', 'email'].include?(options['type'].to_s)
|
19
|
+
tag_without_autocomplete_off(name, options, open, escape)
|
11
20
|
end
|
12
21
|
end
|
13
22
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
3
|
+
|
4
|
+
describe ActionView::Helpers::TagHelper do
|
5
|
+
describe "#tag" do
|
6
|
+
include ActionView::Helpers::TagHelper
|
7
|
+
|
8
|
+
it "should have autocomplete off on input type text" do
|
9
|
+
tag('input', { 'type' => 'text' }).should include('autocomplete="off"')
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should have autocomplete off on input type password" do
|
13
|
+
tag('input', { 'type' => 'password' }).should include('autocomplete="off"')
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should have autocomplete off on input type email" do
|
17
|
+
tag('input', { 'type' => 'email' }).should include('autocomplete="off"')
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should not have autocomplete off on a" do
|
21
|
+
tag('a').should_not include('autocomplete="off"')
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should not have autocomplete off on a with href attribute" do
|
25
|
+
tag('a', { 'href' => 'about:blank' }).should_not include('autocomplete="off"')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should not have autocomplete off on input type radio" do
|
29
|
+
tag('input', { 'type' => 'radio' }).should_not include('autocomplete="off"')
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should not have autocomplete off on input type text if manual disabled" do
|
33
|
+
tag('input', { 'type' => 'text', 'autocomplete' => 'on' }).should_not include('autocomplete="off"')
|
34
|
+
tag('input', { 'type' => 'text', 'autocomplete' => 'on' }).should include('autocomplete="on"')
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should not have autocomplete off on input type password if manual disabled" do
|
38
|
+
tag('input', { 'type' => 'password', 'autocomplete' => 'on' }).should_not include('autocomplete="off"')
|
39
|
+
tag('input', { 'type' => 'password', 'autocomplete' => 'on' }).should include('autocomplete="on"')
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should not have autocomplete off on input type email if manual disabled" do
|
43
|
+
tag('input', { 'type' => 'email', 'autocomplete' => 'on' }).should_not include('autocomplete="off"')
|
44
|
+
tag('input', { 'type' => 'email', 'autocomplete' => 'on' }).should include('autocomplete="on"')
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
|
4
|
+
require 'erb'
|
5
|
+
require 'active_support/concern'
|
6
|
+
require 'action_view/helpers/capture_helper'
|
7
|
+
require 'action_view/helpers/tag_helper'
|
8
|
+
require 'rspec'
|
9
|
+
require 'simplecov'
|
10
|
+
SimpleCov.start
|
11
|
+
require 'autocomplete-off'
|
12
|
+
|
13
|
+
# Requires supporting files with custom matchers and macros, etc,
|
14
|
+
# in ./support/ and its subdirectories.
|
15
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autocomplete-off
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,34 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-06-
|
12
|
+
date: 2011-06-08 00:00:00.000000000 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: actionpack
|
17
|
+
requirement: &24047340 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.0.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *24047340
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: activesupport
|
28
|
+
requirement: &24046640 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *24046640
|
15
37
|
- !ruby/object:Gem::Dependency
|
16
38
|
name: bundler
|
17
|
-
requirement: &
|
39
|
+
requirement: &24045780 !ruby/object:Gem::Requirement
|
18
40
|
none: false
|
19
41
|
requirements:
|
20
42
|
- - ~>
|
@@ -22,10 +44,10 @@ dependencies:
|
|
22
44
|
version: 1.0.0
|
23
45
|
type: :development
|
24
46
|
prerelease: false
|
25
|
-
version_requirements: *
|
47
|
+
version_requirements: *24045780
|
26
48
|
- !ruby/object:Gem::Dependency
|
27
49
|
name: jeweler
|
28
|
-
requirement: &
|
50
|
+
requirement: &24044860 !ruby/object:Gem::Requirement
|
29
51
|
none: false
|
30
52
|
requirements:
|
31
53
|
- - ~>
|
@@ -33,7 +55,40 @@ dependencies:
|
|
33
55
|
version: 1.6.2
|
34
56
|
type: :development
|
35
57
|
prerelease: false
|
36
|
-
version_requirements: *
|
58
|
+
version_requirements: *24044860
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: simplecov
|
61
|
+
requirement: &24006420 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - ! '>='
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.3.8
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *24006420
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: rspec
|
72
|
+
requirement: &24004420 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 2.6.0
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *24004420
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: yard
|
83
|
+
requirement: &24003620 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.6.0
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: *24003620
|
37
92
|
description: Adds `autocomplete="off"` html attribute to FormHelper generated input
|
38
93
|
tags by default.
|
39
94
|
email: alexdreher@lxmedia.net
|
@@ -53,8 +108,8 @@ files:
|
|
53
108
|
- autocomplete-off.gemspec
|
54
109
|
- init.rb
|
55
110
|
- lib/autocomplete-off.rb
|
56
|
-
-
|
57
|
-
-
|
111
|
+
- spec/autocomplete-off_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
58
113
|
has_rdoc: true
|
59
114
|
homepage: http://github.com/phatworx/autocomplete-off
|
60
115
|
licenses:
|
@@ -71,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
126
|
version: '0'
|
72
127
|
segments:
|
73
128
|
- 0
|
74
|
-
hash:
|
129
|
+
hash: 4285089215067781878
|
75
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
131
|
none: false
|
77
132
|
requirements:
|
data/test/helper.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'test/unit'
|
11
|
-
|
12
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
13
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
14
|
-
require 'autocomplete-off'
|
15
|
-
|
16
|
-
class Test::Unit::TestCase
|
17
|
-
end
|