stable-rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,16 @@
|
|
3
3
|
$.fn.stable = function() {
|
4
4
|
return this.each(function() {
|
5
5
|
var stable = $(this);
|
6
|
+
|
7
|
+
var initialized = stable.hasClass('on');
|
8
|
+
|
9
|
+
if (initialized) {
|
10
|
+
// reset
|
11
|
+
stable.removeClass('on');
|
12
|
+
$('.scroll-vertical div', stable).height('auto');
|
13
|
+
$('.scroll-horizontal div', stable).width('auto');
|
14
|
+
}
|
15
|
+
|
6
16
|
var top_left_cell = $('.c-left .t-header', stable);
|
7
17
|
|
8
18
|
$('.scroll-vertical div', stable).height($('.c-right', stable).height());
|
@@ -13,31 +23,33 @@
|
|
13
23
|
|
14
24
|
stable.addClass('on');
|
15
25
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
26
|
+
if (!initialized) {
|
27
|
+
// Para el Scroll VERTICAL
|
28
|
+
$('.scroll-vertical', stable).scroll(function(){
|
29
|
+
$('.vertical', stable).scrollTop($(this).scrollTop());
|
30
|
+
});
|
20
31
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
32
|
+
// Para el Scroll HORIZONTAL
|
33
|
+
$('.scroll-horizontal', stable).scroll(function(){
|
34
|
+
$('.horizontal', stable).scrollLeft($(this).scrollLeft());
|
35
|
+
});
|
25
36
|
|
26
|
-
|
27
|
-
|
28
|
-
|
37
|
+
// Para la tabla
|
38
|
+
$('.mask', stable).mousewheel(function(event, delta, deltaX, deltaY) {
|
39
|
+
if (!stable.hasClass('on')) return;
|
29
40
|
|
30
|
-
|
31
|
-
|
41
|
+
var newLeft = $('.horizontal', stable).scrollLeft() + 25 * deltaX;
|
42
|
+
var newTop = $('.vertical', stable).scrollTop() - 25 * deltaY;
|
32
43
|
|
33
|
-
|
34
|
-
|
44
|
+
$('.horizontal', stable).scrollLeft(newLeft);
|
45
|
+
$('.vertical', stable).scrollTop(newTop);
|
35
46
|
|
36
|
-
|
37
|
-
|
47
|
+
$('.scroll-horizontal', stable).scrollLeft(newLeft);
|
48
|
+
$('.scroll-vertical', stable).scrollTop(newTop);
|
38
49
|
|
39
|
-
|
40
|
-
|
50
|
+
event.preventDefault();
|
51
|
+
});
|
52
|
+
}
|
41
53
|
});
|
42
54
|
};
|
43
55
|
|
data/lib/stable-rails/version.rb
CHANGED
@@ -1,19 +1,31 @@
|
|
1
|
-
- stable class: 'w120' do
|
1
|
+
- stable id: 'foo', class: 'w120' do
|
2
2
|
- tr do
|
3
3
|
- td 'L\N'
|
4
4
|
- td 'Title 1'
|
5
|
-
- td 'Title 2'
|
5
|
+
- td 'Title 2', column: { class: 'm' }
|
6
6
|
- td 'Title 3'
|
7
|
-
- td 'Title 4'
|
7
|
+
- td 'Title 4', column: { class: 'm' }
|
8
8
|
- td 'Title 5'
|
9
|
+
- td 'Title 6'
|
10
|
+
- td 'Title 7'
|
11
|
+
- td 'Title 8'
|
12
|
+
- td 'Title 9'
|
9
13
|
- ('a'..'z').each do |c|
|
10
|
-
- tr do
|
14
|
+
- tr class: "#{'m' if 'abefijk'.include? c}" do
|
11
15
|
- td "Title #{c}"
|
12
16
|
- td "#{c}1"
|
13
17
|
- td "#{c}2"
|
14
18
|
- td "#{c}3"
|
15
19
|
- td "#{c}4"
|
16
20
|
- td "#{c}5"
|
21
|
+
- td "#{c}6"
|
22
|
+
- td "#{c}7"
|
23
|
+
- td "#{c}8"
|
24
|
+
- td "#{c}9"
|
25
|
+
|
26
|
+
%button(onclick="$('.m').toggleClass('hidden');$('#foo').stable();") Hide some cells
|
27
|
+
%br
|
28
|
+
%br
|
17
29
|
|
18
30
|
- stable class: 'w120', fixed_rows: 2 do
|
19
31
|
- tr do
|
@@ -15,6 +15,7 @@
|
|
15
15
|
|
16
16
|
.red { background-color: red !important; }
|
17
17
|
.blue { background-color: blue !important; }
|
18
|
+
.hidden { display: none !important; }
|
18
19
|
%script(src="http://code.jquery.com/jquery-1.8.3.min.js" type="text/javascript")
|
19
20
|
%script(src="/javascripts/stable.js" type="text/javascript")
|
20
21
|
%body
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stable-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2013-01-14 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: haml-rails
|
17
|
-
requirement: &
|
17
|
+
requirement: &70122337338980 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70122337338980
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: sinatra
|
28
|
-
requirement: &
|
28
|
+
requirement: &70122337337620 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70122337337620
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: sass
|
39
|
-
requirement: &
|
39
|
+
requirement: &70122337336520 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,7 +44,7 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70122337336520
|
48
48
|
description: Scrollable table with fixed first row and column.
|
49
49
|
email:
|
50
50
|
- mscebba@manas.com.ar
|