hooch 0.4.3 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/hooch.js +34 -14
- data/lib/hooch/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4c5dc6fbe82afb609d925348a82dbd36a456605
|
4
|
+
data.tar.gz: cb587dbbf277238a9fac4aefae0580b520d87203
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cddd8244bc886941a28c59fdd13035c9671bd44191bf9d2f3c4810c2706dcb3f7c4f3dd33cd02d6d14b1932eb52eddc37e45674a01c4833c2b41b89ac4e0e649
|
7
|
+
data.tar.gz: f4c7197544ef8dd13bea3ecc0dde7670755400bbdfcf95fd6f7de20722dc77cd34c7b8218dc094c554c39e6faf8f32c583c11be6ddffdd4d70022767a5e64419
|
@@ -591,9 +591,10 @@ var initHooch = function(){
|
|
591
591
|
}),
|
592
592
|
Sorter: Class.extend({
|
593
593
|
init: function($sorter){
|
594
|
-
this.$sorter = $sorter
|
595
|
-
|
596
|
-
this.
|
594
|
+
this.$sorter = $sorter
|
595
|
+
$sorter.data('sorter',this)
|
596
|
+
this.width = $sorter.width()
|
597
|
+
this.getSortElements()
|
597
598
|
var sorter = this
|
598
599
|
$(window).on('mouseup', function(e){
|
599
600
|
sorter.onMouseup();
|
@@ -927,15 +928,23 @@ var initHooch = function(){
|
|
927
928
|
this.sorter = sorter;
|
928
929
|
this.$sort_element = $sort_element;
|
929
930
|
this.old_position = $sort_element.css('position')
|
930
|
-
this.
|
931
|
-
this.
|
931
|
+
this.starting_width = this.$sort_element.css('width')
|
932
|
+
this.starting_height = this.$sort_element.css('height')
|
933
|
+
this.starting_top = this.$sort_element.css('top')
|
934
|
+
this.starting_left = this.$sort_element.css('left')
|
935
|
+
if(typeof(window.getComputedStyle) == 'function'){
|
936
|
+
var computed_style = window.getComputedStyle(this.$sort_element[0])
|
937
|
+
this.width = parseInt(computed_style.width)
|
938
|
+
this.height = parseInt(computed_style.height)
|
939
|
+
}else{
|
940
|
+
this.width = this.$sort_element.width()
|
941
|
+
this.height = this.$sort_element.height()
|
942
|
+
}
|
932
943
|
this.dragging = false
|
944
|
+
this.getDragHandle()
|
933
945
|
var sort_element = this
|
934
|
-
this.$
|
935
|
-
|
936
|
-
return false
|
937
|
-
})
|
938
|
-
this.$sort_element.on('mousedown', $.proxy(sort_element.onMousedown, sort_element))
|
946
|
+
this.$drag_handle.on('mousedown', $.proxy(sort_element.onMousedown, sort_element))
|
947
|
+
this.$sort_element.on('dragstart', function(e){hooch.pauseEvent(e); return false})
|
939
948
|
},
|
940
949
|
onMousedown: function(e){
|
941
950
|
if(1 == e.which){
|
@@ -948,22 +957,28 @@ var initHooch = function(){
|
|
948
957
|
unSetPressed: function(){
|
949
958
|
this.pressed = false
|
950
959
|
},
|
960
|
+
getDragHandle: function(){
|
961
|
+
this.$drag_handle = this.$sort_element.find('[data-drag-handle]')
|
962
|
+
if(this.$drag_handle.length < 1){
|
963
|
+
this.$drag_handle = this.$sort_element
|
964
|
+
}
|
965
|
+
},
|
951
966
|
setDragging: function(){
|
952
967
|
this.sorter.clearDraggingElement();
|
953
968
|
this.unSetPressed()
|
954
969
|
this.placeholder = new hooch.SortPlaceholder(this.$sort_element.clone().removeAttr('id').css({width: this.width, height: this.height}),this.sorter)
|
955
970
|
this.placeholder.css({'visibility': 'hidden'});
|
956
|
-
this.placeholder.css({
|
971
|
+
// this.placeholder.css({'background-color': 'pink'});
|
957
972
|
$tmp = $('<div style="display: none;"></div>')
|
958
973
|
this.$sort_element.before($tmp)
|
959
974
|
this.$sort_element
|
960
|
-
.css({position: 'absolute', top: this.starting_offset.top, left: this.starting_offset.left})
|
975
|
+
.css({position: 'absolute', top: this.starting_offset.top, left: this.starting_offset.left, width: this.width, height: this.height})
|
961
976
|
.appendTo('body')
|
962
977
|
$tmp.replaceWith(this.placeholder.$sort_element)
|
963
978
|
this.sorter.setDraggingElement(this);
|
964
979
|
},
|
965
980
|
drop: function(){
|
966
|
-
this.css({position: this.old_position, top:
|
981
|
+
this.css({position: this.old_position, top: this.starting_top, left: this.starting_left, width: this.starting_width, height: this.starting_height})
|
967
982
|
this.placeholder.replaceWith(this.$sort_element);
|
968
983
|
this.placeholder = undefined
|
969
984
|
},
|
@@ -1004,6 +1019,11 @@ var initHooch = function(){
|
|
1004
1019
|
replaceWith: function($jq_obj){
|
1005
1020
|
this.$sort_element.replaceWith($jq_obj)
|
1006
1021
|
}
|
1022
|
+
}),
|
1023
|
+
NewSortElement: Class.extend({
|
1024
|
+
init: function($new_sort_element){
|
1025
|
+
$new_sort_element.parent().data('sorter').getSortElements();
|
1026
|
+
}
|
1007
1027
|
})
|
1008
1028
|
};
|
1009
1029
|
hooch.SortPlaceholder = hooch.SortElement.extend({
|
@@ -1129,7 +1149,7 @@ var initHooch = function(){
|
|
1129
1149
|
['hover_overflow','hidey_button','submit-proxy','click-proxy','field-filler','revealer',
|
1130
1150
|
'checkbox-hidden-proxy','prevent-double-submit','prevent-double-link-click', 'tab-group',
|
1131
1151
|
'hover-reveal', 'emptier', 'remover', 'checkbox-proxy', 'fake-select', 'select-action-changer',
|
1132
|
-
'sorter'],'hooch');
|
1152
|
+
'sorter','new-sort-element'],'hooch');
|
1133
1153
|
window.any_time_manager.load();
|
1134
1154
|
};
|
1135
1155
|
hooch.pauseEvent = function(e){
|
data/lib/hooch/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hooch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Draut
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|