File "admin-toggle-stores.js"
Full Path: /srv/www/www.cadoro.it/src/js/admin-toggle-stores.js
File size: 923 bytes
MIME-type: text/plain
Charset: utf-8
$(function () {
$('[data-behaviour~=toggle-stores]').click(function (e) {
e.preventDefault()
var $this = $(e.target).closest('a')
, $container = $this.closest('.controls')
, ids = $this.attr('data-ids')
if (ids == '*') {
$container.find('input[type=checkbox]').prop('checked', true)
} else {
_.each(ids.split(","), function (id) {
$container.find('input[value=' + id + ']').prop('checked', true)
})
}
})
$('[data-behaviour~=untoggle-stores]').click(function (e) {
e.preventDefault()
var $this = $(e.target).closest('a')
, $container = $this.closest('.controls')
, ids = $this.attr('data-ids')
if (ids == '*') {
$container.find('input[type=checkbox]').prop('checked', false)
} else {
_.each(ids.split(","), function (id) {
$container.find('input[value=' + id + ']').prop('checked', false)
})
}
})
})