spinjs-rails 0.0.4 → 1.2.7

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.
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2013 Dmytrii Nagirniak
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md CHANGED
@@ -24,7 +24,7 @@ Require `spin`:
24
24
  //= require spin
25
25
  ```
26
26
 
27
- or as jQuery plugin:
27
+ or as [jQuery plugin](https://gist.github.com/1290439/):
28
28
 
29
29
  ```javascript
30
30
  // application.js
@@ -47,13 +47,20 @@ $(".abc").spin({
47
47
  trail: 60, // Afterglow percentage
48
48
  shadow: false // Whether to render a shadow
49
49
  });
50
- ```
51
50
 
51
+ // Use customisation shortcuts:
52
+ $("#el").spin("small"); // Produces a 'small' Spinner using the text color of #el.
53
+ $("#el").spin("large", "white"); // Produces a 'large' Spinner in white (or any valid CSS color).
54
+ ```
52
55
 
53
56
  See the full usage details on the [spin.js](http://fgnass.github.com/spin.js/) site.
54
57
 
55
58
 
56
59
  # License
57
60
 
58
- [MIT](http://www.opensource.org/licenses/mit-license.php) by [@dnagir](https://twitter.com/#!/dnagir).
61
+ [MIT](http://www.opensource.org/licenses/mit-license.php) by [@dnagir](https://twitter.com/dnagir).
62
+
63
+
64
+ # Thanks
59
65
 
66
+ Thanks to [all contributors](https://github.com/dnagir/spinjs-rails/graphs/contributors) and the author of the spin.js
@@ -1,5 +1,5 @@
1
1
  module Spinjs
2
2
  module Rails
3
- VERSION = "0.0.4"
3
+ VERSION = "1.2.7"
4
4
  end
5
5
  end
@@ -5,6 +5,7 @@ require "spinjs-rails/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "spinjs-rails"
7
7
  s.version = Spinjs::Rails::VERSION
8
+ s.license = "MIT"
8
9
  s.authors = ["Dmytrii Nagirniak"]
9
10
  s.email = ["dnagir@gmail.com"]
10
11
  s.homepage = "https://github.com/dnagir/spinjs-rails"
@@ -2,21 +2,37 @@
2
2
  //= require spin
3
3
 
4
4
  (function($) {
5
-
6
- $.fn.spin = function(opts) {
7
- this.each(function() {
8
- var $this = $(this),
9
- data = $this.data();
10
-
11
- if (data.spinner) {
12
- data.spinner.stop();
13
- delete data.spinner;
14
- }
15
- if (opts !== false) {
16
- data.spinner = new Spinner($.extend({color: $this.css('color')}, opts)).spin(this);
17
- }
18
- });
19
- return this;
20
- };
21
-
5
+ $.fn.spin = function(opts, color) {
6
+ var presets = {
7
+ "tiny": { lines: 8, length: 2, width: 2, radius: 3 },
8
+ "small": { lines: 8, length: 4, width: 3, radius: 5 },
9
+ "large": { lines: 10, length: 8, width: 4, radius: 8 }
10
+ };
11
+ if (Spinner) {
12
+ return this.each(function() {
13
+ var $this = $(this),
14
+ data = $this.data();
15
+
16
+ if (data.spinner) {
17
+ data.spinner.stop();
18
+ delete data.spinner;
19
+ }
20
+ if (opts !== false) {
21
+ if (typeof opts === "string") {
22
+ if (opts in presets) {
23
+ opts = presets[opts];
24
+ } else {
25
+ opts = {};
26
+ }
27
+ if (color) {
28
+ opts.color = color;
29
+ }
30
+ }
31
+ data.spinner = new Spinner($.extend({color: $this.css('color')}, opts)).spin(this);
32
+ }
33
+ });
34
+ } else {
35
+ throw "Spinner class not available.";
36
+ }
37
+ };
22
38
  })(jQuery);
@@ -1,4 +1,4 @@
1
- //fgnass.github.com/spin.js#v1.2.6
1
+ //fgnass.github.com/spin.js#v1.2.7
2
2
  !function(window, document, undefined) {
3
3
 
4
4
  /**
@@ -132,7 +132,8 @@
132
132
  zIndex: 2e9, // Use a high z-index by default
133
133
  className: 'spinner', // CSS class to assign to the element
134
134
  top: 'auto', // center vertically
135
- left: 'auto' // center horizontally
135
+ left: 'auto', // center horizontally
136
+ position: 'relative' // element position
136
137
  }
137
138
 
138
139
  /** The constructor */
@@ -148,7 +149,7 @@
148
149
  this.stop()
149
150
  var self = this
150
151
  , o = self.opts
151
- , el = self.el = css(createEl(0, {className: o.className}), {position: 'relative', width: 0, zIndex: o.zIndex})
152
+ , el = self.el = css(createEl(0, {className: o.className}), {position: o.position, width: 0, zIndex: o.zIndex})
152
153
  , mid = o.radius+o.length+o.width
153
154
  , ep // element position
154
155
  , tp // target position
@@ -316,4 +317,4 @@
316
317
  else
317
318
  window.Spinner = Spinner
318
319
 
319
- }(window, document)
320
+ }(window, document);
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spinjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 1.2.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-11 00:00:00.000000000 Z
12
+ date: 2013-01-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -36,6 +36,7 @@ extra_rdoc_files: []
36
36
  files:
37
37
  - .gitignore
38
38
  - Gemfile
39
+ - LICENSE
39
40
  - README.md
40
41
  - Rakefile
41
42
  - lib/spinjs-rails.rb
@@ -45,7 +46,8 @@ files:
45
46
  - vendor/assets/javascripts/jquery.spin.js
46
47
  - vendor/assets/javascripts/spin.js
47
48
  homepage: https://github.com/dnagir/spinjs-rails
48
- licenses: []
49
+ licenses:
50
+ - MIT
49
51
  post_install_message:
50
52
  rdoc_options: []
51
53
  require_paths:
@@ -58,7 +60,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
58
60
  version: '0'
59
61
  segments:
60
62
  - 0
61
- hash: 1254404581123064380
63
+ hash: 4259367262514581161
62
64
  required_rubygems_version: !ruby/object:Gem::Requirement
63
65
  none: false
64
66
  requirements:
@@ -67,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
69
  version: '0'
68
70
  segments:
69
71
  - 0
70
- hash: 1254404581123064380
72
+ hash: 4259367262514581161
71
73
  requirements: []
72
74
  rubyforge_project: spinjs-rails
73
75
  rubygems_version: 1.8.24