Sha256: ee4e369a61bd6c67512667363f860549707ea6cc689e778fdeb0f09c71877766

Contents?: true

Size: 1.05 KB

Versions: 18

Compression:

Stored size: 1.05 KB

Contents

jQuery(function($) {
  $('.admin_accounts').filter('.new, .edit').find('form.pageflow_account').each(function() {
    var themeSelect = $('#account_paged_entry_template_attributes_theme_name', this);
    var themeOptions = JSON.parse($('script#theme_options', this).text());
    var homeButtonCheckBox = $('#account_paged_entry_template_attributes_configuration_home_button_enabled', this);

    updateThemeFeatures();
    themeSelect.on('change', updateThemeFeatures);

    function updateThemeFeatures() {
      toggleDisabled(homeButtonCheckBox, !selectedThemeSupportsHomeButton());
    }

    function selectedThemeSupportsHomeButton() {
      return !themeOptions[themeSelect.val()].no_home_button;
    }

    function toggleDisabled(checkBox, disabled) {
      if (disabled) {
        checkBox.data('wasChecked', checkBox.is(':checked'));
        checkBox.prop('checked', false);
        checkBox.prop('disabled', true);
      }
      else {
        checkBox.removeAttr('disabled');
        checkBox.prop('checked', checkBox.data('wasChecked'));
      }
    }
  });
});

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
pageflow-17.0.4 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-17.0.3 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-17.0.2 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-17.0.1 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-17.0.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-16.2.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-16.1.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-16.0.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.8.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.7.1 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.7.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.6.1 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.6.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.5.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.4.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.3.0 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.2.2 app/assets/javascripts/pageflow/admin/accounts.js
pageflow-15.2.1 app/assets/javascripts/pageflow/admin/accounts.js