ReactJS (JSX) + jQuery Nestable Menu Manager
ReactJS (JSX) with Addons & the Nestable jQuery Plugin to create a menu manager
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/JSXTransformer.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.1/react-with-addons.js"></script>
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://rawgit.com/tiagocasanovapt/Nestable/master/jquery.nestable.js"></script>
<script src="https://facebook.github.io/react/js/jsfiddle-integration.js"></script>
<div id="content" class="container"></div>
<textarea id="nestable-output" readonly></textarea>
CSS
body { font-size: 100%; margin: 0; padding: 1.75em; font-family: 'Helvetica Neue', Arial, sans-serif; }
/**
* Nestable
*/
.dd { position: relative; display: block; margin: 0; padding: 0; max-width: 600px; list-style: none; font-size: 13px; line-height: 20px; }
.dd-list { display: block; position: relative; margin: 0; padding: 0; list-style: none; }
.dd-list .dd-list { padding-left: 30px; }
.dd-collapsed .dd-list { display: none; }
.dd-item,
.dd-empty,
.dd-placeholder { display: block; position: relative; margin: 0; padding: 0; min-height: 20px; font-size: 13px; line-height: 20px; }
.dd-handle { display: block; height: 30px; margin: 5px 0; padding: 5px 10px; color: #333; text-decoration: none; font-weight: bold; border: 1px solid #ccc;
background: #fafafa;
background: -webkit-linear-gradient(top, #fafafa 0%, #eee 100%);
background: -moz-linear-gradient(top, #fafafa 0%, #eee 100%);
background: linear-gradient(top, #fafafa 0%, #eee 100%);
-webkit-border-radius: 3px;
border-radius: 3px;
box-sizing: border-box; -moz-box-sizing: border-box;
}
.dd-handle:hover { color: #2ea8e5; background: #fff; }
.dd-item > button { display: block; position: relative; cursor: pointer; float: left; width: 25px; height: 20px; margin: 5px 0; padding: 0; text-indent: 100%; white-space: nowrap; overflow: hidden; border: 0; background: transparent; font-size: 12px; line-height: 1; text-align: center; font-weight: bold; }
.dd-item > button:before { content: '+'; display: block; position: absolute; width: 100%; text-align: center; text-indent: 0; }
.dd-item > button[data-action="collapse"]:before { content: '-'; }
.dd-placeholder,
.dd-empty { margin: 5px 0; padding: 0; min-height: 30px; background: #f2fbff; border: 1px dashed #b6bcbf; box-sizing: border-box; -moz-box-sizing: border-box; }
.dd-empty { border: 1px dashed #bbb; min-height: 100px; background-color: #e5e5e5;
background-image: -webkit-linear-gradient(45deg, #fff 25%, transparent...
JavaScript 1.7
//JSON initial data
var menus = [
{ menu_id: "navigation_menu1", title: "Main Menu", items: [{ id: 1, title: "Item1", link_to: "Products", url: "/product1" }, { id: 2, title: "Item2", link_to: "", url: "", children: [{ id: 3, title: "Item3", link_to: "Products", url: "/product2", children: [{ id: 4, title: "Item4", link_to: "Products", url: "/product3" }]}]}, { id: 5, title: "Item5", link_to: "", url: "", children: [{ id: 6, title: "Item6", link_to: "Products", url: "/product4" }]}]},
{ menu_id: "navigation_menu2", title: "Footer", items: [{ id: 7, title: "Item7", link_to: "Products", url: "/product1" }, { id: 8, title: "Item8", link_to: "Products", url: "/product2" }, { id: 9, title: "Item9", link_to: "Products", url: "/product3" }, { id: 10, title: "Item10", link_to: "Products", url: "/product4" }, { id: 11, title: "Item11", link_to: "Products", url: "/product5" }] },
{ menu_id: "navigation_menu3", title: "Extra Menu", items: [{ id: 12, title: "Item12", link_to: "Products", url: "/product1" }, { id: 13, title: "Item13", link_to: "Products", url: "/product2" }, { id: 14, title: "Item14", link_to: "Products", url: "/product3" }, { id: 15, title: "Item15", link_to: "Products", url: "/product4" }] }
];
var MenuItem = React.createClass({
render: function() {
return (
<li className="dd-item dd3-item" data-title={this.props.data.title} data-link_to={this.props.data.link_to} data-url={this.props.data.url} data-id={this.props.data.id}>
<div className="dd-handle dd3-handle">Drag</div><div className="dd3-content">{this.props.data.title}</div>
</li>
);
}
});
var MenuDropdownItem = React.createClass({
render: function() {
return (
<li className="dd-item dd3-item" data-title={this.props.data.title} data-id={this.props.data.id}>
<div className="dd-handle dd3-handle">Drag
</div><div...