app/assets/javascripts/hooch.js in hooch-0.15.7 vs app/assets/javascripts/hooch.js in hooch-0.15.8
- old
+ new
@@ -1046,19 +1046,23 @@
Sorter: Class.extend({
init: function($sorter){
this.$sorter = $sorter
this.$jq_obj = $sorter
$sorter.data('sorter',this)
- var new_uuid = new UUID
- this.uniq_id = new_uuid.value
- this.created_at = new Date()
+ //////////////////////////////////////////
+ // Helpful for debugging in the browser
+ // var new_uuid = new UUID
+ // this.uniq_id = new_uuid.value
+ // this.created_at = new Date()
+ //////////////////////////////////////////
this.is_visible = $sorter.is(':visible')
if(this.is_visible){
this.setWidth()
this.setBoundaries()
this.getSortElements()
}
+ this.getSendSort()
this.startInactivityRefresh()
var sorter = this
$(window).on('mouseup touchend touchcancel', function(e){
sorter.onMouseup(e)
});
@@ -1562,20 +1566,30 @@
delete modal.$dismisser
} else {
setTimeout(function(){sorter.inactivityRefresh()}, 60000);
}
},
+ getSendSort: function(){
+ let send_sort_now = this.$sorter.find('[data-send-sort-now]')
+ let sorter = this
+ send_sort_now.on('click', function(){
+ sorter.sendSort()
+ })
+ },
disable: function(){
this.disabled = true
}
}),
SortElement: Class.extend({
init: function($sort_element,sorter){
this.$jq_obj = $sort_element
- var new_uuid = new UUID
- this.uniq_id = new_uuid.value
- this.created_at = new Date()
+ //////////////////////////////////////////
+ // Helpful for debugging in the browser:
+ // var new_uuid = new UUID
+ // this.uniq_id = new_uuid.value
+ // this.created_at = new Date()
+ //////////////////////////////////////////
if(sorter) this.sorter = sorter;
$sort_element.data('hooch.SortElement', this)
this.$sort_element = $sort_element;
this.reusable = $sort_element.data('sort-reusable')
if(typeof(window.getComputedStyle) == 'function'){
@@ -1940,11 +1954,15 @@
})
};
hooch.SortPlaceholder = hooch.SortElement.extend({
init: function($sort_element,sort_element){
var new_uuid = new UUID
- this.uniq_id = new_uuid.value
+ //////////////////////////////////////////
+ // Helpful for debugging in the browser
+ // this.uniq_id = new_uuid.value
+ //////////////////////////////////////////
+
$sort_element.data('hooch.SortElement', this)
this.sort_element = sort_element
this.sorter = sort_element.sorter;
this.is_placeholder = true;
this.$sort_element = $sort_element;
@@ -2237,12 +2255,14 @@
}
}
})
});
$(document).ajaxStop(function(){
- $.each(window.any_time_manager.recordedObjects['hooch.Sorter'], function(index, sorter){
- sorter.setBoundaries()
- })
+ if(window.any_time_manager.recordedObjects.hasOwnProperty('hooch.Sorter')){
+ $.each(window.any_time_manager.recordedObjects['hooch.Sorter'], function(index, sorter){
+ sorter.setBoundaries()
+ })
+ }
})
}
if(typeof Class === "undefined"){
$.getScript('https://rawgit.com/edraut/js_inheritance/a6c1e40986ecb276335b0a0b1792abd01f05ff6c/inheritance.js', function(){
initHooch();