Revision 3fd0db82 snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/dragfiles.js
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/dragfiles.js | ||
---|---|---|
33 | 33 |
// or, set the global default message: |
34 | 34 |
// Dragfiles.defaults.dictremoveFile = 'Get it out!' |
35 | 35 |
|
36 |
// temporary |
|
37 |
folders = new Array(); |
|
38 |
for(var i=0; i<$(this.elem).find('.storage.entities>.items-list>li').length ; i++) { |
|
39 |
folders[i] = []; |
|
40 |
} |
|
36 | 41 |
|
37 | 42 |
$(this.elem).on('dragenter',function(e){ |
38 | 43 |
self.dragEnter(e); |
... | ... | |
59 | 64 |
$(this).removeClass('draghover'); |
60 | 65 |
}); |
61 | 66 |
|
62 |
$(this.elem).find('.folder').on('drop', function(e){ |
|
63 |
console.log($(this).data('path'), 'path'); |
|
67 |
$(this.elem).find('.folder').on('drop',function(e){ |
|
68 |
console.log($(this).data('path'), 'path'); |
|
69 |
$(this).removeClass('draghover'); |
|
70 |
var index = $(this).index(); |
|
71 |
if($(this).hasClass('updated')) { |
|
72 |
if(folders[index].length > 1) { |
|
73 |
clearTimeout(folders[index][1]); |
|
74 |
} |
|
75 |
clearTimeout(folders[index][0]); |
|
76 |
} |
|
77 |
else if($(this).hasClass('updating')) { |
|
78 |
if(folders[index].length > 1) { |
|
79 |
clearTimeout(folders[index][1]); |
|
80 |
} |
|
81 |
clearTimeout(folders[index][0]); |
|
82 |
} |
|
83 |
self.resetFolder(this); |
|
84 |
self.updateFolder(this); |
|
64 | 85 |
}); |
65 | 86 |
|
66 | 87 |
$('input[type=file]').on('change',function (e) { |
... | ... | |
77 | 98 |
return this; |
78 | 99 |
|
79 | 100 |
}, |
101 |
// temporary |
|
102 |
updateFolder: function(folder) { |
|
103 |
var folderIndex = $(folder).index(); |
|
104 |
$(folder).find('.img-wrap span').hide(); |
|
105 |
$(folder).addClass('updating'); |
|
106 |
folders[folderIndex][0] = setTimeout(function() { |
|
107 |
$(folder).removeClass('updating'); |
|
108 |
$(folder).addClass('updated'); |
|
109 |
folders[folderIndex][1] = setTimeout(function() { |
|
110 |
$(folder).removeClass('updated'); |
|
111 |
$(folder).find('.img-wrap span').show(); |
|
112 |
}, 500); |
|
113 |
}, 1000); |
|
114 |
}, |
|
115 |
// temporary |
|
116 |
resetFolder : function(folder) { |
|
117 |
$(folder).find('.img-wrap span').hide(); |
|
118 |
$(folder).removeClass('updated'); |
|
119 |
$(folder).removeClass('updating'); |
|
120 |
}, |
|
80 | 121 |
|
81 | 122 |
dragEnter: function(e){ |
82 | 123 |
console.log('Dragenter'); |
... | ... | |
90 | 131 |
dragOver: function(e){ |
91 | 132 |
e.stopPropagation(); |
92 | 133 |
e.preventDefault(); |
93 |
console.log('Dragover'); |
|
134 |
// console.log('Dragover');
|
|
94 | 135 |
$(this.elem).find('#drop').addClass('drag'); |
95 | 136 |
}, |
96 | 137 |
|
... | ... | |
105 | 146 |
self.fileUploaded(self.files[0]) |
106 | 147 |
self.removeFile(self.files[0], $('.storage-progress .items-list li').first()); |
107 | 148 |
} ,1000); |
149 |
|
|
150 |
|
|
108 | 151 |
}, |
109 | 152 |
|
110 | 153 |
fileSelectHandler: function (e){ |
Also available in: Unified diff