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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xueyun Qian
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 @@
<script
src=
"RSVP.js"
type=
"text/javascript"
></script>
\n
<script
src=
"renderjs.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
<!-- custom 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
</head>
\n
<body>
\n
<nav
class=
"ui-title"
>
\n
<div
class=
"breadcrumb_container"
></div>
\n
<h1>
ERP5
</h1>
\n
<p>
\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
\n
</body>
\n
</html>
...
...
@@ -252,7 +262,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
sve
n
</string>
</value>
<value>
<string>
romai
n
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -266,7 +276,7 @@
</item>
<item>
<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>
<key>
<string>
state
</string>
</key>
...
...
@@ -284,7 +294,7 @@
</tuple>
<state>
<tuple>
<float>
14
07318368.87
</float>
<float>
14
11132836.24
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_breadcrumb_js.xml
View file @
14768f82
...
...
@@ -99,16 +99,20 @@
</item>
<item>
<key>
<string>
text_content
</string>
</key>
<value>
<string>
/*jslint indent: 2, maxerr: 3 */\n
/*global URI,
document, window, rJS
*/\n
(function (URI,
document, window, rJS
) {\n
<value>
<string>
/*jslint
nomen: true,
indent: 2, maxerr: 3 */\n
/*global URI,
window, rJS, Handlebars, RSVP
*/\n
(function (URI,
window, rJS, Handlebars, RSVP
) {\n
"use strict";\n
\n
/////////////////////////////////////////////////////////////////\n
// Handlebars\n
/////////////////////////////////////////////////////////////////\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
gadget_klass\n
/////////////////////////////////////////////////////////////////\n
...
...
@@ -124,48 +128,68 @@
return g.getElement()\n
.push(function (element) {\n
g.props.element = element;\n
g.props.nav_element = element.querySelector("nav");\n
});\n
})\n
\n
.declareAcquiredMethod("whoWantToDisplayThis", "whoWantToDisplayThis")\n
.declareAcquiredMethod("jio_get", "jio_get")\n
/////////////////////////////////////////////////////////////////\n
// declared methods\n
/////////////////////////////////////////////////////////////////\n
.declareMethod(\'render\', function (options) {\n
var gadget = this,\n
parent_queue = new RSVP.Queue(),\n
parent_list = [];\n
\n
var h1_element = this.props.element.querySelector("h1"),\n
parent_element = this.props.element.querySelector(".breadcrumb_container"),\n
title = options.title || "ERP5",\n
parent_link = options.parent_link,\n
gadget = this,\n
uri,\n
link_element;\n
function handleParent(parent_link) {\n
parent_queue.push(function () {\n
var uri,\n
jio_key;\n
if (parent_link !== undefined) {\n
uri = new URI(parent_link.href);\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
h1_element.textContent = title;\n
// Clear the previous rendering\n
while (parent_element.firstChild) {\n
parent_element.removeChild(parent_element.firstChild);\n
}\n
});\n
}\n
if (parent_link !== undefined) {\n
uri = new URI(parent_link.href);\n
return gadget.whoWantToDisplayThis(uri.segment(2))\n
.push(function (parent_href) {\n
link_element = document.createElement("a");\n
// XXX Romain: please allow to "go home" via breadcrumb\n
if (parent_href === "#erp5_gadget.jio_key=undefined") {\n
parent_href = "#";\n
}\n
link_element.textContent = parent_link.name || "Home";\n
link_element.href = parent_href;\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
handleParent(options.parent_link);\n
\n
return new RSVP.Queue()\n
.push(function () {\n
return parent_queue;\n
})\n
.push(function () {\n
gadget.props.nav_element.innerHTML = breadcrumb_template({\n
title: options.title || "ERP5",\n
parentlist: parent_list\n
});\n
}
\n
});
\n
});\n
\n
}(URI,
document, window, rJS
));
</string>
</value>
}(URI,
window, rJS, Handlebars, RSVP
));
</string>
</value>
</item>
<item>
<key>
<string>
title
</string>
</key>
...
...
@@ -300,7 +324,7 @@
</item>
<item>
<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>
<key>
<string>
state
</string>
</key>
...
...
@@ -318,7 +342,7 @@
</tuple>
<state>
<tuple>
<float>
1411
053138.25
</float>
<float>
1411
135730.1
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_html.xml
View file @
14768f82
...
...
@@ -140,15 +140,7 @@
<div
data-gadget-url=
"gadget_erp5_breadcrumb.html"
\n
data-gadget-scope=
"breadcrumb"
\n
data-gadget-sandbox=
"public"
></div>
\n
</div>
\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
<a
class=
"responsive ui-btn ui-icon-plus ui-btn-icon-left ui-disabled"
role=
"button"
data-role=
"button"
>
New
</a>
\n
</header>
\n
\n
<article></article>
\n
...
...
@@ -156,7 +148,6 @@
<section
data-gadget-url=
"gadget_jio.html"
\n
data-gadget-scope=
"jio_gadget"
\n
data-gadget-sandbox=
"public"
></section>
\n
<!-- <aside></aside> -->
\n
</body>
\n
</html>
...
...
@@ -281,7 +272,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
sve
n
</string>
</value>
<value>
<string>
romai
n
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -295,7 +286,7 @@
</item>
<item>
<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>
<key>
<string>
state
</string>
</key>
...
...
@@ -313,7 +304,7 @@
</tuple>
<state>
<tuple>
<float>
14
07832402.03
</float>
<float>
14
11130950.24
</float>
<string>
GMT
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_js.xml
View file @
14768f82
...
...
@@ -558,7 +558,7 @@
</item>
<item>
<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>
<key>
<string>
state
</string>
</key>
...
...
@@ -576,7 +576,7 @@
</tuple>
<state>
<tuple>
<float>
1411
051824.1
1
</float>
<float>
1411
135519.9
1
</float>
<string>
GMT
</string>
</tuple>
</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