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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Georgios Dagkakis
erp5
Commits
e4eacdcc
Commit
e4eacdcc
authored
Oct 30, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Header: remove handlebars dependency
parent
18415f4d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
56 deletions
+62
-56
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_header_html.html
...lateItem/web_page_module/rjs_gadget_erp5_header_html.html
+0
-18
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_header_html.xml
...plateItem/web_page_module/rjs_gadget_erp5_header_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_header_js.js
...TemplateItem/web_page_module/rjs_gadget_erp5_header_js.js
+57
-33
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_header_js.xml
...emplateItem/web_page_module/rjs_gadget_erp5_header_js.xml
+3
-3
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_header_html.html
View file @
e4eacdcc
...
@@ -35,29 +35,11 @@
...
@@ -35,29 +35,11 @@
<!-- renderjs -->
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"handlebars.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_erp5_header.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_header.js"
type=
"text/javascript"
></script>
<script
id=
"header-title-link-template"
type=
"text/x-handlebars-template"
>
<
a
data
-
i18n
=
"
{{title}}
"
class
=
"
ui-btn-icon-left ui-icon-{{icon}}
"
href
=
"
{{url}}
"
accesskey
=
"
u
"
>
{{
title
}}
<
/a>
</script>
<script
id=
"header-title-template"
type=
"text/x-handlebars-template"
>
<
span
data
-
i18n
=
"
{{title}}
"
class
=
"
ui-btn-icon-left ui-icon-{{icon}}
"
>
{{
title
}}
<
/span>
</script>
<script
id=
"header-link-template"
type=
"text/x-handlebars-template"
>
<
a
data
-
i18n
=
"
{{title}}
"
href
=
"
{{url}}
"
class
=
"
ui-icon-{{icon}} ui-btn-icon-left {{class}}
"
>
{{
title
}}
<
/a
>
</script>
<script
id=
"header-button-template"
type=
"text/x-handlebars-template"
>
<
form
><
button
name
=
'
{{name}}
'
data
-
i18n
=
"
{{title}}
"
type
=
'
submit
'
class
=
'
ui-icon-{{icon}} ui-btn-icon-left {{class}}
'
>
{{
title
}}
<
/button></
form
>
</script>
<script
id=
"sub-header-template"
type=
"text/x-handlebars-template"
>
{{
#
each
sub_header_list
}}
<
li
><
a
href
=
"
{{url}}
"
data
-
i18n
=
"
{{title}}
"
class
=
"
ui-btn-icon-top ui-icon-{{icon}} {{class}}
"
>
{{
title
}}
<
/a></
li
>
{{
/
each
}}
</script>
</head>
</head>
<body>
<body>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_header_html.xml
View file @
e4eacdcc
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
97
0.13790.51027.2964
4
</string>
</value>
<value>
<string>
97
1.18968.42363.1597
4
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -252,7 +252,7 @@
...
@@ -252,7 +252,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
37195423.01
</float>
<float>
15
40898036.46
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_header_js.js
View file @
e4eacdcc
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*global window, rJS,
Handlebars,
document, RSVP */
/*global window, rJS, document, RSVP */
(
function
(
window
,
rJS
,
Handlebars
,
document
,
RSVP
)
{
(
function
(
window
,
rJS
,
document
,
RSVP
)
{
"
use strict
"
;
"
use strict
"
;
/////////////////////////////////////////////////////////////////
var
possible_left_button_list
=
[
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
template_element
=
gadget_klass
.
__template_element
,
header_title_template
=
Handlebars
.
compile
(
template_element
.
getElementById
(
"
header-title-template
"
)
.
innerHTML
),
header_title_link_template
=
Handlebars
.
compile
(
template_element
.
getElementById
(
"
header-title-link-template
"
)
.
innerHTML
),
sub_header_template
=
Handlebars
.
compile
(
template_element
.
getElementById
(
"
sub-header-template
"
)
.
innerHTML
),
header_button_template
=
Handlebars
.
compile
(
template_element
.
getElementById
(
"
header-button-template
"
)
.
innerHTML
),
header_link_template
=
Handlebars
.
compile
(
template_element
.
getElementById
(
"
header-link-template
"
)
.
innerHTML
),
possible_left_button_list
=
[
[
'
panel_action
'
,
'
Menu
'
,
'
bars
'
,
'
panel
'
]
[
'
panel_action
'
,
'
Menu
'
,
'
bars
'
,
'
panel
'
]
],
],
possible_main_link_list
=
[
possible_main_link_list
=
[
...
@@ -61,9 +38,40 @@
...
@@ -61,9 +38,40 @@
[
'
next_url
'
,
'
Next
'
,
'
carat-r
'
],
[
'
next_url
'
,
'
Next
'
,
'
carat-r
'
],
[
'
upload_url
'
,
'
Upload
'
,
'
upload
'
],
[
'
upload_url
'
,
'
Upload
'
,
'
upload
'
],
[
'
download_url
'
,
'
Download
'
,
'
download
'
]
[
'
download_url
'
,
'
Download
'
,
'
download
'
]
];
],
header_button_template
=
function
(
data
)
{
// <form><button name='{{name}}' data-i18n="{{title}}" type='submit' class='ui-icon-{{icon}} ui-btn-icon-left {{class}}'>{{title}}</button></form>
var
form_element
=
document
.
createElement
(
'
form
'
),
button_element
=
document
.
createElement
(
'
button
'
);
button_element
.
setAttribute
(
'
name
'
,
data
.
name
);
button_element
.
setAttribute
(
'
data-i18n
'
,
data
.
title
);
button_element
.
setAttribute
(
'
type
'
,
'
submit
'
);
button_element
.
setAttribute
(
'
class
'
,
'
ui-icon-
'
+
data
.
icon
+
'
ui-btn-icon-left
'
+
data
.
class
);
form_element
.
appendChild
(
button_element
);
return
form_element
.
outerHTML
;
},
sub_header_template
=
function
(
data
)
{
// {{#each sub_header_list}}
// <li><a href="{{url}}" data-i18n="{{title}}" class="ui-btn-icon-top ui-icon-{{icon}} {{class}}">{{title}}</a></li>
// {{/each}}
var
fragment
=
document
.
createElement
(
'
div
'
),
li_element
,
a_element
,
i
;
for
(
i
=
0
;
i
<
data
.
sub_header_list
.
length
;
i
+=
1
)
{
li_element
=
document
.
createElement
(
'
li
'
);
a_element
=
document
.
createElement
(
'
a
'
);
a_element
.
setAttribute
(
'
href
'
,
data
.
sub_header_list
[
i
].
url
);
a_element
.
setAttribute
(
'
data-i18n
'
,
data
.
sub_header_list
[
i
].
title
);
a_element
.
setAttribute
(
'
class
'
,
'
ui-btn-icon-top ui-icon-
'
+
data
.
sub_header_list
[
i
].
icon
+
'
'
+
data
.
sub_header_list
[
i
].
class
);
li_element
.
appendChild
(
a_element
);
fragment
.
appendChild
(
li_element
);
}
return
fragment
.
innerHTML
;
};
gadget_klass
rJS
(
window
)
.
setState
({
.
setState
({
loaded
:
false
,
loaded
:
false
,
modified
:
false
,
modified
:
false
,
...
@@ -243,7 +251,8 @@
...
@@ -243,7 +251,8 @@
default_right_icon
=
""
,
default_right_icon
=
""
,
title_link
,
title_link
,
title_button
,
title_button
,
promise_list
=
[];
promise_list
=
[],
tmp_element
;
// Main title
// Main title
if
(
modification_dict
.
hasOwnProperty
(
'
error
'
)
||
if
(
modification_dict
.
hasOwnProperty
(
'
error
'
)
||
modification_dict
.
hasOwnProperty
(
'
loaded
'
)
||
modification_dict
.
hasOwnProperty
(
'
loaded
'
)
||
...
@@ -277,9 +286,19 @@
...
@@ -277,9 +286,19 @@
};
};
promise_list
.
push
(
gadget
.
translateHtml
(
header_button_template
(
title_button
)));
promise_list
.
push
(
gadget
.
translateHtml
(
header_button_template
(
title_button
)));
}
else
if
(
title_link
.
url
===
undefined
)
{
}
else
if
(
title_link
.
url
===
undefined
)
{
promise_list
.
push
(
gadget
.
translateHtml
(
header_title_template
(
title_link
)));
// <span data-i18n="{{title}}" class="ui-btn-icon-left ui-icon-{{icon}}" >{{title}}</span>
tmp_element
=
document
.
createElement
(
'
span
'
);
tmp_element
.
setAttribute
(
'
data-i18n
'
,
title_link
.
title
);
tmp_element
.
setAttribute
(
'
class
'
,
'
ui-btn-icon-left ui-icon-
'
+
title_link
.
icon
);
promise_list
.
push
(
gadget
.
translateHtml
(
tmp_element
.
outerHTML
));
}
else
{
}
else
{
promise_list
.
push
(
gadget
.
translateHtml
(
header_title_link_template
(
title_link
)));
// <a data-i18n="{{title}}" class="ui-btn-icon-left ui-icon-{{icon}}" href="{{url}}" accesskey="u">{{title}}</a>
tmp_element
=
document
.
createElement
(
'
a
'
);
tmp_element
.
setAttribute
(
'
data-i18n
'
,
title_link
.
title
);
tmp_element
.
setAttribute
(
'
class
'
,
'
ui-btn-icon-left ui-icon-
'
+
title_link
.
icon
);
tmp_element
.
setAttribute
(
'
href
'
,
title_link
.
url
);
tmp_element
.
setAttribute
(
'
accesskey
'
,
'
u
'
);
promise_list
.
push
(
gadget
.
translateHtml
(
tmp_element
.
outerHTML
));
}
}
}
else
{
}
else
{
promise_list
.
push
(
null
);
promise_list
.
push
(
null
);
...
@@ -337,7 +356,12 @@
...
@@ -337,7 +356,12 @@
if
(
right_button
!==
undefined
)
{
if
(
right_button
!==
undefined
)
{
promise_list
.
push
(
gadget
.
translateHtml
(
header_button_template
(
right_button
)));
promise_list
.
push
(
gadget
.
translateHtml
(
header_button_template
(
right_button
)));
}
else
if
(
right_link
!==
undefined
)
{
}
else
if
(
right_link
!==
undefined
)
{
promise_list
.
push
(
gadget
.
translateHtml
(
header_link_template
(
right_link
)));
// <a data-i18n="{{title}}" href="{{url}}" class="ui-icon-{{icon}} ui-btn-icon-left {{class}}">{{title}}</a>
tmp_element
=
document
.
createElement
(
'
a
'
);
tmp_element
.
setAttribute
(
'
data-i18n
'
,
right_link
.
title
);
tmp_element
.
setAttribute
(
'
class
'
,
'
ui-icon-
'
+
right_link
.
icon
+
'
ui-btn-icon-left
'
+
right_link
.
class
);
tmp_element
.
setAttribute
(
'
href
'
,
right_link
.
url
);
promise_list
.
push
(
gadget
.
translateHtml
(
tmp_element
.
outerHTML
));
}
else
{
}
else
{
promise_list
.
push
(
""
);
promise_list
.
push
(
""
);
}
}
...
@@ -385,4 +409,4 @@
...
@@ -385,4 +409,4 @@
throw
new
Error
(
"
Unsupported button
"
+
name
);
throw
new
Error
(
"
Unsupported button
"
+
name
);
});
});
}(
window
,
rJS
,
Handlebars
,
document
,
RSVP
));
}(
window
,
rJS
,
document
,
RSVP
));
\ No newline at end of file
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_header_js.xml
View file @
e4eacdcc
...
@@ -222,7 +222,7 @@
...
@@ -222,7 +222,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
P0
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
69.27633.19787.19507
</string>
</value>
<value>
<string>
9
71.18983.58402.648
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
15
33641152.13
</float>
<float>
15
40898451.07
</float>
<string>
UTC
</string>
<string>
UTC
</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