rails-fort 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +96 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/fort.js.erb +21 -0
- data/app/assets/stylesheets/fort.css +31 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/rails/fort/version.rb +5 -0
- data/lib/rails/fort.rb +8 -0
- data/npm-debug.log +18 -0
- data/rails-fort.gemspec +32 -0
- data/vendor/assets/javascripts/rails.fort.js +270 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c7bccfd456c3f03cacc0c022db41f7f3f1909dea
|
4
|
+
data.tar.gz: 7e55e0521c8eb4d765b20f0c9fb88d611054ca50
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c46f00b185b4229f4208dfa2094799880a66de196cce07ee3453b5e74ab868c028e7d74600966d1f4515b3757e0619ad50d0875093a8452a07d909c57cb1a67
|
7
|
+
data.tar.gz: 3e8fcd1feaa0dd913dc1bb57936084d07e22ad12208443808f9de184c9328f453b10842ab1445b321372f666d4f704da0feab0c2904fee427955c497671f2561
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 ethiraj
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
# Rails::Fort
|
2
|
+
|
3
|
+
rails-fort gem gives you modern progress bar for form completion
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rails-fort'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle install
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install rails-fort
|
20
|
+
|
21
|
+
To use this gem add this require statement to your application.js file:
|
22
|
+
|
23
|
+
//= require fort
|
24
|
+
|
25
|
+
and in application.css file
|
26
|
+
|
27
|
+
*= require fort
|
28
|
+
|
29
|
+
|
30
|
+
## Usage
|
31
|
+
|
32
|
+
<div class="form">
|
33
|
+
<form method="post">
|
34
|
+
<input type="text">
|
35
|
+
</form>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
Certain fields:
|
39
|
+
|
40
|
+
If you want to exclude certain fields add a class named 'ignore' to the field. rails-fort will not detect the field after you do so.
|
41
|
+
|
42
|
+
Example
|
43
|
+
|
44
|
+
<input type="text" class='ignore'>
|
45
|
+
|
46
|
+
|
47
|
+
You can also set default configuration in fort.yml under config folder, example
|
48
|
+
|
49
|
+
height: '20px'
|
50
|
+
duration: '3s'
|
51
|
+
alignment: 'bottom'
|
52
|
+
type: 'solid'
|
53
|
+
value: '#009DFF'
|
54
|
+
|
55
|
+
|
56
|
+
Effects:
|
57
|
+
|
58
|
+
* Solid
|
59
|
+
|
60
|
+
type: 'solid'
|
61
|
+
value: '#009DFF'
|
62
|
+
|
63
|
+
* Gradient
|
64
|
+
|
65
|
+
type: 'gradient'
|
66
|
+
value: ["#009DFF", "#47B9FF"]
|
67
|
+
|
68
|
+
Note: Only two values can be passed
|
69
|
+
|
70
|
+
* Sections
|
71
|
+
|
72
|
+
type: 'sections'
|
73
|
+
value: ["#009DFF", "#4AF2A1", "#FB5229"]
|
74
|
+
|
75
|
+
* Flash
|
76
|
+
|
77
|
+
type: 'flash'
|
78
|
+
value: ["#009DFF", "#000", "#6638F0"]
|
79
|
+
|
80
|
+
* Merge
|
81
|
+
|
82
|
+
type: 'merge'
|
83
|
+
value: '#009DFF'
|
84
|
+
|
85
|
+
effects can be added by changing type and value fields in fort.yml
|
86
|
+
|
87
|
+
|
88
|
+
## Contributing
|
89
|
+
|
90
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/ethirajsrinivasan/rails-fort. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
91
|
+
|
92
|
+
|
93
|
+
## License
|
94
|
+
|
95
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
96
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
//= require rails.fort
|
2
|
+
|
3
|
+
$(document).ready(function(){
|
4
|
+
<% path_to_file = "#{Rails.root}/config/fort.yml" %>
|
5
|
+
<% if File.exist?(path_to_file) %>
|
6
|
+
fortconfig = <%= JSON.dump(YAML.load_file(path_to_file)) %>;
|
7
|
+
if (fortconfig.type == null)
|
8
|
+
fortconfig.type = "solid"
|
9
|
+
if(fortconfig.value instanceof Array)
|
10
|
+
Fort[fortconfig.type].apply(this,fortconfig.value)
|
11
|
+
else
|
12
|
+
Fort[fortconfig.type](fortconfig.value)
|
13
|
+
Fort.config({
|
14
|
+
height: fortconfig.height,
|
15
|
+
duration: fortconfig.duration,
|
16
|
+
alignment: fortconfig.alignment
|
17
|
+
});
|
18
|
+
<% else %>
|
19
|
+
Fort.solid("#009DFF");
|
20
|
+
<% end %>
|
21
|
+
});
|
@@ -0,0 +1,31 @@
|
|
1
|
+
.top-one {
|
2
|
+
background: #009dff;
|
3
|
+
/*background: linear-gradient(to right, #009dff 0, #00c8ff 100%);*/
|
4
|
+
position: fixed;
|
5
|
+
z-index: 1031;
|
6
|
+
top: 0;
|
7
|
+
left: 0;
|
8
|
+
height: 4px;
|
9
|
+
transition: all 1s;
|
10
|
+
width: 0;
|
11
|
+
overflow: hidden;
|
12
|
+
}
|
13
|
+
/*.top-two is for merge() only*/
|
14
|
+
.top-two {
|
15
|
+
background: #009dff;
|
16
|
+
/*background: linear-gradient(to right, #009dff 0, #00c8ff 100%);*/
|
17
|
+
position: fixed;
|
18
|
+
z-index: 1031;
|
19
|
+
top: 0;
|
20
|
+
right: 0;
|
21
|
+
transform: rotate(180deg);
|
22
|
+
height: 4px;
|
23
|
+
transition: all 1s;
|
24
|
+
width: 0;
|
25
|
+
overflow: hidden;
|
26
|
+
}
|
27
|
+
|
28
|
+
.colors {
|
29
|
+
width: 100%;
|
30
|
+
height: 4px;
|
31
|
+
}
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rails/fort"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/rails/fort.rb
ADDED
data/npm-debug.log
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
0 info it worked if it ends with ok
|
2
|
+
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'completion' ]
|
3
|
+
2 info using npm@1.3.10
|
4
|
+
3 info using node@v0.10.25
|
5
|
+
4 error Error: ENOENT, open '/usr/share/npm/lib/utils/completion.sh'
|
6
|
+
5 error If you need help, you may report this log at:
|
7
|
+
5 error <http://github.com/isaacs/npm/issues>
|
8
|
+
5 error or email it to:
|
9
|
+
5 error <npm-@googlegroups.com>
|
10
|
+
6 error System Linux 3.19.0-25-generic
|
11
|
+
7 error command "/usr/bin/nodejs" "/usr/bin/npm" "completion"
|
12
|
+
8 error cwd /home/ethi/apps/gems/rails-fort
|
13
|
+
9 error node -v v0.10.25
|
14
|
+
10 error npm -v 1.3.10
|
15
|
+
11 error path /usr/share/npm/lib/utils/completion.sh
|
16
|
+
12 error code ENOENT
|
17
|
+
13 error errno 34
|
18
|
+
14 verbose exit [ 34, true ]
|
data/rails-fort.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rails/fort/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rails-fort"
|
8
|
+
spec.version = Rails::Fort::VERSION
|
9
|
+
spec.authors = ["ethiraj"]
|
10
|
+
spec.email = ["ethirajsrinivasan@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Modern progress bar for form completion"
|
13
|
+
spec.description = "Modern progress bar for form completion"
|
14
|
+
spec.homepage = "https://github.com/ethirajsrinivasan/rails-fort"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
|
18
|
+
# delete this section to allow pushing this gem to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata['allowed_push_host'] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
31
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
32
|
+
end
|
@@ -0,0 +1,270 @@
|
|
1
|
+
var Fort = {
|
2
|
+
solid: function solid(hex) {
|
3
|
+
document.body.innerHTML = '<div class="top-one" id="top1"><div class="colors"></div></div>' + document.body.innerHTML;
|
4
|
+
|
5
|
+
function cback(e) {
|
6
|
+
var t = [];
|
7
|
+
for (var n = inputs.length; n--;) {
|
8
|
+
if (!inputs[n].value.length) t.push(inputs[n]);
|
9
|
+
}
|
10
|
+
var r = t.length;
|
11
|
+
var i = inputs.length;
|
12
|
+
var s = document.querySelectorAll(".top-one");
|
13
|
+
for (var o = s.length; o--;) {
|
14
|
+
s[o].style.width = 100 - r / i * 100 + "%";
|
15
|
+
}
|
16
|
+
|
17
|
+
//Set color of bar as solid
|
18
|
+
document.getElementById("top1").style.background = hex;
|
19
|
+
}
|
20
|
+
var forms = document.querySelectorAll(".form"),
|
21
|
+
inputs = [];
|
22
|
+
for (var i = forms.length; i--;) {
|
23
|
+
var els = forms[i].querySelectorAll("input, textarea, select");
|
24
|
+
for (var j = els.length; j--;) {
|
25
|
+
classes = els[j].className.replace(/\s+/g, ' ').split(' ');
|
26
|
+
ignore = false;
|
27
|
+
for (var k = classes.length; k--;) {
|
28
|
+
if (classes[k] == "ignore") {
|
29
|
+
ignore = true;
|
30
|
+
break;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
if (els[j].type != "button" && els[j].type != "submit" && !ignore) {
|
34
|
+
inputs.push(els[j]);
|
35
|
+
els[j].addEventListener("input", cback, false);
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
},
|
40
|
+
|
41
|
+
gradient: function(firstColor, secondColor) {
|
42
|
+
document.body.innerHTML = '<div class="top-one" id="top1"><div class="colors"></div></div>' + document.body.innerHTML;
|
43
|
+
|
44
|
+
function cback(e) {
|
45
|
+
var t = [];
|
46
|
+
for (var n = inputs.length; n--;) {
|
47
|
+
if (!inputs[n].value.length) t.push(inputs[n]);
|
48
|
+
}
|
49
|
+
var r = t.length;
|
50
|
+
var i = inputs.length;
|
51
|
+
var s = document.querySelectorAll(".top-one");
|
52
|
+
for (var o = s.length; o--;) {
|
53
|
+
s[o].style.width = 100 - r / i * 100 + "%";
|
54
|
+
}
|
55
|
+
orientation = 'to right';
|
56
|
+
var string = 'linear-gradient(' + orientation + ', ' + firstColor + ', ' + secondColor + ')';
|
57
|
+
document.getElementById("top1").style.background = string;
|
58
|
+
}
|
59
|
+
var forms = document.querySelectorAll(".form"),
|
60
|
+
inputs = [];
|
61
|
+
for (var i = forms.length; i--;) {
|
62
|
+
var els = forms[i].querySelectorAll("input, textarea, select");
|
63
|
+
for (var j = els.length; j--;) {
|
64
|
+
classes = els[j].className.replace(/\s+/g, ' ').split(' ');
|
65
|
+
ignore = false;
|
66
|
+
for (var k = classes.length; k--;) {
|
67
|
+
if (classes[k] == "ignore") {
|
68
|
+
ignore = true;
|
69
|
+
break;
|
70
|
+
}
|
71
|
+
}
|
72
|
+
if (els[j].type != "button" && els[j].type != "submit" && !ignore) {
|
73
|
+
inputs.push(els[j]);
|
74
|
+
els[j].addEventListener("input", cback, false);
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}
|
78
|
+
},
|
79
|
+
|
80
|
+
sections: function() {
|
81
|
+
for (var i = 0; i < arguments.length; ++i) {
|
82
|
+
var args = Array.prototype.slice.call(arguments);
|
83
|
+
}
|
84
|
+
|
85
|
+
document.body.innerHTML = '<div class="top-one" id="top1"><div class="colors"></div></div>' + document.body.innerHTML;
|
86
|
+
|
87
|
+
function cback(e) {
|
88
|
+
var t = [];
|
89
|
+
for (var n = inputs.length; n--;) {
|
90
|
+
if (!inputs[n].value.length) t.push(inputs[n]);
|
91
|
+
}
|
92
|
+
var r = t.length;
|
93
|
+
var i = inputs.length;
|
94
|
+
var s = document.querySelectorAll(".top-one");
|
95
|
+
for (var o = s.length; o--;) {
|
96
|
+
s[o].style.width = 100 - r / i * 100 + "%";
|
97
|
+
}
|
98
|
+
}
|
99
|
+
var forms = document.querySelectorAll(".form"),
|
100
|
+
inputs = [];
|
101
|
+
for (var i = forms.length; i--;) {
|
102
|
+
var els = forms[i].querySelectorAll("input, textarea, select");
|
103
|
+
for (var j = els.length; j--;) {
|
104
|
+
classes = els[j].className.replace(/\s+/g, ' ').split(' ');
|
105
|
+
ignore = false;
|
106
|
+
for (var k = classes.length; k--;) {
|
107
|
+
if (classes[k] == "ignore") {
|
108
|
+
ignore = true;
|
109
|
+
break;
|
110
|
+
}
|
111
|
+
}
|
112
|
+
if (els[j].type != "button" && els[j].type != "submit" && !ignore) {
|
113
|
+
inputs.push(els[j]);
|
114
|
+
els[j].addEventListener("input", cback, false);
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
|
120
|
+
function colDistr(input) {
|
121
|
+
var result = [],
|
122
|
+
step = 0;
|
123
|
+
for (i = 0; i < input.length * 2; i++) {
|
124
|
+
if (i % 2) step++;
|
125
|
+
var perc = Math.floor(step * 1000 / input.length) / 10;
|
126
|
+
result.push([input[i - step], perc + "%"]);
|
127
|
+
}
|
128
|
+
return result;
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
function generateCSSGradient(colours) {
|
133
|
+
var l = colours.length,
|
134
|
+
i;
|
135
|
+
for (i = 0; i < l; i++) colours[i] = colours[i].join(" ");
|
136
|
+
return "linear-gradient( to right, " + colours.join(", ") + ")";
|
137
|
+
}
|
138
|
+
|
139
|
+
document.getElementsByClassName('top-one').innerHTML = '<div class="colors"></div>';
|
140
|
+
document.querySelector(".colors").style.background = generateCSSGradient(colDistr(args.sort()));
|
141
|
+
|
142
|
+
var window_width = window.innerWidth + "px";
|
143
|
+
document.querySelector(".colors").style.width = window_width;
|
144
|
+
},
|
145
|
+
|
146
|
+
|
147
|
+
flash: function() {
|
148
|
+
for (var i = 0; i < arguments.length; ++i) {
|
149
|
+
var totalSections = arguments.length;
|
150
|
+
var totalColors = arguments[i];
|
151
|
+
}
|
152
|
+
var args = Array.prototype.slice.call(arguments);
|
153
|
+
var cols = args.sort();
|
154
|
+
|
155
|
+
document.body.innerHTML = '<div class="top-one" id="top1"><div class="colors"></div></div>' + document.body.innerHTML;
|
156
|
+
|
157
|
+
function cback(e) {
|
158
|
+
var t = [];
|
159
|
+
for (var n = inputs.length; n--;) {
|
160
|
+
if (!inputs[n].value.length) t.push(inputs[n]);
|
161
|
+
}
|
162
|
+
var r = t.length;
|
163
|
+
var i = inputs.length;
|
164
|
+
var s = document.querySelectorAll(".top-one");
|
165
|
+
for (var o = s.length; o--;) {
|
166
|
+
s[o].style.width = 100 - r / i * 100 + "%";
|
167
|
+
s[o].style.background = cols[i - r - 1];
|
168
|
+
}
|
169
|
+
}
|
170
|
+
var forms = document.querySelectorAll(".form"),
|
171
|
+
inputs = [];
|
172
|
+
for (var i = forms.length; i--;) {
|
173
|
+
var els = forms[i].querySelectorAll("input, textarea, select");
|
174
|
+
for (var j = els.length; j--;) {
|
175
|
+
classes = els[j].className.replace(/\s+/g, ' ').split(' ');
|
176
|
+
ignore = false;
|
177
|
+
for (var k = classes.length; k--;) {
|
178
|
+
if (classes[k] == "ignore") {
|
179
|
+
ignore = true;
|
180
|
+
break;
|
181
|
+
}
|
182
|
+
}
|
183
|
+
if (els[j].type != "button" && els[j].type != "submit" && !ignore) {
|
184
|
+
inputs.push(els[j]);
|
185
|
+
els[j].addEventListener("input", cback, false);
|
186
|
+
}
|
187
|
+
|
188
|
+
}
|
189
|
+
}
|
190
|
+
},
|
191
|
+
|
192
|
+
merge: function(hex) {
|
193
|
+
document.body.innerHTML = '<div class="top-one" id="top1"><div class="colors"></div></div>' + document.body.innerHTML;
|
194
|
+
document.body.innerHTML = '<div class="top-two" id="top2"><div class="colors"></div></div>' + document.body.innerHTML;
|
195
|
+
|
196
|
+
function cback(e) {
|
197
|
+
var t = [];
|
198
|
+
for (var n = inputs.length; n--;) {
|
199
|
+
if (!inputs[n].value.length) t.push(inputs[n]);
|
200
|
+
}
|
201
|
+
var r = t.length;
|
202
|
+
var i = inputs.length;
|
203
|
+
var s = document.querySelectorAll("#top1");
|
204
|
+
|
205
|
+
for (var o = s.length; o--;) {
|
206
|
+
precalct = 100 - r / i * 100;
|
207
|
+
var precalct2 = precalct / 2;
|
208
|
+
s[o].style.width = precalct2 + "%";
|
209
|
+
}
|
210
|
+
|
211
|
+
var r = t.length;
|
212
|
+
var i = inputs.length;
|
213
|
+
var s = document.querySelectorAll("#top2");
|
214
|
+
|
215
|
+
for (var o = s.length; o--;) {
|
216
|
+
precalct = 100 - r / i * 100;
|
217
|
+
var precalct2 = precalct / 2;
|
218
|
+
s[o].style.width = precalct2 + "%";
|
219
|
+
}
|
220
|
+
|
221
|
+
document.getElementById("top1").style.background = hex;
|
222
|
+
document.getElementById("top2").style.background = hex;
|
223
|
+
|
224
|
+
}
|
225
|
+
var forms = document.querySelectorAll(".form"),
|
226
|
+
inputs = [];
|
227
|
+
for (var i = forms.length; i--;) {
|
228
|
+
var els = forms[i].querySelectorAll("input, textarea, select");
|
229
|
+
for (var j = els.length; j--;) {
|
230
|
+
classes = els[j].className.replace(/\s+/g, ' ').split(' ');
|
231
|
+
ignore = false;
|
232
|
+
for (var k = classes.length; k--;) {
|
233
|
+
if (classes[k] == "ignore") {
|
234
|
+
ignore = true;
|
235
|
+
break;
|
236
|
+
}
|
237
|
+
}
|
238
|
+
if (els[j].type != "button" && els[j].type != "submit" && !ignore) {
|
239
|
+
inputs.push(els[j]);
|
240
|
+
els[j].addEventListener("input", cback, false);
|
241
|
+
}
|
242
|
+
}
|
243
|
+
}
|
244
|
+
},
|
245
|
+
config: function(settings) {
|
246
|
+
var t1 = document.querySelector('#top1');
|
247
|
+
var t2 = document.querySelector('#top2') || {style:{}};
|
248
|
+
if (settings.height) {
|
249
|
+
t1.style.height = settings.height;
|
250
|
+
t2.style.height = settings.height;
|
251
|
+
}
|
252
|
+
if (settings.alignment) {
|
253
|
+
if (settings.alignment === 'top') {
|
254
|
+
t1.style.top = 0;
|
255
|
+
t1.style.bottom = 'auto';
|
256
|
+
t2.style.top = 0;
|
257
|
+
t2.style.bottom = 'auto';
|
258
|
+
} else {
|
259
|
+
t1.style.top = 'auto';
|
260
|
+
t1.style.bottom = 0;
|
261
|
+
t2.style.top = 'auto';
|
262
|
+
t2.style.bottom = 0;
|
263
|
+
}
|
264
|
+
}
|
265
|
+
if (settings.duration) {
|
266
|
+
t1.style.transitionDuration = settings.duration;
|
267
|
+
t2.style.transitionDuration = settings.duration;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
};
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-fort
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ethiraj
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-14 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.10'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.10'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
description: Modern progress bar for form completion
|
42
|
+
email:
|
43
|
+
- ethirajsrinivasan@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".travis.yml"
|
50
|
+
- CODE_OF_CONDUCT.md
|
51
|
+
- Gemfile
|
52
|
+
- LICENSE.txt
|
53
|
+
- README.md
|
54
|
+
- Rakefile
|
55
|
+
- app/assets/javascripts/fort.js.erb
|
56
|
+
- app/assets/stylesheets/fort.css
|
57
|
+
- bin/console
|
58
|
+
- bin/setup
|
59
|
+
- lib/rails/fort.rb
|
60
|
+
- lib/rails/fort/version.rb
|
61
|
+
- npm-debug.log
|
62
|
+
- rails-fort.gemspec
|
63
|
+
- vendor/assets/javascripts/rails.fort.js
|
64
|
+
homepage: https://github.com/ethirajsrinivasan/rails-fort
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata:
|
68
|
+
allowed_push_host: https://rubygems.org
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.4.8
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: Modern progress bar for form completion
|
89
|
+
test_files: []
|