msmtabs.js 1.61 KB
/*
 * ADOBE CONFIDENTIAL
 *
 * Copyright 2016 Adobe Systems Incorporated
 * All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 */
(function(window, document, $) {
    'use strict';

    /**
     * Handler to show/hide the MSM action buttons according to the selected tab.
     */
    $(document).on('coral-panelstack:change', 'coral-tabview', function(e) {
        var $target = $(e.target.selectedItem);

        var $actionBar = $('coral-actionbar');

        if ($target.find('.cq-siteadmin-admin-properties-blueprint').length > 0) {
            $actionBar.find('.cq-siteadmin-admin-properties-actions-blueprint').removeClass('hide');
        } else {
            $actionBar.find('.cq-siteadmin-admin-properties-actions-blueprint').addClass('hide');
        }

        if ($target.find('.cq-siteadmin-admin-properties-livecopy').length > 0) {
            $actionBar.find('.cq-siteadmin-admin-properties-actions-livecopy').removeClass('hide');
        } else {
            $actionBar.find('.cq-siteadmin-admin-properties-actions-livecopy').addClass('hide');
        }
    });

}(window, document, Granite.$));