Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
neoteric-editor / app / assets / javascripts / asset-manager.js
Size: Mime:
var code;
(function($) {
  "use strict";

  $(function() {
    var $body = $('body');

    $body.on('reveal click', '[data-reveal]', function(e) {
      e.preventDefault();

      var reveal_id = $(this).data('reveal'),
          $modal = $("#" + reveal_id),
          path = $(this).data('html-path');

      $.get(path, {},
        function(data, textStatus, xhr) {
          $modal.html(data).reveal();
      });
    });

    $body.on('submit', '#new_image', function(e) {
      e.preventDefault();
      var data = $(this).serialize();

      $.post(this.action, data,
        function(data, textStatus, xhr) {
          $('#image-picker').reveal({
            open: function() {
              $.get('/admin/images/picker', {},
                function(data, textStatus, xhr) {
                  $('#image-picker').html(data);
              });
            }
          });
      });

    });

    $body.on('click', '#image-picker section a', function(e) {
      e.preventDefault();
      var $img,
          align = $(this).data('align'),
          $parent = $(this).parents('.asset');

      Editor.instance.composer.commands.exec("insertImage", {
        src: $parent.data('src'),
        alt: '',
        "class": align
      });

      $parent.trigger('reveal:close');

    });

    $body.on('click', '#toggle-code', function() {
      $('.editor').hide();
      $('.CodeMirror').toggle();
      code.refresh();
    });
  });
})(jQuery);