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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
erp5
Commits
eccce895
Commit
eccce895
authored
Jul 19, 2016
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Use a listbox to display the list of modules
This will allow to use domain tree when implemented
parent
613a4144
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
118 deletions
+83
-118
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_frontpage_html.html
...em/web_page_module/rjs_gadget_erp5_pt_frontpage_html.html
+4
-16
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_frontpage_html.xml
...tem/web_page_module/rjs_gadget_erp5_pt_frontpage_html.xml
+4
-4
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_frontpage_js.js
...teItem/web_page_module/rjs_gadget_erp5_pt_frontpage_js.js
+73
-96
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_frontpage_js.xml
...eItem/web_page_module/rjs_gadget_erp5_pt_frontpage_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_frontpage_html.html
View file @
eccce895
...
...
@@ -8,28 +8,16 @@
<!-- 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>
<!-- custom script -->
<script
src=
"gadget_global.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_erp5_page_front.js"
type=
"text/javascript"
></script>
<!-- XXX must set theme here! -->
<script
id=
"table-template"
type=
"text/x-handlebars-template"
>
<
div
data
-
role
=
"
collapsible
"
>
<
h3
class
=
"
ui-bar-inherit
"
data
-
i18n
=
"
{{definition_title}}
"
>
{{
definition_title
}}
<
/h3
>
<
ul
data
-
role
=
"
listview
"
data
-
theme
=
"
c
"
class
=
"
document-listview
"
>
<!--<
li
data
-
role
=
"
list-divider
"
><
h1
data
-
i18n
=
"
{{definition_title}}
"
>
{{
definition_title
}}
<
/h1></
li
>-->
{{
#
each
documentlist
}}
<
li
><
a
class
=
"
ui-body-inherit
"
data
-
i18n
=
"
{{title}}
"
href
=
"
{{link}}
"
>
{{
title
}}
<
/a></
li
>
{{
/
each
}}
<
/ul
>
<
/div
>
</script>
</head>
<body>
<section
class=
"document_list"
></section>
<div
data-gadget-url=
"gadget_erp5_pt_form_list.html"
data-gadget-scope=
"form_list"
data-gadget-sandbox=
"public"
>
</div>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_frontpage_html.xml
View file @
eccce895
...
...
@@ -220,7 +220,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
super_sven
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
39.43978.9403.31744
</string>
</value>
<value>
<string>
9
52.43255.60632.47035
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,8 +252,8 @@
</tuple>
<state>
<tuple>
<float>
14
19417426.65
</float>
<string>
GMT
</string>
<float>
14
68942516.97
</float>
<string>
UTC
</string>
</tuple>
</state>
</object>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_frontpage_js.js
View file @
eccce895
/*global window, rJS
, RSVP, Handlebars
*/
/*global window, rJS */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
Handlebars
)
{
(
function
(
window
,
rJS
)
{
"
use strict
"
;
/////////////////////////////////////////////////////////////////
// Handlebars
/////////////////////////////////////////////////////////////////
// Precompile the templates while loading the first gadget instance
var
gadget_klass
=
rJS
(
window
),
source
=
gadget_klass
.
__template_element
.
getElementById
(
"
table-template
"
)
.
innerHTML
,
table_template
=
Handlebars
.
compile
(
source
);
var
gadget_klass
=
rJS
(
window
);
gadget_klass
/////////////////////////////////////////////////////////////////
...
...
@@ -33,104 +29,85 @@
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getUrlParameter
"
,
"
getUrlParameter
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
()
{
var
gadget
=
this
;
return
gadget
.
jio_allDocs
({
"
query
"
:
'
meta_type:"ERP5 Folder" AND id:"%_module"
'
,
"
select_list
"
:
[
"
title
"
,
"
business_application_title
"
],
"
limit
"
:
1000
})
.
allowPublicAcquisition
(
'
updateHeader
'
,
function
()
{
return
;
})
.
allowPublicAcquisition
(
'
getUrlFor
'
,
function
(
argument_list
)
{
if
(
argument_list
[
0
].
command
===
'
index
'
)
{
return
this
.
getUrlFor
({
command
:
'
display_stored_state
'
,
options
:
{
jio_key
:
argument_list
[
0
].
options
.
jio_key
}});
}
return
this
.
getUrlFor
.
apply
(
this
,
argument_list
);
})
.
allowPublicAcquisition
(
'
getUrlParameter
'
,
function
(
argument_list
)
{
return
this
.
getUrlParameter
(
argument_list
)
.
push
(
function
(
result
)
{
var
result_list
=
[],
i
;
for
(
i
=
0
;
i
<
result
.
data
.
rows
.
length
;
i
+=
1
)
{
result_list
.
push
(
RSVP
.
all
([
gadget
.
getUrlFor
({
command
:
'
display_stored_state
'
,
options
:
{
jio_key
:
result
.
data
.
rows
[
i
].
id
}}),
result
.
data
.
rows
[
i
].
value
.
title
||
result
.
data
.
rows
[
i
].
id
,
result
.
data
.
rows
[
i
].
value
.
business_application_title
]));
}
return
RSVP
.
all
(
result_list
);
})
.
push
(
function
(
document_list
)
{
var
i
,
business_application_dict
=
{},
business_application_list
=
[],
business_application
,
module_info
,
result_html
=
'
<div data-role="collapsible-set" data-theme="c">
'
,
doc
;
for
(
i
=
0
;
i
<
document_list
.
length
;
i
+=
1
)
{
doc
=
document_list
[
i
];
if
(
doc
[
2
]
===
undefined
)
{
doc
[
2
]
=
"
Other
"
;
}
module_info
=
{
link
:
doc
[
0
],
title
:
doc
[
1
]
};
if
(
business_application_dict
[
doc
[
2
]]
===
undefined
)
{
business_application_dict
[
doc
[
2
]]
=
[
module_info
];
business_application_list
.
push
(
doc
[
2
]);
}
else
{
business_application_dict
[
doc
[
2
]].
push
(
module_info
);
}
}
business_application_list
.
sort
(
function
(
a
,
b
)
{
// Push the "Other" value at the end
var
result
=
0
;
if
(
a
===
"
Other
"
)
{
result
=
1
;
}
else
if
(
b
===
"
Other
"
)
{
result
=
-
1
;
}
else
if
(
a
<
b
)
{
result
=
-
1
;
}
else
if
(
a
>
b
)
{
result
=
1
;
}
return
result
;
});
function
sort_module
(
a
,
b
)
{
var
result
=
0
;
if
(
a
.
title
<
b
.
title
)
{
result
=
-
1
;
}
else
if
(
a
.
title
>
b
.
title
)
{
result
=
1
;
}
return
result
;
if
((
result
===
undefined
)
&&
(
argument_list
[
0
]
===
'
field_listbox_sort_list:json
'
))
{
return
[[
'
title
'
,
'
ascending
'
]];
}
return
result
;
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
var
argument_list
=
arguments
;
return
this
.
getDeclaredGadget
(
'
form_list
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
triggerSubmit
.
apply
(
gadget
,
argument_list
);
});
})
.
declareMethod
(
"
render
"
,
function
()
{
var
gadget
=
this
,
header_dict
=
{
page_title
:
'
Modules
'
,
filter_action
:
true
};
for
(
i
=
0
;
i
<
business_application_list
.
length
;
i
+=
1
)
{
business_application
=
business_application_list
[
i
];
business_application_dict
[
business_application
].
sort
(
sort_module
);
result_html
+=
table_template
({
definition_title
:
business_application
,
documentlist
:
business_application_dict
[
business_application
]
});
}
result_html
+=
'
</div>
'
;
return
gadget
.
translateHtml
(
result_html
);
return
gadget
.
updateHeader
(
header_dict
)
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_list
'
);
})
.
push
(
function
(
my_translated_html
)
{
gadget
.
props
.
element
.
querySelector
(
'
.document_list
'
).
innerHTML
=
my_translated_html
;
return
gadget
.
updateHeader
({
page_title
:
'
Modules
'
.
push
(
function
(
form_gadget
)
{
var
column_list
=
[
[
'
title
'
,
'
Title
'
]
];
return
form_gadget
.
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
listbox
"
:
{
"
column_list
"
:
column_list
,
"
show_anchor
"
:
0
,
"
default_params
"
:
{},
"
editable
"
:
1
,
"
editable_column_list
"
:
[],
"
key
"
:
"
field_listbox
"
,
"
lines
"
:
1000
,
"
list_method
"
:
"
portal_catalog
"
,
"
query
"
:
"
urn:jio:allDocs?query=meta_type%3A%22ERP5%20Folder%22%20AND%20id%3A%22%25_module%22
"
,
"
portal_type
"
:
[],
"
search_column_list
"
:
column_list
,
"
sort_column_list
"
:
column_list
,
"
title
"
:
"
Modules
"
,
"
type
"
:
"
ListBox
"
}
}},
"
_links
"
:
{
"
type
"
:
{
// form_list display portal_type in header
name
:
""
}
}},
form_definition
:
{
group_list
:
[[
"
bottom
"
,
[[
"
listbox
"
]]
]]
}
});
});
});
}(
window
,
rJS
,
RSVP
,
Handlebars
));
\ No newline at end of file
}(
window
,
rJS
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_pt_frontpage_js.xml
View file @
eccce895
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
47.821.64587.50432
</string>
</value>
<value>
<string>
9
52.43287.48740.12117
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
14
47323452.37
</float>
<float>
14
68942890.74
</float>
<string>
UTC
</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