spin_loader 0.0.2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/README.md +10 -1
- data/app/assets/javascript/spin_loader.coffee.erb +43 -0
- data/lib/generators/spin_loader/install/USAGE +10 -0
- data/lib/generators/spin_loader/install/install_generator.rb +12 -0
- data/lib/generators/spin_loader/install/templates/spin_loader_config.yml +26 -0
- data/lib/spin_loader/version.rb +1 -1
- data/spin_loader.gemspec +1 -1
- metadata +9 -6
- data/app/assets/javascript/spin_loader.js.coffee +0 -41
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42cc6abf5f08ddd69d341fd1cd10299a17fcf353
|
4
|
+
data.tar.gz: 5b13a2c75870bbef3533eaf3b7fb1a933c995308
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 742fea7f53ca253bb7ec03e11e41dece8829160f869663013c70a7da714598d3ca6bb79c56817c652e5e4ea0d00aef6fc62a9215b12cf55f50e0811f393bb067
|
7
|
+
data.tar.gz: cfea83c56915e16c49ab399eb304bf1800c91ca8bf2b08014b661bb6aae3a17862d761f9c993f49e38f2026fa0adf317c8a45b98675ff278a62dfb39f01f29bc
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -49,9 +49,18 @@ Now, you have 2 commands, one to start the loader e other to stop the loader.
|
|
49
49
|
// This starts the loader
|
50
50
|
root.start_loading()
|
51
51
|
|
52
|
-
//This stops the loader
|
52
|
+
// This stops the loader
|
53
53
|
root.stop_loading()
|
54
54
|
```
|
55
|
+
### Configure the Spinner
|
56
|
+
|
57
|
+
Run the generator:
|
58
|
+
|
59
|
+
$ rails g spin_loader:install
|
60
|
+
|
61
|
+
This will generate the file config/spin_loader_config.yml. Edit this file according to [Spin.js](http://fgnass.github.io/spin.js/).
|
62
|
+
|
63
|
+
> For changes on the config file to happen, you need to run rake tmp:clear.
|
55
64
|
|
56
65
|
## Contributing
|
57
66
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#= require spin.min
|
2
|
+
#= require_self
|
3
|
+
|
4
|
+
root = exports ? this
|
5
|
+
|
6
|
+
<% SPIN_LOADER_CONFIG = File.exist?("#{Rails.root}/config/spin_loader_config.yml") ? YAML.load(File.read("#{Rails.root}/config/spin_loader_config.yml"))[Rails.env].symbolize_keys : {lines: 13, length: 6, width: 2, radius: 5, corners: 1, rotate: 0, direction: 1, color: '#b1aea9', speed: 1, trail: 60, shadow: false, hwaccel: false, className: 'spinner', zIndex: 2e9, top: 'auto', left: 'auto'} %>
|
7
|
+
|
8
|
+
opts = {
|
9
|
+
lines: <%= SPIN_LOADER_CONFIG[:lines] %>
|
10
|
+
length: <%= SPIN_LOADER_CONFIG[:length] %>
|
11
|
+
width: <%= SPIN_LOADER_CONFIG[:width] %>
|
12
|
+
radius: <%= SPIN_LOADER_CONFIG[:radius] %>
|
13
|
+
corners: <%= SPIN_LOADER_CONFIG[:corners] %>
|
14
|
+
rotate: <%= SPIN_LOADER_CONFIG[:rotate] %>
|
15
|
+
direction: <%= SPIN_LOADER_CONFIG[:direction] %>
|
16
|
+
color: "<%= SPIN_LOADER_CONFIG[:color] %>"
|
17
|
+
speed: <%= SPIN_LOADER_CONFIG[:speed] %>
|
18
|
+
trail: <%= SPIN_LOADER_CONFIG[:trail] %>
|
19
|
+
shadow: <%= SPIN_LOADER_CONFIG[:shadow] %>
|
20
|
+
hwaccel: <%= SPIN_LOADER_CONFIG[:hwaccel] %>
|
21
|
+
className: "<%= SPIN_LOADER_CONFIG[:className] %>"
|
22
|
+
zIndex: <%= SPIN_LOADER_CONFIG[:zIndex] ||= 2e9 %>
|
23
|
+
top: "<%= SPIN_LOADER_CONFIG[:top] %>"
|
24
|
+
left: "<%= SPIN_LOADER_CONFIG[:left] %>"
|
25
|
+
}
|
26
|
+
|
27
|
+
target = undefined
|
28
|
+
spinner = new Spinner(opts).spin()
|
29
|
+
|
30
|
+
$ ->
|
31
|
+
$('body').prepend $('<div>').prop('id':'loading_overlay').addClass('loading_overlay')
|
32
|
+
target = $('#loading_overlay')
|
33
|
+
target.append(spinner.el)
|
34
|
+
$('.spinner').css
|
35
|
+
left : '50%'
|
36
|
+
top : '50%'
|
37
|
+
target.hide()
|
38
|
+
|
39
|
+
root.start_loading = ->
|
40
|
+
target.fadeIn('fast')
|
41
|
+
|
42
|
+
root.stop_loading = ->
|
43
|
+
target.fadeOut('fast')
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Description:
|
2
|
+
The spin_loader install generator creates a YAML file in your config directory and an initializer to load this config. The config has a separate section for each environment.
|
3
|
+
|
4
|
+
The config is loaded into a constant called SPIN_LOADER_CONFIG by default.
|
5
|
+
|
6
|
+
Examples:
|
7
|
+
rails generate spin_loader:install
|
8
|
+
|
9
|
+
Config: config/spin_loader_config.yml
|
10
|
+
Initializer: config/initializers/load_spin_loader_config.rb
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module SpinLoader
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
|
7
|
+
def generate_install
|
8
|
+
copy_file 'spin_loader_config.yml', 'config/spin_loader_config.yml'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
defaults: &defaults
|
2
|
+
lines: 13
|
3
|
+
length: 6
|
4
|
+
width: 2
|
5
|
+
radius: 5
|
6
|
+
corners: 1
|
7
|
+
rotate: 0
|
8
|
+
direction: 1
|
9
|
+
color: '#b1aea9'
|
10
|
+
speed: 1
|
11
|
+
trail: 60
|
12
|
+
shadow: false
|
13
|
+
hwaccel: false
|
14
|
+
className: 'spinner'
|
15
|
+
zIndex: 2e9
|
16
|
+
top: 'auto'
|
17
|
+
left: 'auto'
|
18
|
+
|
19
|
+
development:
|
20
|
+
<<: *defaults
|
21
|
+
|
22
|
+
test:
|
23
|
+
<<: *defaults
|
24
|
+
|
25
|
+
production:
|
26
|
+
<<: *defaults
|
data/lib/spin_loader/version.rb
CHANGED
data/spin_loader.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spin_loader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ariel Schvartz
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: coffee-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 4.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 4.0.0
|
55
55
|
description: Creates a full screen loader with a background mask based on spin.js
|
56
56
|
library. Creates coffeescript helpers.
|
57
57
|
email:
|
@@ -65,8 +65,11 @@ files:
|
|
65
65
|
- LICENSE.txt
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
|
-
- app/assets/javascript/spin_loader.
|
68
|
+
- app/assets/javascript/spin_loader.coffee.erb
|
69
69
|
- app/assets/stylesheet/spin_loader.css.sass
|
70
|
+
- lib/generators/spin_loader/install/USAGE
|
71
|
+
- lib/generators/spin_loader/install/install_generator.rb
|
72
|
+
- lib/generators/spin_loader/install/templates/spin_loader_config.yml
|
70
73
|
- lib/spin_loader.rb
|
71
74
|
- lib/spin_loader/engine.rb
|
72
75
|
- lib/spin_loader/version.rb
|
@@ -1,41 +0,0 @@
|
|
1
|
-
#= require spin.min
|
2
|
-
#= require_self
|
3
|
-
|
4
|
-
root = exports ? this
|
5
|
-
|
6
|
-
opts = {
|
7
|
-
lines: 13
|
8
|
-
length: 6
|
9
|
-
width: 2
|
10
|
-
radius: 5
|
11
|
-
corners: 1
|
12
|
-
rotate: 0
|
13
|
-
direction: 1
|
14
|
-
color: '#b1aea9'
|
15
|
-
speed: 1
|
16
|
-
trail: 60
|
17
|
-
shadow: false
|
18
|
-
hwaccel: false
|
19
|
-
className: 'spinner'
|
20
|
-
zIndex: 2e9
|
21
|
-
top: 'auto'
|
22
|
-
left: 'auto'
|
23
|
-
}
|
24
|
-
|
25
|
-
target = undefined
|
26
|
-
spinner = new Spinner(opts).spin()
|
27
|
-
|
28
|
-
$ ->
|
29
|
-
$('body').prepend $('<div>').prop('id':'loading_overlay').addClass('loading_overlay')
|
30
|
-
target = $('#loading_overlay')
|
31
|
-
target.append(spinner.el)
|
32
|
-
$('.spinner').css
|
33
|
-
left : '50%'
|
34
|
-
top : '50%'
|
35
|
-
target.hide()
|
36
|
-
|
37
|
-
root.start_loading = ->
|
38
|
-
target.fadeIn('fast')
|
39
|
-
|
40
|
-
root.stop_loading = ->
|
41
|
-
target.fadeOut('fast')
|