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
Labels
Merge Requests
142
Merge Requests
142
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
84cb9ebf
Commit
84cb9ebf
authored
Apr 02, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP - erp5_officejs: new action page for offline app
parent
5ee2f559
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
826 additions
and
10 deletions
+826
-10
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
...e_module/gadget_officejs_controller_page_controller_js.js
+27
-8
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
..._module/gadget_officejs_controller_page_controller_js.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_offline_html.html
...page_module/gadget_officejs_page_action_offline_html.html
+44
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_offline_html.xml
..._page_module/gadget_officejs_page_action_offline_html.xml
+322
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_offline_js.js
...web_page_module/gadget_officejs_page_action_offline_js.js
+113
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_offline_js.xml
...eb_page_module/gadget_officejs_page_action_offline_js.xml
+318
-0
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
View file @
84cb9ebf
/*global document, window, rJS, RSVP */
/*global document, window, rJS, RSVP
, URLSearchParams
*/
/*jslint nomen: true, indent: 2, maxerr: 3 */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
document
,
window
,
rJS
,
RSVP
)
{
(
function
(
document
,
window
,
rJS
,
RSVP
,
URLSearchParams
)
{
"
use strict
"
;
"
use strict
"
;
function
renderField
(
field_id
,
field_definition
,
document
)
{
function
renderField
(
field_id
,
field_definition
,
document
)
{
...
@@ -41,6 +41,21 @@
...
@@ -41,6 +41,21 @@
return
result
;
return
result
;
}
}
function
getActionReference
(
view_url_parameters
)
{
var
parser
=
document
.
createElement
(
'
a
'
),
urlParams
,
action_reference
;
if
(
view_url_parameters
.
indexOf
(
"
#!change?
"
)
!==
-
1
)
{
parser
.
href
=
window
.
location
.
origin
+
"
/
"
+
view_url_parameters
.
replace
(
/#!change
?
/g
,
'
change?
'
);
urlParams
=
new
URLSearchParams
(
parser
.
search
);
action_reference
=
urlParams
.
get
(
"
n.action
"
);
}
else
{
action_reference
=
view_url_parameters
}
if
(
action_reference
===
undefined
||
action_reference
===
null
||
action_reference
===
"
view
"
)
{
action_reference
=
"
jio_view
"
;
}
return
action_reference
;
}
rJS
(
window
)
rJS
(
window
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
@@ -63,12 +78,16 @@
...
@@ -63,12 +78,16 @@
.
declareMethod
(
"
getFormDefinition
"
,
function
(
portal_type
)
{
.
declareMethod
(
"
getFormDefinition
"
,
function
(
portal_type
)
{
var
gadget
=
this
,
var
gadget
=
this
,
parent
=
"
portal_types/
"
+
portal_type
,
parent
=
"
portal_types/
"
+
portal_type
;
query
=
'
portal_type: "Action Information" AND reference: "jio_view" AND parent_relative_url: "
'
+
parent
+
'
"
'
;
return
gadget
.
getUrlParameter
(
"
view
"
)
return
gadget
.
jio_allDocs
({
query
:
query
})
.
push
(
function
(
view_parameters
)
{
var
action_reference
=
getActionReference
(
view_parameters
),
query
=
'
portal_type: "Action Information" AND reference: "
'
+
action_reference
+
'
" AND parent_relative_url: "
'
+
parent
+
'
"
'
;
return
gadget
.
jio_allDocs
({
query
:
query
});
})
.
push
(
function
(
data
)
{
.
push
(
function
(
data
)
{
if
(
data
.
data
.
rows
.
length
===
0
)
{
if
(
data
.
data
.
rows
.
length
===
0
)
{
throw
"
Can not find
jio_view
action for portal type
"
+
portal_type
;
throw
"
Can not find action for portal type
"
+
portal_type
;
}
}
return
gadget
.
jio_get
(
data
.
data
.
rows
[
0
].
id
);
return
gadget
.
jio_get
(
data
.
data
.
rows
[
0
].
id
);
})
})
...
@@ -183,7 +202,7 @@
...
@@ -183,7 +202,7 @@
.
push
(
function
()
{
.
push
(
function
()
{
var
url_for_parameter_list
=
[
var
url_for_parameter_list
=
[
{
command
:
'
change
'
,
options
:
{
page
:
"
tab
"
}},
{
command
:
'
change
'
,
options
:
{
page
:
"
tab
"
}},
{
command
:
'
change
'
,
options
:
{
page
:
"
action
"
}},
{
command
:
'
change
'
,
options
:
{
page
:
"
action
_offline
"
}},
{
command
:
'
history_previous
'
},
{
command
:
'
history_previous
'
},
{
command
:
'
selection_previous
'
},
{
command
:
'
selection_previous
'
},
{
command
:
'
selection_next
'
},
{
command
:
'
selection_next
'
},
...
@@ -261,4 +280,4 @@
...
@@ -261,4 +280,4 @@
});
});
});
});
}(
document
,
window
,
rJS
,
RSVP
));
}(
document
,
window
,
rJS
,
RSVP
,
URLSearchParams
));
\ No newline at end of file
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
View file @
84cb9ebf
...
@@ -225,7 +225,7 @@
...
@@ -225,7 +225,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.
48727.12042.43076
</string>
</value>
<value>
<string>
974.
50403.2705.59170
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -243,7 +243,7 @@
...
@@ -243,7 +243,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1554
135448.09
</float>
<float>
1554
234823.55
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_offline_html.html
0 → 100644
View file @
84cb9ebf
<!DOCTYPE html>
<html>
<head>
<!--
data-i18n=Workflows
data-i18n=Actions
data-i18n=Clone
data-i18n=Delete
-->
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width"
/>
<title>
ERP5 Page Action
</title>
<link
rel=
"http://www.renderjs.org/rel/interface"
href=
"interface_page.html"
>
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<script
src=
"handlebars.js"
type=
"text/javascript"
></script>
<script
src=
"jiodev.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_page_action_offline.js"
type=
"text/javascript"
></script>
<script
id=
"table-template"
type=
"text/x-handlebars-template"
>
<
section
class
=
"
ui-content-header-plain
"
>
<
h3
data
-
i18n
=
"
[last]{{definition_i18n}}
"
>
<
span
class
=
"
ui-icon ui-icon-{{definition_icon}}
"
>&
nbsp
;
<
/span
>
{{
definition_title
}}
<
/h3
>
<
/section
>
<
ul
class
=
"
document-listview
"
>
{{
#
each
document_list
}}
<
li
><
a
data
-
i18n
=
"
{{title}}
"
href
=
"
{{link}}
"
>
{{
title
}}
<
/a></
li
>
{{
/
each
}}
<
/ul
>
</script>
</head>
<body>
</body>
</html>
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_offline_html.xml
0 → 100644
View file @
84cb9ebf
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_offline_js.js
0 → 100644
View file @
84cb9ebf
/*global window, rJS, RSVP, Handlebars, UriTemplate, calculatePageTitle, ensureArray */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
,
UriTemplate
,
calculatePageTitle
,
ensureArray
)
{
"
use strict
"
;
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
table_template
=
Handlebars
.
compile
(
gadget_klass
.
__template_element
.
getElementById
(
"
table-template
"
)
.
innerHTML
);
/** Render translated HTML of title + links
*
* @param {string} title - H3 title of the section with the links
* @param {string} icon - alias used in font-awesome iconset
* @param {Array} command_list - array of links obtained from ERP5 HATEOAS
*/
function
renderLinkList
(
gadget
,
title
,
icon
,
erp5_link_list
)
{
return
gadget
.
getUrlParameter
(
"
extended_search
"
)
.
push
(
function
(
query
)
{
// obtain RJS links from ERP5 links
return
RSVP
.
all
(
erp5_link_list
.
map
(
function
(
erp5_link
)
{
return
gadget
.
getUrlFor
({
"
command
"
:
'
change
'
,
"
options
"
:
{
"
view
"
:
UriTemplate
.
parse
(
erp5_link
.
href
).
expand
({
query
:
query
}),
"
page
"
:
undefined
}
});
})
);
})
.
push
(
function
(
url_list
)
{
// prepare links for template (replace @href for RJS link)
return
gadget
.
translateHtml
(
table_template
({
"
definition_i18n
"
:
title
,
"
definition_title
"
:
title
,
"
definition_icon
"
:
icon
,
"
document_list
"
:
erp5_link_list
.
map
(
function
(
erp5_link
,
index
)
{
return
{
"
title
"
:
erp5_link
.
title
,
"
i18n
"
:
erp5_link
.
title
,
"
link
"
:
url_list
[
index
]
};
})
})
);
});
}
gadget_klass
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
erp5_document
,
document_title
;
return
gadget
.
jio_get
(
options
.
jio_key
)
.
push
(
function
(
document
)
{
var
parent
=
"
portal_types/
"
+
document
.
portal_type
,
query
=
'
portal_type: "Action Information" AND parent_relative_url: "
'
+
parent
+
'
"
'
;
document_title
=
document
.
title
;
return
gadget
.
jio_allDocs
({
query
:
query
});
})
//TODO: build all action urls with corresponding action reference (ignore view, jio_view, etc)
.
push
(
function
(
action_list
)
{
return
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
"
ojs_controller
"
,
action
:
"
reply
"
}});
})
.
push
(
function
(
url
)
{
//TODO temporarily hardcoded
var
action_list
=
[{
href
:
url
,
icon
:
null
,
name
:
"
reply
"
,
title
:
"
Reply
"
}];
return
RSVP
.
all
([
renderLinkList
(
gadget
,
"
Actions
"
,
"
gear
"
,
action_list
)
]);
})
.
push
(
function
(
translated_html_link_list
)
{
gadget
.
element
.
innerHTML
=
translated_html_link_list
.
join
(
"
\n
"
);
return
gadget
.
getUrlFor
({
command
:
'
change
'
,
options
:
{
page
:
undefined
}});
})
.
push
(
function
(
back_url
)
{
return
gadget
.
updateHeader
({
page_title
:
document_title
,
back_url
:
back_url
});
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
return
;
});
}(
window
,
rJS
,
RSVP
,
Handlebars
,
UriTemplate
,
calculatePageTitle
,
ensureArray
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_action_offline_js.xml
0 → 100644
View file @
84cb9ebf
This diff is collapsed.
Click to expand it.
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