Revision 656c135b snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js | ||
---|---|---|
33 | 33 |
var h1= WindowHeight - $('.header').outerHeight(); |
34 | 34 |
var h2= $('.main').outerHeight(); |
35 | 35 |
$('.lt-sidebar').height((h2>h1) ? h2 : h1); |
36 |
$('.lt-bar').height((h2>h1) ? h2 : h1); |
|
36 | 37 |
} |
37 | 38 |
|
38 | 39 |
|
... | ... | |
65 | 66 |
} |
66 | 67 |
} |
67 | 68 |
|
68 |
ui.entitiesActionsInit = function(){ |
|
69 |
|
|
70 |
// TODO: refactor this |
|
71 |
$('.entities a').click(function(){ |
|
72 |
if ($(this).attr('data-reveal-id')) { |
|
73 |
$('.entities li .more').hide(); |
|
74 |
} |
|
75 |
}) |
|
76 |
|
|
77 |
if ($('.entities .items-list >li').length == 1) { |
|
78 |
$('.overlay-wrapper').addClass('no-vm'); |
|
79 |
} |
|
80 |
$('.entities li .more').each(function(){ |
|
81 |
var width = $(this).parent('li').outerWidth() + 20; |
|
82 |
$(this).css('width', width); |
|
83 |
}) |
|
84 |
$('.entities li .img-wrap').mouseenter(function(e) { |
|
85 |
var that = this; |
|
86 |
setTimeout(function(){ |
|
87 |
if ($(that).closest('.container').siblings('.more').length>0) { |
|
88 |
$(that).closest('.container').fadeOut(100,'easeInCirc'); |
|
89 |
$(that).closest('.container').siblings('.more').fadeIn(300,'easeInCirc'); |
|
90 |
} |
|
91 |
},50); |
|
92 |
}); |
|
93 |
$('.entities li .more').mouseleave(function(e) { |
|
94 |
$(this).fadeOut(200, function() { |
|
95 |
$(this).siblings('.container').fadeIn('fast'); |
|
96 |
}); |
|
97 |
}); |
|
98 |
$('.entities .items-list > li').mouseleave(function(e){ |
|
99 |
var that = this; |
|
100 |
setTimeout(function(){ |
|
101 |
$(that).find('.more').fadeOut(200, function() { |
|
102 |
$(this).siblings('.container').fadeIn('fast'); |
|
103 |
}); |
|
104 |
},100) |
|
105 |
}); |
|
106 |
} |
|
107 |
|
|
108 | 69 |
/* |
109 | 70 |
* In order for the editable value functionality to work, the html markup |
110 | 71 |
* should be: |
... | ... | |
231 | 192 |
/* |
232 | 193 |
* functions concerning checkboxes and radiobuttons links |
233 | 194 |
*/ |
195 |
|
|
234 | 196 |
ui.changeCheckboxState =function(checkbox_link) { |
235 | 197 |
$(checkbox_link).find('.snf-checkbox-unchecked, .snf-checkbox-checked').toggleClass('snf-checkbox-unchecked snf-checkbox-checked'); |
236 | 198 |
} |
... | ... | |
263 | 225 |
|
264 | 226 |
$(document).ready(function(){ |
265 | 227 |
|
266 |
|
|
228 |
ui.setSidebarHeight(); |
|
267 | 229 |
$('#hd-search .hd-icon-search').click(function(e){ |
268 | 230 |
var that = this; |
269 | 231 |
$(this).parents('.hd-search').toggleClass('hd-open'); |
... | ... | |
274 | 236 |
} |
275 | 237 |
}) |
276 | 238 |
|
239 |
$('.entities a').click(function(){ |
|
240 |
if ($(this).attr('data-reveal-id')) { |
|
241 |
$('.entities li .more').hide(); |
|
242 |
} |
|
243 |
}); |
|
244 |
|
|
245 |
if ($('.entities .items-list >li').length == 1) { |
|
246 |
$('.overlay-wrapper').addClass('no-vm'); |
|
247 |
}; |
|
248 |
$('.entities li .more').each(function(){ |
|
249 |
var width = $(this).parent('li').outerWidth() + 20; |
|
250 |
$(this).css('width', width); |
|
251 |
}); |
|
252 |
|
|
253 |
$('.items-list li .img-wrap').on("mouseenter", function(e) { |
|
254 |
var that = this; |
|
255 |
if ($(this).parents('.entities').hasClass('grid-view')) { |
|
256 |
if ($(that).parent('.container').siblings('.more').length>0) { |
|
257 |
$(that).parent('.container').fadeOut(50,'easeInCirc'); |
|
258 |
$(that).parent('.container').siblings('.more').fadeIn(150,'easeInCirc'); |
|
259 |
} |
|
260 |
} |
|
261 |
}); |
|
262 |
$('.entities li .more').mouseleave(function(e) { |
|
263 |
$(this).fadeOut(50, function() { |
|
264 |
$(this).siblings('.container').fadeIn(50); |
|
265 |
}); |
|
266 |
}); |
|
267 |
$('.grid-view .items-list > li').mouseleave(function(e){ |
|
268 |
var that = this; |
|
269 |
setTimeout(function(){ |
|
270 |
$(that).find('.more').fadeOut(200, function() { |
|
271 |
$(this).siblings('.container').fadeIn('fast'); |
|
272 |
}); |
|
273 |
},50) |
|
274 |
}); |
|
277 | 275 |
|
278 |
ui.setSidebarHeight(); |
|
279 | 276 |
ui.closeDiv($('.info .close'), '.info'); |
280 | 277 |
ui.editable(); |
281 | 278 |
ui.overlay(); |
... | ... | |
314 | 311 |
} |
315 | 312 |
}) |
316 | 313 |
|
317 |
ui.entitiesActionsInit(); |
|
318 |
|
|
319 | 314 |
$('.new-btn a.current').click(function(e){ |
320 | 315 |
e.preventDefault(); |
321 | 316 |
}) |
... | ... | |
390 | 385 |
e.preventDefault(); |
391 | 386 |
$('.view-type .grid span').removeClass('current'); |
392 | 387 |
$(this).find('span').addClass('current'); |
393 |
$('.items-list').removeClass('small-block-grid-2 large-block-grid-3');
|
|
394 |
$('.items-list').addClass('list-view');
|
|
388 |
$('.entities').removeClass('grid-view');
|
|
389 |
$('.entities').addClass('list-view');
|
|
395 | 390 |
}); |
396 | 391 |
|
397 | 392 |
$('.view-type .grid').click(function(e){ |
398 | 393 |
e.preventDefault(); |
399 | 394 |
$('.view-type .list span').removeClass('current'); |
400 | 395 |
$(this).find('span').addClass('current'); |
401 |
$('.items-list').addClass('small-block-grid-2 large-block-grid-3');
|
|
402 |
$('.items-list').removeClass('list-view');
|
|
396 |
$('.entities').addClass('grid-view');
|
|
397 |
$('.entities').removeClass('list-view');
|
|
403 | 398 |
}); |
404 | 399 |
|
400 |
$('.lt-bar .select').click(function(e){ |
|
401 |
$(this).find('span').toggleClass('snf-checkbox-checked snf-checkbox-unchecked'); |
|
402 |
$(this).find('em').toggle(); |
|
403 |
if ( $(this).find('span').hasClass('snf-checkbox-unchecked')){ |
|
404 |
$('.list-view li .check span').removeClass('snf-checkbox-checked'); |
|
405 |
$('.list-view li .check span').addClass('snf-checkbox-unchecked'); |
|
406 |
} else { |
|
407 |
$('.list-view li .check span').addClass('snf-checkbox-checked'); |
|
408 |
$('.list-view li .check span').removeClass('snf-checkbox-unchecked'); |
|
409 |
} |
|
410 |
}); |
|
411 |
|
|
405 | 412 |
// set filter visible |
406 | 413 |
$('.filter-menu .filter').click(function(e) { |
407 | 414 |
e.preventDefault(); |
Also available in: Unified diff