form-focus-rails 0.8 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ .DS_Store
@@ -0,0 +1,11 @@
1
+ # Form focus for Rails
2
+
3
+ Focus the first field in a form in a Rails application.
4
+
5
+ ## Usage
6
+
7
+ ```javascript
8
+ //= require form-focus-rails
9
+ ```
10
+
11
+ If you want the autofocus to work on a specific part of your page (say you want to exclude any inputs you have in your navigation bar), wrap this part of the page in a <tt>form-focus</tt> CSS class.
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'form-focus-rails/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "form-focus-rails"
8
+ gem.version = Form::Focus::Rails::VERSION
9
+ gem.authors = ["Tomislav Car"]
10
+ gem.email = ["tomislav@infinum.hr"]
11
+ gem.description = %q{Focus the first available field on a page}
12
+ gem.summary = %q{Quick and simple Rails gem for adding autofocusing to the first field of a form in a Rails application}
13
+ gem.homepage = "https://github.com/infinum"
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+ gem.add_dependency "railties", ">= 3.1"
21
+ end
@@ -0,0 +1,12 @@
1
+ require 'form-focus-rails/version'
2
+
3
+ module Form
4
+ module Focus
5
+ module Rails
6
+ class Engine < ::Rails::Engine
7
+ initializer 'form-focus-rails' do
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,7 @@
1
+ module Form
2
+ module Focus
3
+ module Rails
4
+ VERSION = "0.8.1"
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ jQuery(function($) {
2
+ var $parentElement = $('.form-focus')
3
+ if($parentElement.length == 0)
4
+ $parentElement = $('body')
5
+
6
+ var $input = $parentElement.find("input:text:visible, select:visible, textarea:visible, input[type=email]:visible")
7
+
8
+ if($input.length > 0){
9
+ $($input[0]).focus()
10
+ }
11
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: form-focus-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.8'
4
+ version: 0.8.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -33,7 +33,13 @@ email:
33
33
  executables: []
34
34
  extensions: []
35
35
  extra_rdoc_files: []
36
- files: []
36
+ files:
37
+ - .gitignore
38
+ - README.md
39
+ - form-focus-rails.gemspec
40
+ - lib/form-focus-rails.rb
41
+ - lib/form-focus-rails/version.rb
42
+ - vendor/assets/javascripts/form-focus-rails.js
37
43
  homepage: https://github.com/infinum
38
44
  licenses: []
39
45
  post_install_message: