Sha256: 672481e56c1a1d93ac4db3f061af667bb9b7914b31c3cd156098cfba7a796b68

Contents?: true

Size: 1.09 KB

Versions: 16

Compression:

Stored size: 1.09 KB

Contents

$(function() {
  // Support for AJAX loaded modal window.
  // Focuses on first input textbox after it loads the window.
  $("[data-previewtoggle='modal']").on('click', function(e) {
    e.preventDefault();
    var url = $(this).attr('href');
    if (url.indexOf('#') == 0) {
      $(url).modal('open');
    } else {
      $.get(url, function(data) {
        $('<div class="modal hide fade">' + data + '</div>').modal();
      }).success(function() { $('input:text:visible:first').focus(); });
    }
  });

  $(".page-contents").sortable({
    distance: 20,
    handle: ".handle",
    items: "tr.page_content",
    update: function() {
      $.ajax($(this).attr('data-reorder-href'), {
        data: $(this).sortable("serialize", { key: "order[]" })
      });
    }
  });

  $(".page-list").sortable({
    distance: 20,
    handle: ".handle",
    items: "> li.child",
    update: function() {
      $.ajax("/smithy/pages/order", {
        data: $(".page-list").sortable("serialize", { key: "order[]" })
        // highlight on failure?
        // failure: function(xhr, status, error) {}
      });
    }
  });
});


Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
smithycms-0.5.99.3 app/assets/javascripts/smithy/pages.js
smithycms-0.5.99.2 app/assets/javascripts/smithy/pages.js
smithycms-0.5.99.1 app/assets/javascripts/smithy/pages.js
smithycms-0.5.99 app/assets/javascripts/smithy/pages.js
smithycms-0.5.2 app/assets/javascripts/smithy/pages.js
smithycms-0.5.1 app/assets/javascripts/smithy/pages.js
smithycms-0.5.0 app/assets/javascripts/smithy/pages.js
smithycms-0.4.5 app/assets/javascripts/smithy/pages.js
smithycms-0.4.4 app/assets/javascripts/smithy/pages.js
smithycms-0.4.3 app/assets/javascripts/smithy/pages.js
smithycms-0.4.2 app/assets/javascripts/smithy/pages.js
smithycms-0.4.1 app/assets/javascripts/smithy/pages.js
smithycms-0.4.0 app/assets/javascripts/smithy/pages.js
smithycms-0.0.3 app/assets/javascripts/smithy/pages.js
smithycms-0.0.2 app/assets/javascripts/smithy/pages.js
smithycms-0.0.1 app/assets/javascripts/smithy/pages.js