Sha256: fbf53f076b8ef04f91df6f19a957a009260d571bbd9105b3cb9094956c26a32b
Contents?: true
Size: 1.28 KB
Versions: 154
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
154 entries across 154 versions & 1 rubygems