minofare-g_fieldhighlighter 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Manifest.txt +19 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +67 -0
- data/Rakefile +29 -0
- data/lib/g_fieldhighlighter.rb +12 -0
- data/lib/g_fieldhighlighter/view_helpers.rb +12 -0
- data/rails_generators/fieldhighlighter_assets/fieldhighlighter_assets_generator.rb +14 -0
- data/rails_generators/fieldhighlighter_assets/templates/guilded.fieldhighlighter.js +10 -0
- data/rails_generators/fieldhighlighter_assets/templates/jquery.fieldhighlighter-1.0.js +37 -0
- data/rails_generators/fieldhighlighter_assets/templates/jquery.fieldhighlighter-1.0.min.js +4 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/g_fieldhighlighter_spec.rb +11 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +10 -0
- data/tasks/rspec.rake +21 -0
- metadata +104 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
PostInstall.txt
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
6
|
+
g_fieldhighlighter.gemspec
|
7
|
+
lib/g_fieldhighlighter.rb
|
8
|
+
lib/g_fieldhighlighter/view_helpers.rb
|
9
|
+
rails_generators/fieldhighlighter_assets/fieldhighlighter_assets_generator.rb
|
10
|
+
rails_generators/fieldhighlighter_assets/templates/guilded.fieldhighlighter.js
|
11
|
+
rails_generators/fieldhighlighter_assets/templates/jquery.fieldhighlighter-1.0.js
|
12
|
+
rails_generators/fieldhighlighter_assets/templates/jquery.fieldhighlighter-1.0.min.js
|
13
|
+
script/console
|
14
|
+
script/destroy
|
15
|
+
script/generate
|
16
|
+
spec/g_fieldhighlighter_spec.rb
|
17
|
+
spec/spec.opts
|
18
|
+
spec/spec_helper.rb
|
19
|
+
tasks/rspec.rake
|
data/PostInstall.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
= g_fieldhighlighter
|
2
|
+
|
3
|
+
http://github.com/minofare/g_fieldhighlighter/tree/master
|
4
|
+
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
A Guilded (http://github.com/midas/guilded/tree/master) component that highlights form fields when they are selected or when they
|
9
|
+
have a validation error.
|
10
|
+
|
11
|
+
|
12
|
+
== FEATURES:
|
13
|
+
|
14
|
+
* Adds the class 'selected' to fields that are focused
|
15
|
+
* Adds the class 'error' to fields with validation exceptions
|
16
|
+
|
17
|
+
|
18
|
+
== USAGE:
|
19
|
+
|
20
|
+
Inside form helper (most usually in the _form.html.erb):
|
21
|
+
|
22
|
+
<% g_fieldhighlighter :form_class => 'itemForm' %>
|
23
|
+
|
24
|
+
|
25
|
+
== REQUIREMENTS:
|
26
|
+
|
27
|
+
* Rails >= 2.2.0
|
28
|
+
* Guilded >= 0.1.0 (http://github.com/midas/guilded/tree/master)
|
29
|
+
|
30
|
+
|
31
|
+
== INSTALL:
|
32
|
+
|
33
|
+
sudo gem install minofare-g_fieldhighlighter
|
34
|
+
|
35
|
+
In rails environment.rb file:
|
36
|
+
|
37
|
+
config.gem 'minofare_g_fieldhighlighter', :version => "1.0.0", :lib => 'g_fieldhighlighter', :source => 'http://gems.github.com'
|
38
|
+
|
39
|
+
Generate:
|
40
|
+
|
41
|
+
script/generate fieldhighlighter_assets
|
42
|
+
|
43
|
+
|
44
|
+
== LICENSE:
|
45
|
+
|
46
|
+
(The MIT License)
|
47
|
+
|
48
|
+
Copyright (c) 2009 Michael Baumgarten (minofare)
|
49
|
+
|
50
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
51
|
+
a copy of this software and associated documentation files (the
|
52
|
+
'Software'), to deal in the Software without restriction, including
|
53
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
54
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
55
|
+
permit persons to whom the Software is furnished to do so, subject to
|
56
|
+
the following conditions:
|
57
|
+
|
58
|
+
The above copyright notice and this permission notice shall be
|
59
|
+
included in all copies or substantial portions of the Software.
|
60
|
+
|
61
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
62
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
63
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
64
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
65
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
66
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
67
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
|
2
|
+
require File.dirname(__FILE__) + '/lib/g_fieldhighlighter'
|
3
|
+
|
4
|
+
# Generate all the Rake tasks
|
5
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
6
|
+
$hoe = Hoe.new('g_fieldhighlighter', GFieldhighlighter::VERSION) do |p|
|
7
|
+
p.developer('Michael Baumgarten (Minofare)', 'mbaumgarten@minofare.com')
|
8
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
9
|
+
p.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
10
|
+
p.rubyforge_name = p.name # TODO this is default value
|
11
|
+
# p.extra_deps = [
|
12
|
+
# ['activesupport','>= 2.0.2'],
|
13
|
+
# ]
|
14
|
+
p.extra_dev_deps = [
|
15
|
+
['newgem', ">= #{::Newgem::VERSION}"],
|
16
|
+
['midas-guilded', ">= 0.0.9"]
|
17
|
+
]
|
18
|
+
|
19
|
+
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
20
|
+
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
21
|
+
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
22
|
+
p.rsync_args = '-av --delete --ignore-errors'
|
23
|
+
end
|
24
|
+
|
25
|
+
require 'newgem/tasks' # load /tasks/*.rake
|
26
|
+
Dir['tasks/**/*.rake'].each { |t| load t }
|
27
|
+
|
28
|
+
# TODO - want other tests/tasks run by default? Add them to the list
|
29
|
+
# task :default => [:spec, :features]
|
@@ -0,0 +1,12 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__)) unless
|
2
|
+
$:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
3
|
+
|
4
|
+
require 'g_fieldhighlighter/view_helpers'
|
5
|
+
|
6
|
+
module GFieldhighlighter
|
7
|
+
VERSION = '1.0.0'
|
8
|
+
end
|
9
|
+
|
10
|
+
if defined? ActionView::Base
|
11
|
+
ActionView::Base.send( :include, GFieldhighlighter::ViewHelpers ) unless ActionView::Base.include?( GFieldhighlighter::ViewHelpers )
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module GFieldhighlighter
|
2
|
+
module ViewHelpers
|
3
|
+
def g_fieldhighlighter( *args )
|
4
|
+
return if Guilded::Guilder.instance.include_component?( :fieldhighlighter ) # We only need one field highligher per page
|
5
|
+
options = args.extract_options!
|
6
|
+
throw Guilded::Exception::GuildedException.new( "'form_class' is a required option" ) unless options.has_key?( :form_class )
|
7
|
+
options.merge!( :id => "fieldhighlighter" )
|
8
|
+
Guilded::Guilder.instance.add( :fieldhighlighter, options, [ 'jquery/jquery.fieldhighlighter-1.0.min.js' ] )
|
9
|
+
''
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class FieldhighlighterAssetsGenerator < Rails::Generator::Base
|
2
|
+
def initialize(runtime_args, runtime_options = {})
|
3
|
+
super
|
4
|
+
end
|
5
|
+
|
6
|
+
def manifest
|
7
|
+
record do |m|
|
8
|
+
m.directory "public/javascripts/jquery"
|
9
|
+
m.file "guilded.fieldhighlighter.js", "public/javascripts/guilded.fieldhighlighter.js"
|
10
|
+
m.file "jquery.fieldhighlighter-1.0.js", "public/javascripts/jquery/jquery.fieldhighlighter-1.0.js"
|
11
|
+
m.file "jquery.fieldhighlighter-1.0.min.js", "public/javascripts/jquery/jquery.fieldhighlighter-1.0.min.js"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
g.fieldhighlighterInit = function( options )
|
2
|
+
{
|
3
|
+
if (g.beforeFieldhighlighterInit){
|
4
|
+
g.beforeFieldhighlighterInit(options);
|
5
|
+
}
|
6
|
+
$jc( options.form_class ).fieldhighlighter();
|
7
|
+
if (g.afterFieldhighlighterInit){
|
8
|
+
g.afterFieldhighlighterInit(options);
|
9
|
+
}
|
10
|
+
};
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/* jQuery Field Highlighter 1.0
|
2
|
+
* Copyright (c) 2009 Michael Baumgarten (minofare)
|
3
|
+
* jQuery Field Highlighter is licensed under the terms of the MIT License */
|
4
|
+
|
5
|
+
(function($){
|
6
|
+
$.fn.fieldhighlighter = function(options){
|
7
|
+
var settings = jQuery.extend({}, jQuery.fn.fieldhighlighter.settings, options);
|
8
|
+
|
9
|
+
return this.each(function(){
|
10
|
+
$('li table tbody tr td :input:text').focus(function(){
|
11
|
+
$(this).parent().parent().parent().addClass(settings.cssclass);
|
12
|
+
}).blur(function(){
|
13
|
+
$(this).parent().parent().parent().removeClass(settings.cssclass);
|
14
|
+
});
|
15
|
+
|
16
|
+
|
17
|
+
$('li :input:text, li :input:password, li textarea, li select, li :input:checkbox, li :input:radio').focus(function(){
|
18
|
+
//console.log("highlight");
|
19
|
+
$(this).parent().addClass(settings.cssclass);
|
20
|
+
}).blur(function(){
|
21
|
+
$(this).parent().removeClass(settings.cssclass);
|
22
|
+
});
|
23
|
+
|
24
|
+
$('li .inline-field :input:text, li .inline-field :input:password, li .inline-field textarea, li .inline-field select').focus(function(){
|
25
|
+
//console.log("highlight");
|
26
|
+
$(this).parent().parent().addClass(settings.cssclass);
|
27
|
+
}).blur(function(){
|
28
|
+
$(this).parent().parent().removeClass(settings.cssclass);
|
29
|
+
});
|
30
|
+
|
31
|
+
});
|
32
|
+
};
|
33
|
+
$.fn.fieldhighlighter.settings = {
|
34
|
+
cssclass: "highlight",
|
35
|
+
field: "li"
|
36
|
+
};
|
37
|
+
})(jQuery);
|
@@ -0,0 +1,4 @@
|
|
1
|
+
/* jQuery Field Highlighter 1.0
|
2
|
+
* Copyright (c) 2009 Michael Baumgarten (minofare)
|
3
|
+
* jQuery Field Highlighter is licensed under the terms of the MIT License */
|
4
|
+
(function($){$.fn.fieldhighlighter=function(options){var settings=jQuery.extend({},jQuery.fn.fieldhighlighter.settings,options);return this.each(function(){$('li table tbody tr td :input:text').focus(function(){$(this).parent().parent().parent().addClass(settings.cssclass);}).blur(function(){$(this).parent().parent().parent().removeClass(settings.cssclass);});$('li :input:text, li :input:password, li textarea, li select, li :input:checkbox, li :input:radio').focus(function(){$(this).parent().addClass(settings.cssclass);}).blur(function(){$(this).parent().removeClass(settings.cssclass);});$('li .inline-field :input:text, li .inline-field :input:password, li .inline-field textarea, li .inline-field select').focus(function(){$(this).parent().parent().addClass(settings.cssclass);}).blur(function(){$(this).parent().parent().removeClass(settings.cssclass);});});};$.fn.fieldhighlighter.settings={cssclass:"highlight",field:"li"};})(jQuery);
|
data/script/console
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# File: script/console
|
3
|
+
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
+
|
5
|
+
libs = " -r irb/completion"
|
6
|
+
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
+
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
+
libs << " -r #{File.dirname(__FILE__) + '/../lib/g_fieldhighlighter.rb'}"
|
9
|
+
puts "Loading g_fieldhighlighter gem"
|
10
|
+
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/destroy'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'rubigen'
|
6
|
+
rescue LoadError
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rubigen'
|
9
|
+
end
|
10
|
+
require 'rubigen/scripts/generate'
|
11
|
+
|
12
|
+
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
+
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV)
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/spec/spec_helper.rb
ADDED
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new do |t|
|
19
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: minofare-g_fieldhighlighter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Baumgarten (Minofare)
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-31 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: newgem
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.2.3
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: midas-guilded
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.0.9
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: hoe
|
37
|
+
type: :development
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.8.0
|
44
|
+
version:
|
45
|
+
description: A Guilded (http://github.com/midas/guilded/tree/master) component that highlights form fields when they are selected or when they have a validation error.
|
46
|
+
email:
|
47
|
+
- mbaumgarten@minofare.com
|
48
|
+
executables: []
|
49
|
+
|
50
|
+
extensions: []
|
51
|
+
|
52
|
+
extra_rdoc_files:
|
53
|
+
- History.txt
|
54
|
+
- Manifest.txt
|
55
|
+
- PostInstall.txt
|
56
|
+
- README.rdoc
|
57
|
+
files:
|
58
|
+
- History.txt
|
59
|
+
- Manifest.txt
|
60
|
+
- PostInstall.txt
|
61
|
+
- README.rdoc
|
62
|
+
- Rakefile
|
63
|
+
- lib/g_fieldhighlighter.rb
|
64
|
+
- lib/g_fieldhighlighter/view_helpers.rb
|
65
|
+
- rails_generators/fieldhighlighter_assets/fieldhighlighter_assets_generator.rb
|
66
|
+
- rails_generators/fieldhighlighter_assets/templates/guilded.fieldhighlighter.js
|
67
|
+
- rails_generators/fieldhighlighter_assets/templates/jquery.fieldhighlighter-1.0.js
|
68
|
+
- rails_generators/fieldhighlighter_assets/templates/jquery.fieldhighlighter-1.0.min.js
|
69
|
+
- script/console
|
70
|
+
- script/destroy
|
71
|
+
- script/generate
|
72
|
+
- spec/g_fieldhighlighter_spec.rb
|
73
|
+
- spec/spec.opts
|
74
|
+
- spec/spec_helper.rb
|
75
|
+
- tasks/rspec.rake
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://github.com/minofare/g_fieldhighlighter/tree/master
|
78
|
+
post_install_message: PostInstall.txt
|
79
|
+
rdoc_options:
|
80
|
+
- --main
|
81
|
+
- README.rdoc
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: "0"
|
89
|
+
version:
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: "0"
|
95
|
+
version:
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project: g_fieldhighlighter
|
99
|
+
rubygems_version: 1.2.0
|
100
|
+
signing_key:
|
101
|
+
specification_version: 2
|
102
|
+
summary: A Guilded (http://github.com/midas/guilded/tree/master) component that highlights form fields when they are selected or when they have a validation error.
|
103
|
+
test_files: []
|
104
|
+
|