Sha256: 810fae06c07afd805e046c5130bbea8cd7d4696eaa5b6f0e4d1ac9da14c34ace

Contents?: true

Size: 1.28 KB

Versions: 42

Compression:

Stored size: 1.28 KB

Contents

(function(PageEdit, $) {
  PageEdit.addPart = function (form) {
    if (PageEdit.validPartName()) {
      PageEdit.partLoading();
      $.post(
        $(form).attr('action'),
        $(form).serialize(),
        function(data) {
          $('#tab_control .pages').append(data);
          PageEdit.partAdded();
        }
      )
    }
  }

  PageEdit.partAdded = function (tabId) {
    $('#add_part_busy').hide();
    $('#add_part_button').attr('disabled', false);
    Popup.close();
    $('#part_name_field').val('');
    TabControl.updateTabsBasedOnPages();
    TabControl.selectTab($('div#tab_control .tabs .tab').last().attr('id'));
  }

  PageEdit.partLoading = function () {
    $('#add_part_button').attr('disabled', true);
    $('#add_part_busy').show();
  }

  PageEdit.validPartName = function () {
    var partNameField = $('#part_name_field');
    var name = partNameField.val().toLowerCase();
    if (name === '') {
      alert('Part name cannot be empty.');
      return false;
    }
    if ($('#tab_' + name).length > 0) {
      alert('Part name must be unique.');
      return false;
    }
    return true;
  }

}(window.PageEdit = window.PageEdit || {}, jQuery));

$(function () {
  $('#new_page_part').submit(function(event) {
    event.preventDefault();
    PageEdit.addPart(this);
  });
});

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
trusty-cms-2.0.9.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-2.0.8.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-2.0.7.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-2.0.5.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-2.0.4.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-2.0.3.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-2.0.2.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-2.0.1.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-2.0.0.pre.beta app/assets/javascripts/admin/page-edit.js
trusty-cms-1.2.29 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.2.28 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.28 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.27 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.26 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.25 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.24 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.23 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.22 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.21 app/assets/javascripts/admin/page-edit.js
trusty-cms-1.1.20 app/assets/javascripts/admin/page-edit.js