Sha256: 6c85dbbb2a9b72f9c411116f7bf06de05622b79f45bc51a665b138fdb3af9c7b

Contents?: true

Size: 1.75 KB

Versions: 2

Compression:

Stored size: 1.75 KB

Contents

{I"
class:ETI"BundledAsset;FI"logical_path;TI"tenon/features/forms.js;FI"
pathname;TI"V/Users/seanroberts/Sites/tenon/app/assets/javascripts/tenon/features/forms.js.erb;FI"content_type;TI"application/javascript;TI"
mtime;Tl+óŠkSI"length;Ti'I"digest;TI"%da1aa9b75a684af0e3ff5fec945ccf75;FI"source;TI"'Tenon.features.forms = {
  init: function () {
    var self = Tenon.features.forms;
    self.setupRadioSliders();
    self.protectChanges();
    self.focusFirstField();
  },

  protectChanges: function () {
    var self = Tenon.features.forms;

    self.changesMade = false;
    $('input, select, textarea').bind('keyup change', function() {
      if ($(this).attr('id') != "quick-search") { self.changesMade = true; }
    });

    // don't run the check if the user is submitting a form of course
    $(document).on('submit', 'form', function() {
      window.onbeforeunload = null;
    });

    window.onbeforeunload = self.confirmNavigation;
  },

  confirmNavigation: function () {
    var self = Tenon.features.forms;

    if (typeof CKEDITOR != 'undefined') {
      for ( instance in CKEDITOR.instances )
        if(CKEDITOR.instances[instance].checkDirty()) { self.changesMade = true}
    }

    if (self.changesMade) {
      return "You have unsaved changes, are you sure you want to leave this page?";
    }
  },

  setupRadioSliders: function () {
    $('.radio-slider').radioSlider({sliderImage: '/tenon/slider-button.png'});
  },

  focusFirstField: function () {
    el = $(".main-content form input[type!='hidden'], .main-content form select, .main-content form textarea")[0];
    $(el).focus();
  }

}
;
;TI"required_assets_digest;TI"%7eba92e413013a11b790a1c0f3d7dbe0;FI"
_version;TI"%a56df69ef97ba4d9f1a23bf9b0add58a;F

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
tenon-1.0 spec/dummy/tmp/cache/assets/development/sprockets/194f9a7770ab7dd6afdff14c669e3190
tenon-1.0 spec/dummy/tmp/cache/assets/development/sprockets/31fbc22f89bd770c5851c5e681d63a7f