Sha256: fac5d155432c0b010dc7c06974c0d4d63af00609271a7891bd6c6449932c896a

Contents?: true

Size: 1.2 KB

Versions: 62

Compression:

Stored size: 1.2 KB

Contents

/**
 * @namespace WORKAREA.toggleFilters
 */
WORKAREA.registerModule('toggleFilters', (function () {
    'use strict';

    var updateButtonText = function($button) {
            var $browsingControls = $button.closest('.browsing-controls');

            if ($browsingControls.hasClass('browsing-controls--filters-displayed')) {
                $button.text(I18n.t('workarea.admin.js.toggle_filters.hide_filters'));
            } else {
                $button.text(I18n.t('workarea.admin.js.toggle_filters.show_filters'));
            }
        },

        toggleFilterDisplay = function($button) {
            $button.closest('.browsing-controls').toggleClass('browsing-controls--filters-displayed');

            return $button;
        },

        toggleFilters = _.flow(toggleFilterDisplay, updateButtonText),

        handleClick = function (event) {
            var $button = $(event.currentTarget);

            toggleFilters($button);
        },

        /**
         * @method
         * @name init
         * @memberof WORKAREA.toggleFilters
         */
        init = function ($scope) {
            $('[data-toggle-filters]', $scope).on('click', handleClick);
        };

    return {
        init: init
    };
}()));

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.27 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.5.4 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.26 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.5.3 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.25 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.5.2 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.24 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.5.1 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.23 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.22 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.5.0 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.21 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.5.0.beta.1 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.20 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.19 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.18 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.17 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.16 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.15 app/assets/javascripts/workarea/admin/modules/toggle_filters.js
workarea-admin-3.4.14 app/assets/javascripts/workarea/admin/modules/toggle_filters.js