Sha256: c77bbd4939c5eba42e578b6de62eb624d2d97b999a4f44f687331b5aae2283b6

Contents?: true

Size: 1.73 KB

Versions: 9

Compression:

Stored size: 1.73 KB

Contents

var one_panel = {
  selectedItems: {},
  setup: function () {
    $('.block').each(function() {
        if ($(this).attr("data-hover-text")) {
            $(this).linkHover({"somethingMore":$(this).attr("data-hover-text")});
        }

    });

    $('.block').live('click', function(e)
    {
        var activeBlock = $(this);

        var activeBlockId = activeBlock.attr('id');
        var singleSelect = activeBlock.parent().attr('data-single-selection') === "true";
        var activeBlockPanelId = activeBlock.attr('panel_id');

        if(activeBlock.hasClass('active')){
            activeBlock.removeClass('active');
            if (one_panel.selectedItems[activeBlockPanelId] !== null) {
                var index = $.inArray(activeBlockId, one_panel.selectedItems[activeBlockPanelId]);
                if(index > -1) {
                    one_panel.selectedItems[activeBlockPanelId].splice(index,1);
                }
            }
        }
        else {
            if(singleSelect) {
                $(this).parent().find('.block').removeClass('active');
            }
            activeBlock.addClass('active');
            if (one_panel.selectedItems[activeBlockPanelId] === undefined) {
                var selected = [];
                selected.push(activeBlockId);
                one_panel.selectedItems[activeBlockPanelId] = selected;
            }
            else {
                if(singleSelect) {
                    one_panel.selectedItems[activeBlockPanelId]=[activeBlockId];
                }
                else {
                    one_panel.selectedItems[activeBlockPanelId].push(activeBlockId);
                }
            }
        }
        return false;
    });
  }
};


$(document).ready(function() {
    one_panel.setup();
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-2.4.5 app/assets/javascripts/katello/widgets/one_panel.js
katello-2.4.4 app/assets/javascripts/katello/widgets/one_panel.js
katello-2.4.3 app/assets/javascripts/katello/widgets/one_panel.js
katello-2.4.2 app/assets/javascripts/katello/widgets/one_panel.js
katello-2.4.1 app/assets/javascripts/katello/widgets/one_panel.js
katello-2.4.0 app/assets/javascripts/katello/widgets/one_panel.js
katello-2.4.0.rc3 app/assets/javascripts/katello/widgets/one_panel.js
katello-2.4.0.rc2 app/assets/javascripts/katello/widgets/one_panel.js
katello-2.4.0.rc1 app/assets/javascripts/katello/widgets/one_panel.js