<commit_before>Template.hidingPanel.events({
    'mouseover div.hidingPanel': function(e, template) {
        var isPinned = template.isPinned.get();
        if (isPinned) {
            return;
        }

        var hidingPanel = $(e.currentTarget);
        hidingPanel.css({
            width: '122px'
        });

        // Set panel as open
        template.panelOpen.set(true);

        // Rotate Arrow Icon
        $('.arrowIcon').addClass('fa-flip-horizontal');

        // Set panel content opacity
        //hidingPanel.find('.hidingPanelContent').css('opacity', '1');
        hidingPanel.find('.hidingPanelContent').css({
            transform: 'translate(130px)'
        });
    },

    'mouseout div.hidingPanel': function(e, template) {
        var isPinned = template.isPinned.get();
        if (isPinned) {
            return;
        }

        var hidingPanel = $(e.currentTarget);
        hidingPanel.css({
            width: '1%'
        });

        // Set panel as closed
        template.panelOpen.set(false);

        // Rotate Arrow Icon
        $('.arrowIcon').removeClass('fa-flip-horizontal');

        // Set panel content opacity
        //hidingPanel.find('.hidingPanelContent').css('opacity', '0');
        hidingPanel.find('.hidingPanelContent').css({
            transform: 'translate(-130px)'
        });
    },
    'click button.btnPin': function(e, template) {
        var isPinned = template.isPinned.get();
        isPinned = !isPinned;

        template.isPinned.set(isPinned);

        var mainElements = $('#viewportAndLesionTable');
        if (isPinned) {
            // Calculate newWidth of viewportAndLesionTable
            var viewerWidth = $('#viewer').width();
            var newWidth = 100 - 122 / viewerWidth * 100;
            mainElements.css('width', newWidth + '%');
        } else {
            // Calculate newWidth of viewportAndLesionTable
            mainElements.css('width', '99%');
        }

        resizeViewportElements();
    }
});

Template.hidingPanel.helpers({
    studyDateIsShown: function() {
        return true;
    },
    isPinned: function() {
        return Template.instance().isPinned.get();
    }
});

Template.hidingPanel.onCreated(function() {
    this.panelOpen = new ReactiveVar(false);
    this.isPinned = new ReactiveVar(false);
});<commit_msg>LT-150: Added isPanelPinned property in ViewerData session to check whether thumbnails panel of the active tab is pinned or not<commit_after>
function pinPanel() {
    var hidingPanel = $(".hidingPanel");
    hidingPanel.css({
        width: '122px'
    });

    hidingPanel.find('.hidingPanelContent').css({
        transform: 'translate(130px)'
    });

    // Calculate newWidth of viewportAndLesionTable
    var viewerWidth = $('#viewer').width();
    var newWidth = 100 - 122 / viewerWidth * 100;
    $("#viewportAndLesionTable").css('width', newWidth + '%');
}

function unpinPanel() {
// Calculate newWidth of viewportAndLesionTable
    $("#viewportAndLesionTable").css('width', '99%');
}

Template.hidingPanel.events({
    'mouseover div.hidingPanel': function(e, template) {
        var isPinned = template.isPinned.get();
        if (isPinned) {
            return;
        }

        var hidingPanel = $(e.currentTarget);
        hidingPanel.css({
            width: '122px'
        });

        // Set panel as open
        template.panelOpen.set(true);

        // Rotate Arrow Icon
        $('.arrowIcon').addClass('fa-flip-horizontal');

        // Set panel content opacity
        //hidingPanel.find('.hidingPanelContent').css('opacity', '1');
        hidingPanel.find('.hidingPanelContent').css({
            transform: 'translate(130px)'
        });
    },

    'mouseout div.hidingPanel': function(e, template) {
        var isPinned = template.isPinned.get();
        if (isPinned) {
            return;
        }

        var hidingPanel = $(e.currentTarget);
        hidingPanel.css({
            width: '1%'
        });

        // Set panel as closed
        template.panelOpen.set(false);

        // Rotate Arrow Icon
        $('.arrowIcon').removeClass('fa-flip-horizontal');

        // Set panel content opacity
        //hidingPanel.find('.hidingPanelContent').css('opacity', '0');
        hidingPanel.find('.hidingPanelContent').css({
            transform: 'translate(-130px)'
        });
    },
    'click button.btnPin': function(e, template) {
        var isPinned = template.isPinned.get();
        isPinned = !isPinned;

        template.isPinned.set(isPinned);

        // Set isPanelPinned of ViewerData
        var contentId = template.data.contentId;
        ViewerData[contentId].isPanelPinned = isPinned;
        Session.set('ViewerData', ViewerData);

        if (isPinned) {
            pinPanel();
        } else {
            unpinPanel();
        }

        resizeViewportElements();
    }
});

Template.hidingPanel.helpers({
    studyDateIsShown: function() {
        return true;
    },
    isPinned: function() {
        return Template.instance().isPinned.get();
    }
});

Template.hidingPanel.onRendered(function() {

    var contentId = this.data.contentId;
    var isPanelPinned = ViewerData[contentId].isPanelPinned;
    if (isPanelPinned) {
        pinPanel();
    }

});

Template.hidingPanel.onCreated(function() {

    this.panelOpen = new ReactiveVar(false);

    var contentId = this.data.contentId;
    var isPanelPinned = ViewerData[contentId].isPanelPinned;
    if (!isPanelPinned) {
        isPanelPinned = false;
    }
    this.isPinned = new ReactiveVar(isPanelPinned);


});
{'fraction_non_alphanumeric': 0.1381720430107527, 'fraction_numerical': 0.00985663082437276, 'mean_word_length': 2.259929906542056, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '140026', 'n_tokens_mistral': 1687, 'n_tokens_neox': 1613, 'n_words': 309}