Sha256: 2d0c83a7576bee7cbd973e09ddac4b33c4dc7a80e07eb859e7b5ea85b4184765

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

/* eslint-env jquery */
window.cama_init_posttype_form = function() {
  const form = $('#post_type_form')
  form.find('.unput_upload').input_upload()

  // permit hierarchy route only for post types enabled "Manage page hierarchy"
  form.find("[name='meta[has_parent_structure]']").change(function() {
    const item = form.find('#meta_contents_route_format_hierarchy_post')

    item.parent().siblings().find('input').prop('disabled', $(this).is(':checked'))
    if ($(this).is(':checked'))
      return item.prop('checked', true).prop('disabled', false)
    else
      return item.prop('disabled', true)
  }).trigger('change')

  form.find('[name="meta[has_picture]"]').change(function() {
    const items = form.find('.picture_settings input')

    if ($(this).is(':checked'))
      return items.prop('disabled', false)
    else
      return items.prop('disabled', true)
  }).trigger('change')

  // toggle single and multiple categories checkbox
  const catChecks = form.find(
    'input:checkbox[name="meta[has_category]"], input:checkbox[name="meta[has_single_category]"]'
  )

  return catChecks.change(
    function() {
      if ($(this).is(':checked')) return catChecks.not(this).prop('checked', false)
    }
  ).filter(':checked').trigger('change')
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
camaleon_cms-2.7.4 app/assets/javascripts/camaleon_cms/admin/_posttype.js
camaleon_cms-2.7.3 app/assets/javascripts/camaleon_cms/admin/_posttype.js
camaleon_cms-2.7.2 app/assets/javascripts/camaleon_cms/admin/_posttype.js
camaleon_cms-2.7.1 app/assets/javascripts/camaleon_cms/admin/_posttype.js
camaleon_cms-2.7.0 app/assets/javascripts/camaleon_cms/admin/_posttype.js