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 / Editor.methods.js
Size: Mime:
var Editor = {};

Editor.buildChildren = function(obj) {
  var children = obj.children,
      html = '';

  $.each(children, function(i) {
    this.attrs.html = this.attrs.html || '';
    if (this.children) {
      this.attrs.html += Editor.buildChildren(this);
    }

    html += $(this.tag, this.attrs)[0].outerHTML;
  });

  return html;
};

Editor.buildToolbar = function($toolbar) {
  // Build tools
  for (var tag in toolbars.tools) {
    $toolbar.append($("<a />", toolbars.tools[tag]));
  }

  // Build dialogs
  for (var dialog in toolbars.dialogs) {
    $toolbar.append(function() {
      var attrs = toolbars.dialogs[dialog].attrs,
          children = toolbars.dialogs[dialog].children,
          tags = [],
          el;

      attrs.html = Editor.buildChildren(toolbars.dialogs[dialog]);

      return $("<div />", attrs);
    });
  }

  for (var modal in toolbars.modals) {
    $('body').append(function() {
      var attrs = toolbars.modals[modal].attrs;

      return $("<div />", attrs);
    });
  }
};