jquery_nice_file_input_rails 1.1.3.1
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/jquery.nice-file-input.js +62 -0
- data/app/assets/javascripts/jquery.nice-file-input.min.js +1 -0
- data/app/assets/stylesheets/jquery.nice-file-input.css +21 -0
- data/app/assets/stylesheets/jquery.nice-file-input.min.css +3 -0
- data/jquery_nice_file_input_rails.gemspec +23 -0
- data/lib/jquery_nice_file_input_rails.rb +2 -0
- data/lib/jquery_nice_file_input_rails/engine.rb +5 -0
- data/lib/jquery_nice_file_input_rails/version.rb +3 -0
- data/scripts/update_jquery_nice_file_input.sh +52 -0
- metadata +86 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: aebbcd1df42ac510782a337610032604e4596eaf
|
|
4
|
+
data.tar.gz: 385cabbd78f5cb56f0fb58a0cf57721765bceb23
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 8cf776646558e413f70475ecbe56ed7e72a2a21df61bcc6489876b36db8b0fb0442a23b08de6e4c064bbf69e913fe65958d58ace2a58b2bc08fc9ac34d9d4ace
|
|
7
|
+
data.tar.gz: 2bc7288c1163036ad9c10da8407626f52c353e0c3a5c75f89f8c5e607ad761be73b23989cf37d2651b42a5bfadbce2572cc684d13ff43419ec046d9b2fdb7fc5
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2013 Maxim Dobryakov
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# jquery_nice_file_input_rails
|
|
2
|
+
|
|
3
|
+
jQuery-Nice-File-Input asset bundle for Rails >= 3.2.x
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
* Rails 3.2.x/4.0.x support
|
|
8
|
+
* Clean and predictable update process (see scripts/update_jquery_nice_file_input.sh)
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
Add this line to your application's Gemfile:
|
|
13
|
+
|
|
14
|
+
gem 'jquery_nice_file_input_rails', '~> x.x.x' # where x.x.x latest gem version
|
|
15
|
+
|
|
16
|
+
## Usage
|
|
17
|
+
|
|
18
|
+
### Integration to Rails Asset Pipeline
|
|
19
|
+
|
|
20
|
+
Add single line to 'application.css':
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
/*
|
|
24
|
+
* require jquery.nice-file-input
|
|
25
|
+
*/
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then add single line to 'application.js':
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
//= require jquery.nice-file-input
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
That's all. Now you can use jQuery-Nice-File-Input inside your application.
|
|
35
|
+
|
|
36
|
+
> If you want to use minified JS & CSS versions of jQuery-Nice-File-Input then just replace `jquery.nice-file-input` to `jquery.nice-file-input.min` in code snippets provided above.
|
|
37
|
+
|
|
38
|
+
### In-place integration
|
|
39
|
+
|
|
40
|
+
If you want to use jQuery-Nice-File-Input in specified views only you can include its use the following commands:
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
<%= stylesheet_link_tag 'jquery.nice-file-input' %>
|
|
44
|
+
<%= javascript_include_tag 'jquery.nice-file-input' %>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Contributing
|
|
48
|
+
|
|
49
|
+
1. Fork it
|
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
|
51
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
|
53
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
(function(){
|
|
2
|
+
|
|
3
|
+
var uMatch = navigator.userAgent.match(/Firefox\/(.*)$/);
|
|
4
|
+
var ffVersion;
|
|
5
|
+
var ffSize = 4.3 ;
|
|
6
|
+
if (uMatch && uMatch.length > 1) {
|
|
7
|
+
ffVersion = uMatch[1];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
$.fn.niceFileInput = function(options){
|
|
11
|
+
var settings = $.extend( {
|
|
12
|
+
'width' : '500', //width of button
|
|
13
|
+
'height' : '30', //height of text
|
|
14
|
+
'btnText' : 'Browse', //text of the button
|
|
15
|
+
'btnWidth' : '100' , // width of button
|
|
16
|
+
'margin' : '20', // gap between textbox and button
|
|
17
|
+
}, options);
|
|
18
|
+
|
|
19
|
+
for(var i= 150 ; i <= settings.width ; i += 5)
|
|
20
|
+
{
|
|
21
|
+
ffSize = ffSize + 0.715;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
this.css({
|
|
25
|
+
'height':settings.height,
|
|
26
|
+
'width' :settings.width ,
|
|
27
|
+
'zIndex': '99',
|
|
28
|
+
'opacity': '0',
|
|
29
|
+
'position':'absolute',
|
|
30
|
+
'right':'0',
|
|
31
|
+
'top':'0',
|
|
32
|
+
'font-size' : '16px'
|
|
33
|
+
})
|
|
34
|
+
.wrap('<div class="fileWrapper" />')
|
|
35
|
+
.parent()
|
|
36
|
+
.css({
|
|
37
|
+
width : settings.width
|
|
38
|
+
})
|
|
39
|
+
.append("<input type='text' class='fileInputText' readonly='readonly' />")
|
|
40
|
+
.append("<input type='button' class='fileInputButton' value='"+settings.btnText+"' style='height:"+settings.height+"px ; width:"+settings.btnWidth+"px' />")
|
|
41
|
+
|
|
42
|
+
if(ffVersion < 22)
|
|
43
|
+
{
|
|
44
|
+
this.attr('size',ffSize);
|
|
45
|
+
}
|
|
46
|
+
this.parent().find('input[type="text"].fileInputText').css({
|
|
47
|
+
'height' : settings.height + "px" ,
|
|
48
|
+
'width' : function(){
|
|
49
|
+
return settings.width - settings.btnWidth - settings.margin + "px";
|
|
50
|
+
},
|
|
51
|
+
'line-height' : settings.height + "px"
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
this.change(function(){
|
|
55
|
+
var textPath = $(this).val().replace("C:\\fakepath\\", "");
|
|
56
|
+
$(this).closest('.fileWrapper').find(".fileInputText").val(textPath);
|
|
57
|
+
}
|
|
58
|
+
)};
|
|
59
|
+
|
|
60
|
+
return this;
|
|
61
|
+
})();
|
|
62
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){var e=navigator.userAgent.match(/Firefox\/(.*)$/);var t;var n=4.3;if(e&&e.length>1){t=e[1]}$.fn.niceFileInput=function(e){var r=$.extend({width:"500",height:"30",btnText:"Browse",btnWidth:"100",margin:"20"},e);for(var i=150;i<=r.width;i+=5){n=n+.715}this.css({height:r.height,width:r.width,zIndex:"99",opacity:"0",position:"absolute",right:"0",top:"0","font-size":"16px"}).wrap('<div class="fileWrapper" />').parent().css({width:r.width}).append("<input type='text' class='fileInputText' readonly='readonly' />").append("<input type='button' class='fileInputButton' value='"+r.btnText+"' style='height:"+r.height+"px ; width:"+r.btnWidth+"px' />");if(t<22){this.attr("size",n)}this.parent().find('input[type="text"].fileInputText').css({height:r.height+"px",width:function(){return r.width-r.btnWidth-r.margin+"px"},"line-height":r.height+"px"});this.change(function(){var e=$(this).val().replace("C:\\fakepath\\","");$(this).closest(".fileWrapper").find(".fileInputText").val(e)})};return this})()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.fileWrapper{
|
|
2
|
+
position:relative;
|
|
3
|
+
padding:0;
|
|
4
|
+
overflow:hidden
|
|
5
|
+
}
|
|
6
|
+
input[type="text"].fileInputText{
|
|
7
|
+
float:left;
|
|
8
|
+
border:1px solid #ddd ;
|
|
9
|
+
padding:0 5px;
|
|
10
|
+
margin:0
|
|
11
|
+
}
|
|
12
|
+
input[type="button"].fileInputButton{
|
|
13
|
+
float:right;
|
|
14
|
+
border:solid 1px #ccc;
|
|
15
|
+
background:#ddd;
|
|
16
|
+
margin:0;
|
|
17
|
+
padding:0;
|
|
18
|
+
box-sizing:content-box;
|
|
19
|
+
-moz-box-sizing:content-box;
|
|
20
|
+
-webkit-box-sizing:content-box
|
|
21
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
.fileWrapper{position:relative;overflow:hidden;padding:0}
|
|
2
|
+
input[type=text].fileInputText{float:left;border:1px solid #ddd;margin:0;padding:0 5px}
|
|
3
|
+
input[type=button].fileInputButton{float:right;border:solid 1px #ccc;background:#ddd;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;margin:0;padding:0}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'jquery_nice_file_input_rails/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "jquery_nice_file_input_rails"
|
|
8
|
+
spec.version = JqueryNiceFileInputRails::VERSION
|
|
9
|
+
spec.authors = ["Maxim Dobryakov"]
|
|
10
|
+
spec.email = ["maxim.dobryakov@gmail.com"]
|
|
11
|
+
spec.description = %q{jQuery-Nice-File-Input asset bundle for Rails}
|
|
12
|
+
spec.summary = %q{jQuery-Nice-File-Input asset bundle for Rails 3.2.x/4.0.x}
|
|
13
|
+
spec.homepage = "https://github.com/maxd/jquery_nice_file_input_rails"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files`.split($/)
|
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
19
|
+
spec.require_paths = ["lib"]
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
|
22
|
+
spec.add_development_dependency "rake"
|
|
23
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/bin/bash -e
|
|
2
|
+
|
|
3
|
+
jnfi_dir='./tmp/jquery-nice-file-input'
|
|
4
|
+
|
|
5
|
+
jnfi_assets_dir='./app/assets'
|
|
6
|
+
jnfi_javascripts_dir="$jnfi_assets_dir/javascripts"
|
|
7
|
+
jnfi_stylesheets_dir="$jnfi_assets_dir/stylesheets"
|
|
8
|
+
|
|
9
|
+
error() {
|
|
10
|
+
echo -e -n "\033[1;31m$1"
|
|
11
|
+
echo -e '\033[0m'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
success() {
|
|
15
|
+
echo -e -n "\033[1;32m$1"
|
|
16
|
+
echo -e '\033[0m'
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
info() {
|
|
20
|
+
echo -e -n "\033[1;34m$1"
|
|
21
|
+
echo -e '\033[0m'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if [ $# -ne 1 ] ; then
|
|
25
|
+
error "USAGE: $0 <jQuery-Nice-File-Input version>"
|
|
26
|
+
exit 1
|
|
27
|
+
fi
|
|
28
|
+
|
|
29
|
+
if [ ! -d $jnfi_dir ]; then
|
|
30
|
+
info "jQuery-Nice-File-Input not found. Cloning to $jnfi_dir..."
|
|
31
|
+
git clone --quiet git://github.com/jaydevonline/jQuery-Nice-File-Input.git $jnfi_dir
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
info "Using $1..."
|
|
35
|
+
cd $jnfi_dir
|
|
36
|
+
git checkout --quiet "$1"
|
|
37
|
+
cd -
|
|
38
|
+
|
|
39
|
+
info "Remove $jnfi_assets_dir directory..."
|
|
40
|
+
rm -rf $jnfi_assets_dir
|
|
41
|
+
|
|
42
|
+
info "Copying JavaScript..."
|
|
43
|
+
mkdir -p $jnfi_javascripts_dir
|
|
44
|
+
cp $jnfi_dir/dist/jquery.nice-file-input.js $jnfi_javascripts_dir
|
|
45
|
+
cp $jnfi_dir/dist/jquery.nice-file-input.min.js $jnfi_javascripts_dir
|
|
46
|
+
|
|
47
|
+
info "Copying Stylesheets..."
|
|
48
|
+
mkdir -p $jnfi_stylesheets_dir
|
|
49
|
+
cp $jnfi_dir/dist/jquery.nice-file-input.css $jnfi_stylesheets_dir
|
|
50
|
+
cp $jnfi_dir/dist/jquery.nice-file-input.min.css $jnfi_stylesheets_dir
|
|
51
|
+
|
|
52
|
+
success "Done"
|
metadata
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: jquery_nice_file_input_rails
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.1.3.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Maxim Dobryakov
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2013-09-11 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ~>
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.3'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ~>
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.3'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - '>='
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - '>='
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
description: jQuery-Nice-File-Input asset bundle for Rails
|
|
42
|
+
email:
|
|
43
|
+
- maxim.dobryakov@gmail.com
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- .gitignore
|
|
49
|
+
- Gemfile
|
|
50
|
+
- LICENSE.txt
|
|
51
|
+
- README.md
|
|
52
|
+
- Rakefile
|
|
53
|
+
- app/assets/javascripts/jquery.nice-file-input.js
|
|
54
|
+
- app/assets/javascripts/jquery.nice-file-input.min.js
|
|
55
|
+
- app/assets/stylesheets/jquery.nice-file-input.css
|
|
56
|
+
- app/assets/stylesheets/jquery.nice-file-input.min.css
|
|
57
|
+
- jquery_nice_file_input_rails.gemspec
|
|
58
|
+
- lib/jquery_nice_file_input_rails.rb
|
|
59
|
+
- lib/jquery_nice_file_input_rails/engine.rb
|
|
60
|
+
- lib/jquery_nice_file_input_rails/version.rb
|
|
61
|
+
- scripts/update_jquery_nice_file_input.sh
|
|
62
|
+
homepage: https://github.com/maxd/jquery_nice_file_input_rails
|
|
63
|
+
licenses:
|
|
64
|
+
- MIT
|
|
65
|
+
metadata: {}
|
|
66
|
+
post_install_message:
|
|
67
|
+
rdoc_options: []
|
|
68
|
+
require_paths:
|
|
69
|
+
- lib
|
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - '>='
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '0'
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - '>='
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
requirements: []
|
|
81
|
+
rubyforge_project:
|
|
82
|
+
rubygems_version: 2.0.6
|
|
83
|
+
signing_key:
|
|
84
|
+
specification_version: 4
|
|
85
|
+
summary: jQuery-Nice-File-Input asset bundle for Rails 3.2.x/4.0.x
|
|
86
|
+
test_files: []
|