jquery-slideMatrix-rails 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.rvmrc +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +65 -0
- data/LICENSE +21 -0
- data/README.md +41 -0
- data/Rakefile +4 -0
- data/jquery-slideMatrix-rails.gemspec +24 -0
- data/lib/jquery-slideMatrix-rails/rails/engine.rb +6 -0
- data/lib/jquery-slideMatrix-rails/rails/version.rb +6 -0
- data/lib/jquery-slideMatrix-rails/rails.rb +2 -0
- data/lib/jquery-slideMatrix-rails.rb +1 -0
- data/vendor/assets/javascripts/jquery.slideMatrix.js +190 -0
- data/vendor/assets/stylesheets/jquery.slideMatrix.css +1 -0
- metadata +84 -0
data/.gitignore
ADDED
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create ruby-1.9.2-p318@jquery-slideMatrix-rails
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jquery-slideMatrix-rails (0.0.1)
|
5
|
+
jquery-rails (~> 2.0)
|
6
|
+
railties (>= 3.2.0, < 5.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
actionpack (3.2.6)
|
12
|
+
activemodel (= 3.2.6)
|
13
|
+
activesupport (= 3.2.6)
|
14
|
+
builder (~> 3.0.0)
|
15
|
+
erubis (~> 2.7.0)
|
16
|
+
journey (~> 1.0.1)
|
17
|
+
rack (~> 1.4.0)
|
18
|
+
rack-cache (~> 1.2)
|
19
|
+
rack-test (~> 0.6.1)
|
20
|
+
sprockets (~> 2.1.3)
|
21
|
+
activemodel (3.2.6)
|
22
|
+
activesupport (= 3.2.6)
|
23
|
+
builder (~> 3.0.0)
|
24
|
+
activesupport (3.2.6)
|
25
|
+
i18n (~> 0.6)
|
26
|
+
multi_json (~> 1.0)
|
27
|
+
builder (3.0.0)
|
28
|
+
erubis (2.7.0)
|
29
|
+
hike (1.2.1)
|
30
|
+
i18n (0.6.0)
|
31
|
+
journey (1.0.4)
|
32
|
+
jquery-rails (2.0.2)
|
33
|
+
railties (>= 3.2.0, < 5.0)
|
34
|
+
thor (~> 0.14)
|
35
|
+
json (1.7.3)
|
36
|
+
multi_json (1.3.6)
|
37
|
+
rack (1.4.1)
|
38
|
+
rack-cache (1.2)
|
39
|
+
rack (>= 0.4)
|
40
|
+
rack-ssl (1.3.2)
|
41
|
+
rack
|
42
|
+
rack-test (0.6.1)
|
43
|
+
rack (>= 1.0)
|
44
|
+
railties (3.2.6)
|
45
|
+
actionpack (= 3.2.6)
|
46
|
+
activesupport (= 3.2.6)
|
47
|
+
rack-ssl (~> 1.3.2)
|
48
|
+
rake (>= 0.8.7)
|
49
|
+
rdoc (~> 3.4)
|
50
|
+
thor (>= 0.14.6, < 2.0)
|
51
|
+
rake (0.9.2.2)
|
52
|
+
rdoc (3.12)
|
53
|
+
json (~> 1.4)
|
54
|
+
sprockets (2.1.3)
|
55
|
+
hike (~> 1.2)
|
56
|
+
rack (~> 1.0)
|
57
|
+
tilt (~> 1.1, != 1.3.0)
|
58
|
+
thor (0.15.4)
|
59
|
+
tilt (1.3.3)
|
60
|
+
|
61
|
+
PLATFORMS
|
62
|
+
ruby
|
63
|
+
|
64
|
+
DEPENDENCIES
|
65
|
+
jquery-slideMatrix-rails!
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2012 Ryan Scott Lewis
|
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,41 @@
|
|
1
|
+
# jquery-slideMatrix-rails
|
2
|
+
|
3
|
+
Adds [jquery-slideMatrix](https://github.com/c00lryguy/jquery.slideMatrix) to the Rails 3 asset pipeline.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
In your Gemfile, add the following lines:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem :assets do
|
11
|
+
gem 'jquery-slideMatrix-rails'
|
12
|
+
end
|
13
|
+
```
|
14
|
+
|
15
|
+
Now run `bundle install`.
|
16
|
+
|
17
|
+
### Rails 3.1 or greater
|
18
|
+
|
19
|
+
For Rails 3.1 and greater, the files will be added to the asset pipeline and available for you to use.
|
20
|
+
|
21
|
+
Simply the following to `app/assets/javascripts/application.js` after jQuery:
|
22
|
+
|
23
|
+
//= require jquery.slideMatrix`
|
24
|
+
|
25
|
+
And the following to `app/assets/stylesheets/application.css`
|
26
|
+
|
27
|
+
//= require jquery.slideMatrix`
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
32
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
33
|
+
* Fork the project
|
34
|
+
* Start a feature/bugfix branch
|
35
|
+
* Commit and push until you are happy with your contribution
|
36
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
37
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
38
|
+
|
39
|
+
## Copyright
|
40
|
+
|
41
|
+
Copyright (c) 2012 Ryan Scott Lewis. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
task :import do
|
2
|
+
`curl https://raw.github.com/c00lryguy/jquery.slideMatrix/master/lib/jquery.slideMatrix.js > vendor/assets/javascripts/jquery.slideMatrix.js`
|
3
|
+
`curl https://raw.github.com/c00lryguy/jquery.slideMatrix/master/lib/jquery.slideMatrix.css > vendor/assets/stylesheets/jquery.slideMatrix.css`
|
4
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
APP_NAME = File.basename(__FILE__, '.gemspec')
|
3
|
+
|
4
|
+
require File.expand_path("../lib/#{APP_NAME}/rails/version", __FILE__)
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = APP_NAME
|
8
|
+
s.version = JquerySlideMatrix::Rails::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Ryan Scott Lewis"]
|
11
|
+
s.email = ["c00lryguy@gmail.com"]
|
12
|
+
s.homepage = "http://rubygems.org/gems/#{APP_NAME}"
|
13
|
+
s.summary = "Use jquery-slideMatrix with Rails 3"
|
14
|
+
s.description = "This gem provides jquery-slideMatrix assets for your Rails 3 application."
|
15
|
+
|
16
|
+
s.required_rubygems_version = ">= 1.3.6"
|
17
|
+
|
18
|
+
s.add_dependency "railties", ">= 3.2.0", "< 5.0"
|
19
|
+
s.add_dependency "jquery-rails", "~> 2.0"
|
20
|
+
|
21
|
+
s.files = `git ls-files`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
23
|
+
s.require_path = 'lib'
|
24
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'jquery-slideMatrix-rails/rails'
|
@@ -0,0 +1,190 @@
|
|
1
|
+
// Generated by CoffeeScript 1.3.1
|
2
|
+
(function() {
|
3
|
+
|
4
|
+
(function($, window) {
|
5
|
+
return $.fn.extend({
|
6
|
+
slideMatrix: function() {
|
7
|
+
var argument, controls, currentItemPos, direction, initialItem, items, nextElmData, nextItem, nextItemPos, nextPos, optionsOrArgument,
|
8
|
+
_this = this;
|
9
|
+
optionsOrArgument = arguments[0];
|
10
|
+
switch (optionsOrArgument) {
|
11
|
+
case 'slideTo':
|
12
|
+
argument = arguments[1];
|
13
|
+
currentItemPos = this.currentItemPos();
|
14
|
+
nextPos = {};
|
15
|
+
if (typeof argument === 'string') {
|
16
|
+
nextElmData = this.find(argument).data();
|
17
|
+
nextPos.x = nextElmData.x || 0;
|
18
|
+
nextPos.y = nextElmData.y || 0;
|
19
|
+
} else if (typeof argument === 'object') {
|
20
|
+
nextPos.x = argument.x || 0;
|
21
|
+
nextPos.y = argument.y || 0;
|
22
|
+
}
|
23
|
+
nextItem = this.find(".slideMatrixItem[data-x='" + nextPos.x + "'][data-y='" + nextPos.y + "']");
|
24
|
+
if (nextItem != null) {
|
25
|
+
if (nextPos.x > currentItemPos.x) {
|
26
|
+
if (nextItem.length === 0 && this.settings.wraparound) {
|
27
|
+
console.log('Should wrap!');
|
28
|
+
} else {
|
29
|
+
this.slideToItem(nextItem, 'right');
|
30
|
+
}
|
31
|
+
} else if (nextPos.x < currentItemPos.x) {
|
32
|
+
if (nextPos.x < 0 && this.settings.wraparound) {
|
33
|
+
console.log('Should wrap!');
|
34
|
+
} else if (nextPos.x >= 0) {
|
35
|
+
this.slideToItem(nextItem, 'left');
|
36
|
+
}
|
37
|
+
} else if (nextPos.x === currentItemPos.x) {
|
38
|
+
if (nextPos.y > currentItemPos.y) {
|
39
|
+
if (nextItem.length === 0 && this.settings.wraparound) {
|
40
|
+
console.log('Should wrap!');
|
41
|
+
} else {
|
42
|
+
this.slideToItem(nextItem, 'up');
|
43
|
+
}
|
44
|
+
} else if (nextPos.y < currentItemPos.y) {
|
45
|
+
if (nextPos < 0 && this.settings.wraparound) {
|
46
|
+
console.log('Should wrap!');
|
47
|
+
} else {
|
48
|
+
this.slideToItem(nextItem, 'down');
|
49
|
+
}
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|
53
|
+
break;
|
54
|
+
case 'slide':
|
55
|
+
direction = arguments[1];
|
56
|
+
currentItemPos = this.currentItemPos();
|
57
|
+
nextItemPos = (function() {
|
58
|
+
switch (direction) {
|
59
|
+
case 'up':
|
60
|
+
return {
|
61
|
+
x: currentItemPos.x,
|
62
|
+
y: currentItemPos.y + 1
|
63
|
+
};
|
64
|
+
case 'right':
|
65
|
+
return {
|
66
|
+
x: currentItemPos.x + 1,
|
67
|
+
y: currentItemPos.y
|
68
|
+
};
|
69
|
+
case 'down':
|
70
|
+
return {
|
71
|
+
x: currentItemPos.x,
|
72
|
+
y: currentItemPos.y - 1
|
73
|
+
};
|
74
|
+
case 'left':
|
75
|
+
return {
|
76
|
+
x: currentItemPos.x - 1,
|
77
|
+
y: currentItemPos.y
|
78
|
+
};
|
79
|
+
}
|
80
|
+
})();
|
81
|
+
nextItem = this.find(".slideMatrixItem[data-x='" + nextItemPos.x + "'][data-y='" + nextItemPos.y + "']");
|
82
|
+
if (nextItem.length === 0 && this.settings.wraparound) {
|
83
|
+
console.log('Should wrap!');
|
84
|
+
} else if (nextItem.length > 0) {
|
85
|
+
this.slideToItem(nextItem, direction);
|
86
|
+
}
|
87
|
+
break;
|
88
|
+
default:
|
89
|
+
this.defaultOptions = {
|
90
|
+
initialItemFilter: ':first',
|
91
|
+
wraparound: false,
|
92
|
+
slideSpeed: 250
|
93
|
+
};
|
94
|
+
this.settings = $.extend({}, this.defaultOptions, optionsOrArgument);
|
95
|
+
this.currentItemPos = function() {
|
96
|
+
return {
|
97
|
+
x: this.currentItem.data('x') || 0,
|
98
|
+
y: this.currentItem.data('y') || 0
|
99
|
+
};
|
100
|
+
};
|
101
|
+
this.sliding = false;
|
102
|
+
this.slideToItem = function(item, direction) {
|
103
|
+
var cssAttr, currentItemCssEnd, nextItemCssEnd, nextItemCssStart, nextItemCssStartValue,
|
104
|
+
_this = this;
|
105
|
+
cssAttr = direction === 'up' || direction === 'down' ? 'top' : 'left';
|
106
|
+
nextItemCssStartValue = (function() {
|
107
|
+
switch (direction) {
|
108
|
+
case 'up':
|
109
|
+
return -this.currentItem.height();
|
110
|
+
case 'right':
|
111
|
+
return this.currentItem.width();
|
112
|
+
case 'down':
|
113
|
+
return this.currentItem.height();
|
114
|
+
case 'left':
|
115
|
+
return -this.currentItem.width();
|
116
|
+
}
|
117
|
+
}).call(this);
|
118
|
+
nextItemCssStart = (function() {
|
119
|
+
var o;
|
120
|
+
o = {};
|
121
|
+
o[cssAttr] = nextItemCssStartValue;
|
122
|
+
return o;
|
123
|
+
})();
|
124
|
+
nextItemCssEnd = (function() {
|
125
|
+
var o;
|
126
|
+
o = {};
|
127
|
+
o[cssAttr] = 0;
|
128
|
+
return o;
|
129
|
+
})();
|
130
|
+
currentItemCssEnd = (function() {
|
131
|
+
var o;
|
132
|
+
o = {};
|
133
|
+
o[cssAttr] = -nextItemCssStartValue;
|
134
|
+
return o;
|
135
|
+
})();
|
136
|
+
item.css(nextItemCssStart);
|
137
|
+
item.show();
|
138
|
+
if (this.sliding !== true) {
|
139
|
+
this.sliding = true;
|
140
|
+
this.currentItem.animate(currentItemCssEnd, this.settings.slideSpeed);
|
141
|
+
return item.animate(nextItemCssEnd, this.settings.slideSpeed, function() {
|
142
|
+
_this.currentItem.hide().css({
|
143
|
+
left: 0,
|
144
|
+
top: 0
|
145
|
+
});
|
146
|
+
_this.currentItem = item;
|
147
|
+
return _this.sliding = false;
|
148
|
+
});
|
149
|
+
}
|
150
|
+
};
|
151
|
+
controls = $("[data-target='" + this.selector + "']");
|
152
|
+
controls.click(function(e) {
|
153
|
+
var $control, $target, action;
|
154
|
+
e.preventDefault();
|
155
|
+
if (_this.sliding !== true) {
|
156
|
+
$control = $(e.target);
|
157
|
+
$target = $($control.data('target'));
|
158
|
+
action = $control.data('action');
|
159
|
+
switch (action) {
|
160
|
+
case 'slideTo':
|
161
|
+
if ($control.data('selector') != null) {
|
162
|
+
_this.slideMatrix(action, $control.data('selector'));
|
163
|
+
} else {
|
164
|
+
_this.slideMatrix(action, {
|
165
|
+
x: $control.data('x'),
|
166
|
+
y: $control.data('y')
|
167
|
+
});
|
168
|
+
}
|
169
|
+
break;
|
170
|
+
case 'slide':
|
171
|
+
_this.slideMatrix(action, $control.data('direction') || 'right');
|
172
|
+
break;
|
173
|
+
default:
|
174
|
+
return false;
|
175
|
+
}
|
176
|
+
return false;
|
177
|
+
}
|
178
|
+
});
|
179
|
+
items = this.find('.slideMatrixItem');
|
180
|
+
initialItem = items.filter(this.settings.initialItemFilter);
|
181
|
+
items.hide();
|
182
|
+
initialItem.show();
|
183
|
+
this.currentItem = initialItem;
|
184
|
+
}
|
185
|
+
return this;
|
186
|
+
}
|
187
|
+
});
|
188
|
+
})(jQuery, this);
|
189
|
+
|
190
|
+
}).call(this);
|
@@ -0,0 +1 @@
|
|
1
|
+
body .slideMatrix{width:100%;height:300px;position:relative;display:block;}body .slideMatrix >.slideMatrixContainer{width:100%;height:300px;position:absolute;display:block;overflow:hidden;}body .slideMatrix >.slideMatrixContainer >.slideMatrixItem{width:100%;height:300px;position:absolute;display:none;top:0;left:0;}
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-slideMatrix-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Ryan Scott Lewis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-10 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: railties
|
16
|
+
requirement: &70302613697880 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.0
|
22
|
+
- - <
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '5.0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: *70302613697880
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: jquery-rails
|
30
|
+
requirement: &70302613725820 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ~>
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '2.0'
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: *70302613725820
|
39
|
+
description: This gem provides jquery-slideMatrix assets for your Rails 3 application.
|
40
|
+
email:
|
41
|
+
- c00lryguy@gmail.com
|
42
|
+
executables: []
|
43
|
+
extensions: []
|
44
|
+
extra_rdoc_files: []
|
45
|
+
files:
|
46
|
+
- .gitignore
|
47
|
+
- .rvmrc
|
48
|
+
- Gemfile
|
49
|
+
- Gemfile.lock
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- jquery-slideMatrix-rails.gemspec
|
54
|
+
- lib/jquery-slideMatrix-rails.rb
|
55
|
+
- lib/jquery-slideMatrix-rails/rails.rb
|
56
|
+
- lib/jquery-slideMatrix-rails/rails/engine.rb
|
57
|
+
- lib/jquery-slideMatrix-rails/rails/version.rb
|
58
|
+
- vendor/assets/javascripts/jquery.slideMatrix.js
|
59
|
+
- vendor/assets/stylesheets/jquery.slideMatrix.css
|
60
|
+
homepage: http://rubygems.org/gems/jquery-slideMatrix-rails
|
61
|
+
licenses: []
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.3.6
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 1.8.15
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: Use jquery-slideMatrix with Rails 3
|
84
|
+
test_files: []
|