Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
14768f82
Commit
14768f82
authored
Sep 19, 2014
by
Romain Courteaud
Committed by
Sebastien Robin
Sep 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Calculate full document breadcrumb
parent
549864c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
56 deletions
+81
-56
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_breadcrumb_html.xml
...eItem/web_page_module/rjs_gadget_erp5_breadcrumb_html.xml
+17
-7
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_breadcrumb_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_breadcrumb_js.xml
+58
-34
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_html.xml
...PathTemplateItem/web_page_module/rjs_gadget_erp5_html.xml
+4
-13
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
...i/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_breadcrumb_html.xml
View file @
14768f82
...
@@ -116,18 +116,28 @@
...
@@ -116,18 +116,28 @@
<script
src=
"RSVP.js"
type=
"text/javascript"
></script>
\n
<script
src=
"RSVP.js"
type=
"text/javascript"
></script>
\n
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
\n
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
\n
<script
src=
"URI.js"
type=
"text/javascript"
></script>
\n
<script
src=
"URI.js"
type=
"text/javascript"
></script>
\n
\n
<script
src=
"handlebars.js"
type=
"text/javascript"
></script>
\n
\n
\n
<!-- custom script -->
\n
<!-- custom script -->
\n
<script
src=
"gadget_erp5_breadcrumb.js"
type=
"text/javascript"
></script>
\n
<script
src=
"gadget_erp5_breadcrumb.js"
type=
"text/javascript"
></script>
\n
\n
<script
id=
"breadcrumb-template"
type=
"text/x-handlebars-template"
>
\n
<p>
\n
{{#each parentlist}}\n
<a
href=
"{{link}}"
>
{{title}}
</a>
>\n
{{/each}}\n
<a
class=
"responsive ui-btn ui-icon-carat-d ui-btn-icon-right"
data-role=
"button"
role=
"button"
>
{{title}}
</a>
\n
</p>
\n
</script>
\n
\n
\n
\n
</head>
\n
</head>
\n
<body>
\n
<body>
\n
<nav
class=
"ui-title"
>
\n
<nav
class=
"ui-title"
>
\n
<div
class=
"breadcrumb_container"
></div>
\n
<p>
\n
<h1>
ERP5
</h1>
\n
<a
class=
"responsive ui-btn ui-icon-carat-d ui-btn-icon-right"
data-role=
"button"
role=
"button"
>
ERP5
</a>
\n
</p>
\n
</nav>
\n
</nav>
\n
\n
</body>
\n
</body>
\n
</html>
</html>
...
@@ -252,7 +262,7 @@
...
@@ -252,7 +262,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
sve
n
</string>
</value>
<value>
<string>
romai
n
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -266,7 +276,7 @@
...
@@ -266,7 +276,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
93
6.46085.31000.7680
</string>
</value>
<value>
<string>
93
7.44124.45260.39765
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -284,7 +294,7 @@
...
@@ -284,7 +294,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
07318368.87
</float>
<float>
14
11132836.24
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_breadcrumb_js.xml
View file @
14768f82
...
@@ -99,16 +99,20 @@
...
@@ -99,16 +99,20 @@
</item>
</item>
<item>
<item>
<key>
<string>
text_content
</string>
</key>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*jslint indent: 2, maxerr: 3 */\n
<value>
<string>
/*jslint
nomen: true,
indent: 2, maxerr: 3 */\n
/*global URI,
document, window, rJS
*/\n
/*global URI,
window, rJS, Handlebars, RSVP
*/\n
(function (URI,
document, window, rJS
) {\n
(function (URI,
window, rJS, Handlebars, RSVP
) {\n
"use strict";\n
"use strict";\n
\n
\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
// Handlebars\n
// Handlebars\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
// Precompile the templates while loading the first gadget instance\n
// Precompile the templates while loading the first gadget instance\n
var gadget_klass = rJS(window);\n
var gadget_klass = rJS(window),\n
source = gadget_klass.__template_element\n
.getElementById("breadcrumb-template")\n
.innerHTML,\n
breadcrumb_template = Handlebars.compile(source);\n
\n
\n
gadget_klass\n
gadget_klass\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
...
@@ -124,48 +128,68 @@
...
@@ -124,48 +128,68 @@
return g.getElement()\n
return g.getElement()\n
.push(function (element) {\n
.push(function (element) {\n
g.props.element = element;\n
g.props.element = element;\n
g.props.nav_element = element.querySelector("nav");\n
});\n
});\n
})\n
})\n
\n
\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("jio_get", "jio_get")\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
/////////////////////////////////////////////////////////////////\n
.declareMethod(\'render\', function (options) {\n
.declareMethod(\'render\', function (options) {\n
var gadget = this,\n
parent_queue = new RSVP.Queue(),\n
parent_list = [];\n
\n
\n
var h1_element = this.props.element.querySelector("h1"),\n
function handleParent(parent_link) {\n
parent_element = this.props.element.querySelector(".breadcrumb_container"),\n
parent_queue.push(function () {\n
title = options.title || "ERP5",\n
var uri,\n
parent_link = options.parent_link,\n
jio_key;\n
gadget = this,\n
if (parent_link !== undefined) {\n
uri,\n
uri = new URI(parent_link.href);\n
link_element;\n
jio_key = uri.segment(2);\n
if (jio_key === undefined) {\n
// Parent is the ERP5 site\n
parent_list.splice(0, 0, {\n
title: "ERP5",\n
link: "#"\n
});\n
} else {\n
// Parent is an ERP5 document\n
return gadget.whoWantToDisplayThis(jio_key)\n
.push(function (parent_href) {\n
parent_list.splice(0, 0, {\n
title: parent_link.name,\n
link: parent_href\n
});\n
return gadget.jio_get({"_id": jio_key});\n
})\n
.push(function (result) {\n
// XXX Copy/pasted from gadget_erp5.js\n
handleParent(result.data._links.parent || "#");\n
});\n
}\n
\n
\n
h1_element.textContent = title;\n
}\n
// Clear the previous rendering\n
});\n
while (parent_element.firstChild) {\n
parent_element.removeChild(parent_element.firstChild);\n
}\n
}\n
if (parent_link !== undefined) {\n
\n
uri = new URI(parent_link.href);\n
handleParent(options.parent_link);\n
return gadget.whoWantToDisplayThis(uri.segment(2))\n
\n
.push(function (parent_href) {\n
return new RSVP.Queue()\n
link_element = document.createElement("a");\n
.push(function () {\n
// XXX Romain: please allow to "go home" via breadcrumb\n
return parent_queue;\n
if (parent_href === "#erp5_gadget.jio_key=undefined") {\n
})\n
parent_href = "#";\n
.push(function () {\n
}\n
gadget.props.nav_element.innerHTML = breadcrumb_template({\n
link_element.textContent = parent_link.name || "Home";\n
title: options.title || "ERP5",\n
link_element.href = parent_href;\n
parentlist: parent_list\n
link_element.setAttribute("class", "responsive ui-btn ui-icon-carat-u ui-btn-icon-left");\n
link_element.setAttribute("data-role", "button");\n
link_element.setAttribute("role", "button");\n
parent_element.appendChild(link_element);\n
});\n
});\n
}
\n
});
\n
});\n
});\n
\n
\n
}(URI,
document, window, rJS
));
</string>
</value>
}(URI,
window, rJS, Handlebars, RSVP
));
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
title
</string>
</key>
<key>
<string>
title
</string>
</key>
...
@@ -300,7 +324,7 @@
...
@@ -300,7 +324,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
937.4
2799.61797.6376
1
</string>
</value>
<value>
<string>
937.4
4174.27024.3845
1
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -318,7 +342,7 @@
...
@@ -318,7 +342,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1411
053138.25
</float>
<float>
1411
135730.1
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_html.xml
View file @
14768f82
...
@@ -140,15 +140,7 @@
...
@@ -140,15 +140,7 @@
<div
data-gadget-url=
"gadget_erp5_breadcrumb.html"
\n
<div
data-gadget-url=
"gadget_erp5_breadcrumb.html"
\n
data-gadget-scope=
"breadcrumb"
\n
data-gadget-scope=
"breadcrumb"
\n
data-gadget-sandbox=
"public"
></div>
\n
data-gadget-sandbox=
"public"
></div>
\n
</div>
\n
<a
class=
"responsive ui-btn ui-icon-plus ui-btn-icon-left ui-disabled"
role=
"button"
data-role=
"button"
>
New
</a>
\n
\n
<div
class=
"ui-controlgroup ui-controlgroup-horizontal ui-btn-right"
>
\n
<div
class=
"ui-controlgroup-controls"
>
\n
<a
class=
"responsive ui-btn ui-icon-plus ui-btn-icon-left ui-disabled"
role=
"button"
data-role=
"button"
>
New
</a>
\n
<a
role=
"button"
data-role=
"button"
href=
"#"
class=
"responsive ui-btn ui-icon-home ui-btn-icon-left"
>
Home
</a>
\n
</div>
\n
</div>
\n
\n
</header>
\n
</header>
\n
\n
\n
<article></article>
\n
<article></article>
\n
...
@@ -156,7 +148,6 @@
...
@@ -156,7 +148,6 @@
<section
data-gadget-url=
"gadget_jio.html"
\n
<section
data-gadget-url=
"gadget_jio.html"
\n
data-gadget-scope=
"jio_gadget"
\n
data-gadget-scope=
"jio_gadget"
\n
data-gadget-sandbox=
"public"
></section>
\n
data-gadget-sandbox=
"public"
></section>
\n
<!-- <aside></aside> -->
\n
</body>
\n
</body>
\n
</html>
</html>
...
@@ -281,7 +272,7 @@
...
@@ -281,7 +272,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
sve
n
</string>
</value>
<value>
<string>
romai
n
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -295,7 +286,7 @@
...
@@ -295,7 +286,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
93
6.49302.26306.5341
</string>
</value>
<value>
<string>
93
7.43906.3473.2406
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -313,7 +304,7 @@
...
@@ -313,7 +304,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
14
07832402.03
</float>
<float>
14
11130950.24
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
View file @
14768f82
...
@@ -558,7 +558,7 @@
...
@@ -558,7 +558,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
937.4
2777.53771.30873
</string>
</value>
<value>
<string>
937.4
4173.5242.20019
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -576,7 +576,7 @@
...
@@ -576,7 +576,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1411
051824.1
1
</float>
<float>
1411
135519.9
1
</float>
<string>
GMT
</string>
<string>
GMT
</string>
</tuple>
</tuple>
</state>
</state>
...
...
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