Commit 9f081612 authored by Ivan Tyagov's avatar Ivan Tyagov

Extend example so we can use route between gadgets.

parent 02fc697c
<html>
<head></head>
<body>
<h1> Below is Gadget 1</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</body>
</html>
<html>
<head></head>
<body>
<h1> Below is Gadget 2</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</p>
</body>
</html>
......@@ -9,13 +9,6 @@
type="text/javascript"
src="../../lib/require/require.js"></script>
<!-- <script>
/*global document, jQuery */
"use strict";
(function (document, $) {
$(document).ready(function () {});
}(document, jQuery));
</script>-->
</head>
<body>
<noscript>
......
......@@ -21,13 +21,16 @@ require([ "require-renderjs", "jquery", "route", "url" ], function(domReady) {
$.url.redirect('/color/');
});
// add gadget based application
// add gadgets who use route (history)
body
.route("add", "/gadget", 1)
.route("add", "/gadget-one/", 1)
.done(function () {
// Default route. Redirect to color subapp
//$.url.redirect('/color/');
console.log("add gadget");
RenderJs.addGadget('container', "gadget-one", "gadget-one.html", "", "");
});
body
.route("add", "/gadget-two/", 1)
.done(function () {
RenderJs.addGadget('container', "gadget-two", "gadget-two.html", "", "");
});
// /color app. Create subroutes and initialize DOM
......@@ -52,7 +55,10 @@ require([ "require-renderjs", "jquery", "route", "url" ], function(domReady) {
page += "<li style='text-align: center;'><a style='text-decoration: none; display: block; width: 2em;' href='" +
$.url.generateUrl("/color/X/X/X") + "'>XXX<a><\/li>";
page += "<\/ul>";
page += "<div style='display: block;'><\/div>";
page += "<div style='display: block;'><\/div>"
page += "<a href='" + $.url.generateUrl("/gadget-one/") + "'>Gadget 1</a>";
page += "&nbsp;<a href='" + $.url.generateUrl("/gadget-two/") + "'>Gadget 2</a>";
page += "<div id='container'></div>";
$(this).html(page);
// Create sub routed in the container
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment