Revision 9b0b486b snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js
b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js | ||
---|---|---|
56 | 56 |
* - both/single ( for multiple entities/single entities) |
57 | 57 |
* - running/off ( for running/off entities) |
58 | 58 |
* - permanent ( for entities always active ) |
59 |
* Can be used for pithos as well |
|
60 |
* Available categories are : |
|
61 |
* - files ( for files only actions) |
|
62 |
* - folders ( for folders only actions) |
|
63 |
* - all ( for files/folders actions) |
|
59 | 64 |
*/ |
60 | 65 |
ui.entitiesActionsEnabled = function(){ |
61 | 66 |
var all = $('.snf-checkbox-checked').length; |
62 | 67 |
var running = $('.snf-checkbox-checked').parents('li.running').length; |
63 | 68 |
var off = $('.snf-checkbox-checked').parents('li.off').length; |
64 |
console.log(off, 'actions here'); |
|
69 |
var files = $('.snf-checkbox-checked').parents('li.file').length; |
|
70 |
var folders = $('.snf-checkbox-checked').parents('li.folder').length; |
|
71 |
|
|
72 |
console.log(files,'files'); |
|
73 |
console.log(folders,'folders'); |
|
74 |
|
|
65 | 75 |
$('.lt-bar .lt-actions li:not(.permanent) a').removeClass('active'); |
76 |
|
|
77 |
if ( ( files * folders )>0 ) { |
|
78 |
$('.lt-actions li.all a').addClass('active'); |
|
79 |
} else { |
|
80 |
if ( files>0 ) { |
|
81 |
$('.lt-actions li.files a').addClass('active'); |
|
82 |
} |
|
83 |
if ( folders>0 ){ |
|
84 |
$('.lt-actions li.folders a').addClass('active'); |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
66 | 88 |
if ( (running*off) > 0 ){ |
67 | 89 |
$('.lt-actions li.both a').addClass('active'); |
68 | 90 |
$('.lt-actions li.single a').removeClass('active'); |
... | ... | |
468 | 490 |
}) |
469 | 491 |
|
470 | 492 |
if ($('.entities .items-list >li').length == 1) { |
471 |
$('.overlay-wrapper').addClass('no-vm');
|
|
493 |
$('.body-wrapper').addClass('no-vm');
|
|
472 | 494 |
}; |
473 | 495 |
$('.entities li .more').each(function(){ |
474 | 496 |
var width = $(this).parent('li').outerWidth() + 20; |
... | ... | |
599 | 621 |
|
600 | 622 |
/* grid/list view for items-list */ |
601 | 623 |
|
602 |
$('.view-type .list').click(function(e){ |
|
603 |
e.preventDefault(); |
|
604 |
$('.view-type .grid span').removeClass('current'); |
|
605 |
$(this).find('span').addClass('current'); |
|
606 |
$('.entities').removeClass('grid-view'); |
|
607 |
$('.entities').addClass('list-view'); |
|
608 |
}); |
|
609 |
|
|
610 |
$('.view-type .grid').click(function(e){ |
|
624 |
$('.actions-bar .list, .actions-bar .grid').click(function(e){ |
|
611 | 625 |
e.preventDefault(); |
612 |
$('.view-type .list span').removeClass('current'); |
|
613 |
$(this).find('span').addClass('current'); |
|
614 |
$('.entities').addClass('grid-view'); |
|
615 |
$('.entities').removeClass('list-view'); |
|
626 |
if (!($(this).find('span').hasClass('current'))) { |
|
627 |
$('.actions-bar .grid span, .actions-bar .list span').removeClass('current'); |
|
628 |
$(this).find('span').addClass('current'); |
|
629 |
$('.entities').toggleClass('grid-view list-view'); |
|
630 |
} |
|
616 | 631 |
}); |
617 | 632 |
|
618 | 633 |
$('.lt-bar .select').click(function(e){ |
Also available in: Unified diff