Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
renderjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
renderjs
Commits
9f081612
Commit
9f081612
authored
Feb 08, 2013
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend example so we can use route between gadgets.
parent
02fc697c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
13 deletions
+36
-13
examples/route/gadget-one.html
examples/route/gadget-one.html
+12
-0
examples/route/gadget-two.html
examples/route/gadget-two.html
+12
-0
examples/route/index.html
examples/route/index.html
+0
-7
examples/route/require-renderjs_route.js
examples/route/require-renderjs_route.js
+12
-6
No files found.
examples/route/gadget-one.html
0 → 100644
View file @
9f081612
<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>
examples/route/gadget-two.html
0 → 100644
View file @
9f081612
<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>
examples/route/index.html
View file @
9f081612
...
@@ -9,13 +9,6 @@
...
@@ -9,13 +9,6 @@
type=
"text/javascript"
type=
"text/javascript"
src=
"../../lib/require/require.js"
></script>
src=
"../../lib/require/require.js"
></script>
<!-- <script>
/*global document, jQuery */
"use strict";
(function (document, $) {
$(document).ready(function () {});
}(document, jQuery));
</script>-->
</head>
</head>
<body>
<body>
<noscript>
<noscript>
...
...
examples/route/require-renderjs_route.js
View file @
9f081612
...
@@ -21,13 +21,16 @@ require([ "require-renderjs", "jquery", "route", "url" ], function(domReady) {
...
@@ -21,13 +21,16 @@ require([ "require-renderjs", "jquery", "route", "url" ], function(domReady) {
$
.
url
.
redirect
(
'
/color/
'
);
$
.
url
.
redirect
(
'
/color/
'
);
});
});
// add gadget
based application
// add gadget
s who use route (history)
body
body
.
route
(
"
add
"
,
"
/gadget
"
,
1
)
.
route
(
"
add
"
,
"
/gadget
-one/
"
,
1
)
.
done
(
function
()
{
.
done
(
function
()
{
// Default route. Redirect to color subapp
RenderJs
.
addGadget
(
'
container
'
,
"
gadget-one
"
,
"
gadget-one.html
"
,
""
,
""
);
//$.url.redirect('/color/');
});
console
.
log
(
"
add gadget
"
);
body
.
route
(
"
add
"
,
"
/gadget-two/
"
,
1
)
.
done
(
function
()
{
RenderJs
.
addGadget
(
'
container
'
,
"
gadget-two
"
,
"
gadget-two.html
"
,
""
,
""
);
});
});
// /color app. Create subroutes and initialize DOM
// /color app. Create subroutes and initialize DOM
...
@@ -52,7 +55,10 @@ require([ "require-renderjs", "jquery", "route", "url" ], function(domReady) {
...
@@ -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='
"
+
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>
"
;
$
.
url
.
generateUrl
(
"
/color/X/X/X
"
)
+
"
'>XXX<a><
\
/li>
"
;
page
+=
"
<
\
/ul>
"
;
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
+=
"
<a href='
"
+
$
.
url
.
generateUrl
(
"
/gadget-two/
"
)
+
"
'>Gadget 2</a>
"
;
page
+=
"
<div id='container'></div>
"
;
$
(
this
).
html
(
page
);
$
(
this
).
html
(
page
);
// Create sub routed in the container
// Create sub routed in the container
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment