Revision 112e5dd2 snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js

b/snf-cyclades-app/synnefo/ui/new_ui/ui/javascripts/common.js
273 273
    ui.entitiesActionsEnabled();
274 274
}
275 275

  
276
// to use the above functions use first the ui.checkOneRadioButton and then ui.changeRadiobuttonState
277
ui.checkOneRadioButton = function(radiobtn_link) {
278
    $(radiobtn_link).closest('ul').find('span.snf-radio-checked').toggleClass('snf-radio-unchecked snf-radio-checked');
279
}
276 280
ui.changeRadiobuttonState = function(radiobtn_link) {
277 281
    $(radiobtn_link).find('span.snf-radio-unchecked, span.snf-radio-checked').toggleClass('snf-radio-unchecked snf-radio-checked');
278 282
}
279 283

  
280
ui.checkOneRadioButton = function(radiobtn_link) {
281
    $(radiobtn_link).closest('ul').find('span.snf-radio-checked').toggleClass('snf-radio-unchecked snf-radio-checked');
282
}
283 284

  
284 285

  
285 286
// toggle expand arrrow  and corresponding area
......
632 633
        }
633 634
    });
634 635

  
635
    // to remove the visual effect that shows that the process of disconnect is in progress
636
    // we must not have pending clicks (incomplite hide process)
637
    var countClicks = 0;
638 636

  
639
    // normally there's a confirmation window before you disconnect
640
    $('.act').click(function(e){
637
    $('.act').click(function(e) {
638
        $(this).addClass('pending last');
639
    });
640

  
641
    $('.remove .cancel').click(function(e) {
642
        e.preventDefault();
643
        $('a.close-reveal-modal').trigger('click');
644
        $('.last').removeClass('pending last');
645
    });
646

  
647
    $('.remove .ok').click(function(e) {
641 648
        e.preventDefault();
642
        countClicks++;
643
        $(this).addClass('open',0);
644
        var img = $(this).closest('.item').find('.img-wrap .snf-font');
649
        $('a.close-reveal-modal').trigger('click');
650
        var connection_img = $('.connections').find('.last');
651
        connection_img.addClass('open', 0);
652
        connection_img.removeClass('last');;
653
        var img = connection_img.closest('.item').find('.img-wrap .snf-font');
645 654
        img.addClass('reboot-progress');
646
        var self = this;
647 655
        setTimeout(function() {
648
            countClicks--;
649
            var connections_list = $(self).closest('.connections').children('li:not(".hidden")');
656
            var connections_list = connection_img.closest('.connections').children('li:not(".hidden")');
650 657
            if(connections_list.length>1) {
651
                $(self).closest('li').slideUp(function(){
658
                connection_img.closest('li').slideUp(function(){
652 659
                    console.log(img)
653
                    $(self).closest('li').addClass('hidden');
654
                    if(countClicks== 0) img.removeClass('reboot-progress');
660
                    connection_img.closest('li').addClass('hidden');
661
                    if(connections_list.find('.pending').length == 0) {
662
                      img.removeClass('reboot-progress');
663
                    }
655 664
                });
656 665
            }
657 666
            else {
658
            $(self).closest('.item').slideUp('slow', function(){
659
                    img.removeClass('reboot-progress')
660
                    $(self).closest('li').addClass('hidden');
661
                    if(countClicks== 0) img.removeClass('reboot-progress');
667
                connection_img.closest('.item').slideUp(function(){
668
                    img.removeClass('reboot-progress');
669
                    img.closest('li').addClass('hidden');
670
                    img.removeClass('reboot-progress');
662 671
                });
663 672
            }
673
            connection_img.removeClass('pending');
664 674
        }, 3000)
665
    })
675
    });
666 676

  
667 677
    // end of connected details js
668 678
})

Also available in: Unified diff