Revision 4e7c16f1 snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js | ||
---|---|---|
41 | 41 |
* Logic for Entities actions. Present in items_list pages |
42 | 42 |
* Available categories are : |
43 | 43 |
* - both/single ( for multiple entities/single entities) |
44 |
* - running/stopped ( for running/stopped entities)
|
|
44 |
* - running/off ( for running/off entities)
|
|
45 | 45 |
* - permanent ( for entities always active ) |
46 | 46 |
*/ |
47 | 47 |
ui.entitiesActionsEnabled = function(){ |
48 | 48 |
var all = $('.snf-checkbox-checked').length; |
49 |
var running = $('.snf-checkbox-checked').parents('li').find('.running').length;
|
|
50 |
var stopped = $('.snf-checkbox-checked').parents('li.off').length;
|
|
51 |
console.log(stopped, 'actions here');
|
|
52 |
$('.header .main-actions li:not(.permanent) a').removeClass('active');
|
|
53 |
if ( (running*stopped) > 0 ){
|
|
54 |
$('.main-actions li.both a').addClass('active');
|
|
55 |
$('.main-actions li.single a').removeClass('active');
|
|
49 |
var running = $('.snf-checkbox-checked').parents('li.running').length; |
|
50 |
var off = $('.snf-checkbox-checked').parents('li.off').length;
|
|
51 |
console.log(off, 'actions here');
|
|
52 |
$('.lt-bar .lt-actions li:not(.permanent) a').removeClass('active');
|
|
53 |
if ( (running*off) > 0 ){
|
|
54 |
$('.lt-actions li.both a').addClass('active');
|
|
55 |
$('.lt-actions li.single a').removeClass('active');
|
|
56 | 56 |
} else { |
57 | 57 |
if (running > 0) { |
58 |
$('.main-actions li.both a').addClass('active');
|
|
59 |
$('.main-actions li.running a').addClass('active');
|
|
60 |
} else if (stopped>0) {
|
|
61 |
$('.main-actions li.both a').addClass('active');
|
|
62 |
$('.main-actions li.stopped a').addClass('active');
|
|
58 |
$('.lt-actions li.both a').addClass('active');
|
|
59 |
$('.lt-actions li.running a').addClass('active');
|
|
60 |
} else if (off>0) {
|
|
61 |
$('.lt-actions li.both a').addClass('active');
|
|
62 |
$('.lt-actions li.off a').addClass('active');
|
|
63 | 63 |
} |
64 | 64 |
if ( all > 1 ) { |
65 |
$('.main-actions li.single a').removeClass('active');
|
|
65 |
$('.lt-actions li.single a').removeClass('active');
|
|
66 | 66 |
} |
67 | 67 |
} |
68 | 68 |
} |
... | ... | |
239 | 239 |
}) |
240 | 240 |
|
241 | 241 |
$('.header .login').mouseenter(function(e){ |
242 |
$(this).find('ul').stop().slideDown(200); |
|
242 |
$(this).find('ul').stop(true, true).slideDown(200);
|
|
243 | 243 |
}); |
244 | 244 |
$('.header .login').mouseleave(function(e){ |
245 |
$(this).find('ul').stop().slideUp(200); |
|
245 |
$(this).find('ul').stop(true, true).slideUp(200);
|
|
246 | 246 |
}); |
247 | 247 |
|
248 | 248 |
$('.entities a').click(function(){ |
... | ... | |
251 | 251 |
} |
252 | 252 |
}); |
253 | 253 |
|
254 |
$('.lt-actions a:not(.active)').click(function(e){ |
|
255 |
e.preventDefault(); |
|
256 |
}) |
|
257 |
|
|
254 | 258 |
if ($('.entities .items-list >li').length == 1) { |
255 | 259 |
$('.overlay-wrapper').addClass('no-vm'); |
256 | 260 |
}; |
... | ... | |
320 | 324 |
} |
321 | 325 |
}) |
322 | 326 |
|
323 |
$('.new-btn a.current').click(function(e){ |
|
324 |
e.preventDefault(); |
|
325 |
}) |
|
326 |
|
|
327 | 327 |
$('.main-actions li a').click(function(e){ |
328 | 328 |
if (!($(this).hasClass('active'))) { |
329 | 329 |
e.preventDefault(); |
... | ... | |
431 | 431 |
e.preventDefault(); |
432 | 432 |
$(this).siblings('.container').find('.complete').toggleClass('build-progress'); |
433 | 433 |
}) |
434 |
|
|
435 |
//temp function to preventDefault of links in modal |
|
436 |
$('.reveal-modal a:not(".close-reveal-modal")').click(function(e){ |
|
437 |
e.preventDefault(); |
|
438 |
$('a.close-reveal-modal').trigger('click'); |
|
439 |
}); |
|
434 | 440 |
}) |
435 | 441 |
|
436 | 442 |
|
Also available in: Unified diff