hooch 0.5.0 → 0.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b4c5dc6fbe82afb609d925348a82dbd36a456605
4
- data.tar.gz: cb587dbbf277238a9fac4aefae0580b520d87203
3
+ metadata.gz: 3624e98c3171f537a952c19c713b8e13a7e48d84
4
+ data.tar.gz: 293370be919d7515b8269ffac2b73a5e50d0c0ec
5
5
  SHA512:
6
- metadata.gz: cddd8244bc886941a28c59fdd13035c9671bd44191bf9d2f3c4810c2706dcb3f7c4f3dd33cd02d6d14b1932eb52eddc37e45674a01c4833c2b41b89ac4e0e649
7
- data.tar.gz: f4c7197544ef8dd13bea3ecc0dde7670755400bbdfcf95fd6f7de20722dc77cd34c7b8218dc094c554c39e6faf8f32c583c11be6ddffdd4d70022767a5e64419
6
+ metadata.gz: 246f09f2152b970d6a8b5eac82e97d878e6f4bf6174b44016a366a6bff590e02c0726fab529a229cc42e5f8ac450f15fad025b131a7dfc0f5ac76d87aa4f1736
7
+ data.tar.gz: b7e6f61ad88321970ea3f31f12bb75529dff13eb83e059bc91e4e7e010c53641f2aef7d56cf991492924488491144e0ec7bba94868bcd0fd6a533eb83d7cf1e8
@@ -602,6 +602,11 @@ var initHooch = function(){
602
602
  $(window).on('mousemove', function(e){
603
603
  sorter.onMousemove(e)
604
604
  })
605
+ var observer = new MutationObserver(function(mutations) {
606
+ sorter.handleMutations(mutations)
607
+ });
608
+ var config = { childList: true };
609
+ observer.observe($sorter[0], config);
605
610
  },
606
611
  onMousemove: function(e){
607
612
  if(this.dragging_element){
@@ -636,6 +641,23 @@ var initHooch = function(){
636
641
  pressed_element.unSetPressed()
637
642
  }
638
643
  },
644
+ handleMutations: function(mutations){
645
+ var sorter = this;
646
+ mutations.forEach(function(mutation) {
647
+ if(mutation.addedNodes.length > 0){
648
+ var added_node = $(mutation.addedNodes[0])
649
+ if((added_node.attr('id') && !added_node.attr('id').startsWith('thin_man_ajax_progress')) && !added_node.data('hooch-sorter-managed')){
650
+ sorter.getSortElements()
651
+ }
652
+ }
653
+ if(mutation.removedNodes.length > 0){
654
+ var removed_node = $(mutation.removedNodes[0])
655
+ if((removed_node.attr('id') && !removed_node.attr('id').startsWith('thin_man_ajax_progress')) && !removed_node.data('hooch-sorter-managed')){
656
+ sorter.getSortElements()
657
+ }
658
+ }
659
+ });
660
+ },
639
661
  getPressedElement: function(){
640
662
  var possible_pressed_element = $.grep(this.sort_elements, function(sort_element,i){return sort_element.pressed})
641
663
  if(possible_pressed_element.length > 0){
@@ -651,14 +673,16 @@ var initHooch = function(){
651
673
  var sort_element = new hooch.SortElement($(this),sorter)
652
674
  sorter.sort_elements.push(sort_element)
653
675
  })
654
- this.row_height = this.sort_elements[0].height;
655
- var elem_widths = this.sort_elements.map(function(sort_element,i,arr){return sort_element.width})
656
- this.min_elem_width = Math.min.apply(null,elem_widths);
657
- this.refreshGrid();
658
- if((this.min_elem_width * 2) <= this.width){
659
- this.mode = 'Grid'
660
- } else {
661
- this.mode = 'Vertical'
676
+ if(this.sort_elements.length > 0){
677
+ this.row_height = this.sort_elements[0].height;
678
+ var elem_widths = this.sort_elements.map(function(sort_element,i,arr){return sort_element.width})
679
+ this.min_elem_width = Math.min.apply(null,elem_widths);
680
+ this.refreshGrid();
681
+ if((this.min_elem_width * 2) <= this.width){
682
+ this.mode = 'Grid'
683
+ } else {
684
+ this.mode = 'Vertical'
685
+ }
662
686
  }
663
687
  },
664
688
  refreshGrid: function(){
@@ -928,10 +952,10 @@ var initHooch = function(){
928
952
  this.sorter = sorter;
929
953
  this.$sort_element = $sort_element;
930
954
  this.old_position = $sort_element.css('position')
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')
955
+ this.starting_width = this.$sort_element[0].style.height
956
+ this.starting_height = this.$sort_element[0].style.width
957
+ this.starting_top = this.$sort_element[0].style.top
958
+ this.starting_left = this.$sort_element[0].style.left
935
959
  if(typeof(window.getComputedStyle) == 'function'){
936
960
  var computed_style = window.getComputedStyle(this.$sort_element[0])
937
961
  this.width = parseInt(computed_style.width)
@@ -942,6 +966,7 @@ var initHooch = function(){
942
966
  }
943
967
  this.dragging = false
944
968
  this.getDragHandle()
969
+ this.$drag_handle.css({cursor: 'move'});
945
970
  var sort_element = this
946
971
  this.$drag_handle.on('mousedown', $.proxy(sort_element.onMousedown, sort_element))
947
972
  this.$sort_element.on('dragstart', function(e){hooch.pauseEvent(e); return false})
@@ -966,19 +991,20 @@ var initHooch = function(){
966
991
  setDragging: function(){
967
992
  this.sorter.clearDraggingElement();
968
993
  this.unSetPressed()
969
- this.placeholder = new hooch.SortPlaceholder(this.$sort_element.clone().removeAttr('id').css({width: this.width, height: this.height}),this.sorter)
994
+ this.placeholder = new hooch.SortPlaceholder(this.$sort_element.clone().removeAttr('id').css({width: this.width, height: this.height}).data('hooch-sorter-managed',true),this.sorter)
970
995
  this.placeholder.css({'visibility': 'hidden'});
971
996
  // this.placeholder.css({'background-color': 'pink'});
972
- $tmp = $('<div style="display: none;"></div>')
997
+ $tmp = $('<div style="display: none;" data-hooch-sorter-managed></div>')
973
998
  this.$sort_element.before($tmp)
974
999
  this.$sort_element
975
1000
  .css({position: 'absolute', top: this.starting_offset.top, left: this.starting_offset.left, width: this.width, height: this.height})
1001
+ .data('hooch-sorter-managed',true)
976
1002
  .appendTo('body')
977
1003
  $tmp.replaceWith(this.placeholder.$sort_element)
978
1004
  this.sorter.setDraggingElement(this);
979
1005
  },
980
1006
  drop: function(){
981
- this.css({position: this.old_position, top: this.starting_top, left: this.starting_left, width: this.starting_width, height: this.starting_height})
1007
+ this.css({position: this.old_position, top: this.starting_top, left: this.starting_left, width: this.starting_width, height: this.starting_height}).data('hooch-sorter-managed',true)
982
1008
  this.placeholder.replaceWith(this.$sort_element);
983
1009
  this.placeholder = undefined
984
1010
  },
@@ -1014,16 +1040,11 @@ var initHooch = function(){
1014
1040
  return this.$sort_element.clone();
1015
1041
  },
1016
1042
  css: function(css_obj){
1017
- this.$sort_element.css(css_obj);
1043
+ return this.$sort_element.css(css_obj);
1018
1044
  },
1019
1045
  replaceWith: function($jq_obj){
1020
1046
  this.$sort_element.replaceWith($jq_obj)
1021
1047
  }
1022
- }),
1023
- NewSortElement: Class.extend({
1024
- init: function($new_sort_element){
1025
- $new_sort_element.parent().data('sorter').getSortElements();
1026
- }
1027
1048
  })
1028
1049
  };
1029
1050
  hooch.SortPlaceholder = hooch.SortElement.extend({
@@ -1149,7 +1170,7 @@ var initHooch = function(){
1149
1170
  ['hover_overflow','hidey_button','submit-proxy','click-proxy','field-filler','revealer',
1150
1171
  'checkbox-hidden-proxy','prevent-double-submit','prevent-double-link-click', 'tab-group',
1151
1172
  'hover-reveal', 'emptier', 'remover', 'checkbox-proxy', 'fake-select', 'select-action-changer',
1152
- 'sorter','new-sort-element'],'hooch');
1173
+ 'sorter'],'hooch');
1153
1174
  window.any_time_manager.load();
1154
1175
  };
1155
1176
  hooch.pauseEvent = function(e){
data/lib/hooch/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hooch
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
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.5.0
4
+ version: 0.6.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-14 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.0.1
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '4.3'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: 4.0.1
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '4.3'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: bundler
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +37,9 @@ dependencies:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
39
  version: '1.7'
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '2'
34
43
  type: :development
35
44
  prerelease: false
36
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +47,9 @@ dependencies:
38
47
  - - "~>"
39
48
  - !ruby/object:Gem::Version
40
49
  version: '1.7'
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '2'
41
53
  - !ruby/object:Gem::Dependency
42
54
  name: rake
43
55
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +57,9 @@ dependencies:
45
57
  - - "~>"
46
58
  - !ruby/object:Gem::Version
47
59
  version: '10.0'
60
+ - - "<"
61
+ - !ruby/object:Gem::Version
62
+ version: '11'
48
63
  type: :development
49
64
  prerelease: false
50
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,48 +67,69 @@ dependencies:
52
67
  - - "~>"
53
68
  - !ruby/object:Gem::Version
54
69
  version: '10.0'
70
+ - - "<"
71
+ - !ruby/object:Gem::Version
72
+ version: '11'
55
73
  - !ruby/object:Gem::Dependency
56
74
  name: minitest
57
75
  requirement: !ruby/object:Gem::Requirement
58
76
  requirements:
59
- - - ">="
77
+ - - "~>"
78
+ - !ruby/object:Gem::Version
79
+ version: '5'
80
+ - - "<"
60
81
  - !ruby/object:Gem::Version
61
- version: '0'
82
+ version: '6'
62
83
  type: :development
63
84
  prerelease: false
64
85
  version_requirements: !ruby/object:Gem::Requirement
65
86
  requirements:
66
- - - ">="
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '5'
90
+ - - "<"
67
91
  - !ruby/object:Gem::Version
68
- version: '0'
92
+ version: '6'
69
93
  - !ruby/object:Gem::Dependency
70
94
  name: minitest-rails
71
95
  requirement: !ruby/object:Gem::Requirement
72
96
  requirements:
73
- - - ">="
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '2'
100
+ - - "<"
74
101
  - !ruby/object:Gem::Version
75
- version: '0'
102
+ version: '3'
76
103
  type: :development
77
104
  prerelease: false
78
105
  version_requirements: !ruby/object:Gem::Requirement
79
106
  requirements:
80
- - - ">="
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '2'
110
+ - - "<"
81
111
  - !ruby/object:Gem::Version
82
- version: '0'
112
+ version: '3'
83
113
  - !ruby/object:Gem::Dependency
84
114
  name: sqlite3
85
115
  requirement: !ruby/object:Gem::Requirement
86
116
  requirements:
87
- - - ">="
117
+ - - "~>"
118
+ - !ruby/object:Gem::Version
119
+ version: '3'
120
+ - - "<"
88
121
  - !ruby/object:Gem::Version
89
- version: '0'
122
+ version: '4'
90
123
  type: :development
91
124
  prerelease: false
92
125
  version_requirements: !ruby/object:Gem::Requirement
93
126
  requirements:
94
- - - ">="
127
+ - - "~>"
128
+ - !ruby/object:Gem::Version
129
+ version: '3'
130
+ - - "<"
95
131
  - !ruby/object:Gem::Version
96
- version: '0'
132
+ version: '4'
97
133
  description: Hooch provides tools for common UI patterns without any dom or css. You
98
134
  build the html and css you want, then add data-attributes to get behavior. Keep
99
135
  behavior independent of look-and-feel and you can build "anything**"(** within reason).