sap-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +34 -0
- data/Rakefile +2 -0
- data/lib/sap-rails.rb +8 -0
- data/lib/sap/rails/engine.rb +6 -0
- data/lib/sap/rails/version.rb +5 -0
- data/sap-rails.gemspec +17 -0
- data/vendor/assets/javascripts/jquery.sap.js +57 -0
- data/vendor/assets/javascripts/jquery.sap.min.js +1 -0
- metadata +56 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Baylor Rae'
|
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,34 @@
|
|
1
|
+
# Sap::Rails
|
2
|
+
|
3
|
+
Sap Rails provides easy access to [Forrst's jQuery Sap](https://github.com/forrst/sap) plugin for the Rails 3.1
|
4
|
+
asset pipeline.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
1. Add to the `:assets` group in your Gemfile
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'sap-rails'
|
12
|
+
```
|
13
|
+
|
14
|
+
2. Install the gem
|
15
|
+
|
16
|
+
```shell
|
17
|
+
bundle install
|
18
|
+
```
|
19
|
+
|
20
|
+
3. Add to your `application.js`
|
21
|
+
|
22
|
+
```javascript
|
23
|
+
//= require jquery.sap
|
24
|
+
// or
|
25
|
+
//= require jquery.sap.min
|
26
|
+
```
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/lib/sap-rails.rb
ADDED
data/sap-rails.gemspec
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/sap/rails/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Baylor Rae'"]
|
6
|
+
gem.email = ["baylorrae@gmail.com"]
|
7
|
+
gem.description = %q{Add sap to Rails asset pipline}
|
8
|
+
gem.summary = %q{Add sap to Rails asset pipline}
|
9
|
+
gem.homepage = ""
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = "sap-rails"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = Sap::Rails::VERSION
|
17
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/**
|
2
|
+
* Sap v1.0.4
|
3
|
+
*
|
4
|
+
* Inspired by Contained Sticky Scroll v1.1 By Matt Ward
|
5
|
+
* http://blog.echoenduring.com/2010/11/15/freebie-contained-sticky-scroll-jquery-plugin/
|
6
|
+
*
|
7
|
+
* (c) 2011 Forrst, LLC
|
8
|
+
*/
|
9
|
+
|
10
|
+
(function($) {
|
11
|
+
|
12
|
+
$.fn.sap = function(options) {
|
13
|
+
|
14
|
+
var defaults = {
|
15
|
+
distanceFromTheTop: 0
|
16
|
+
};
|
17
|
+
|
18
|
+
options = $.extend(defaults, options);
|
19
|
+
|
20
|
+
var $objizzle = $(this);
|
21
|
+
|
22
|
+
if (!$objizzle.length) return;
|
23
|
+
|
24
|
+
var oldTop = $objizzle.offset().top;
|
25
|
+
var width = $objizzle.width() + 'px';
|
26
|
+
var $shim = $('<div class="sap-shimy-shim"></div>');
|
27
|
+
var theWindow = $(window);
|
28
|
+
var theDoc = $(document);
|
29
|
+
|
30
|
+
theWindow.scroll(function() {
|
31
|
+
|
32
|
+
var top = theWindow.scrollTop();
|
33
|
+
|
34
|
+
if ((top + options.distanceFromTheTop + $objizzle.height()) < (theDoc.height() - theWindow.height()) && (top + options.distanceFromTheTop) > $objizzle.offset().top)
|
35
|
+
{
|
36
|
+
$objizzle.css({
|
37
|
+
position: 'fixed',
|
38
|
+
width: width,
|
39
|
+
top: options.distanceFromTheTop + 'px'
|
40
|
+
});
|
41
|
+
|
42
|
+
$shim.css({width: width, height: $objizzle.height()});
|
43
|
+
|
44
|
+
$objizzle.before($shim);
|
45
|
+
}
|
46
|
+
else if (top + options.distanceFromTheTop < oldTop)
|
47
|
+
{
|
48
|
+
$shim.remove();
|
49
|
+
$objizzle.css({
|
50
|
+
position: 'static',
|
51
|
+
width: width,
|
52
|
+
top: ''
|
53
|
+
});
|
54
|
+
}
|
55
|
+
});
|
56
|
+
};
|
57
|
+
}(jQuery));
|
@@ -0,0 +1 @@
|
|
1
|
+
(function($){$.fn.sap=function(options){var defaults={distanceFromTheTop:0};options=$.extend(defaults,options);var $objizzle=$(this);if(!$objizzle.length)return;var oldTop=$objizzle.offset().top;var width=$objizzle.width()+'px';var $shim=$('<div class="sap-shimy-shim"></div>');var theWindow=$(window);var theDoc=$(document);theWindow.scroll(function(){var top=theWindow.scrollTop();if((top+options.distanceFromTheTop+$objizzle.height())<(theDoc.height()-theWindow.height())&&(top+options.distanceFromTheTop)>$objizzle.offset().top){$objizzle.css({position:'fixed',width:width,top:options.distanceFromTheTop+'px'});$shim.css({width:width,height:$objizzle.height()});$objizzle.before($shim)}else if(top+options.distanceFromTheTop<oldTop){$shim.remove();$objizzle.css({position:'static',width:width,top:''})}})}}(jQuery));
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sap-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Baylor Rae'
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-02 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: Add sap to Rails asset pipline
|
15
|
+
email:
|
16
|
+
- baylorrae@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- .gitignore
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- Rakefile
|
26
|
+
- lib/sap-rails.rb
|
27
|
+
- lib/sap/rails/engine.rb
|
28
|
+
- lib/sap/rails/version.rb
|
29
|
+
- sap-rails.gemspec
|
30
|
+
- vendor/assets/javascripts/jquery.sap.js
|
31
|
+
- vendor/assets/javascripts/jquery.sap.min.js
|
32
|
+
homepage: ''
|
33
|
+
licenses: []
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
require_paths:
|
37
|
+
- lib
|
38
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 1.8.11
|
53
|
+
signing_key:
|
54
|
+
specification_version: 3
|
55
|
+
summary: Add sap to Rails asset pipline
|
56
|
+
test_files: []
|