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
Tomáš Peterka
erp5
Commits
80002630
Commit
80002630
authored
Nov 27, 2017
by
Tomáš Peterka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WWIP
parent
f4e03d67
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
54 deletions
+104
-54
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.html
...ateItem/web_page_module/rjs_gadget_erp5_listbox_html.html
+42
-8
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.xml
...lateItem/web_page_module/rjs_gadget_erp5_listbox_html.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
...emplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
+58
-42
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
...mplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.html
View file @
80002630
...
...
@@ -45,14 +45,14 @@
<script
id=
"listbox-hidden-tbody-template"
type=
"text/x-handlebars-template"
>
<
table
>
<
tbody
class
=
"
tbody
"
>
{{
#
each
body_value
}}
{{
#
each
row_list
}}
<
tr
>
{{
#
if
..
/
show_anchor
}}
<
th
>
<
a
class
=
"
ui-link ui-btn ui-corner-all ui-icon-carat-r ui-btn-icon-notext
"
href
=
"
{{jump}}
"
><
/a
>
<
/th
>
{{
/
if
}}
{{
#
each
tr_value
}}
{{
#
each
cell_list
}}
<
td
>
{{
#
if
type
}}
{{
#
if
editable
}}
...
...
@@ -82,7 +82,7 @@
<script
id=
"listbox-show-tbody-template"
type=
"text/x-handlebars-template"
>
<
table
>
<
tbody
class
=
"
tbody
"
>
{{
#
each
body_value
}}
{{
#
each
row_list
}}
<
tr
>
{{
#
if
..
/
show_anchor
}}
<
th
>
...
...
@@ -92,7 +92,7 @@
<
td
>
<
input
value
=
"
{{value}}
"
type
=
"
checkbox
"
checked
=
"
true
"
class
=
"
hide_element
"
>
<
/td
>
{{
#
each
tr_value
}}
{{
#
each
cell_list
}}
<
td
>
{{
#
if
type
}}
{{
#
if
editable
}}
...
...
@@ -118,7 +118,42 @@
<
/table
>
</script>
<script
id=
"listbox-tfoot-template"
type=
"text/x-handlebars-template"
>
<script
id=
"listbox-tfoot-sum-template"
type=
"text/x-handlebars-template"
>
<
table
>
<
tfoot
class
=
"
ui-bar-inherit tfoot summary
"
>
{{
#
each
row_list
}}
<
tr
>
{{
#
each
cell_list
}}
<
td
>
{{
#
if
type
}}
{{
#
if
editable
}}
<
div
class
=
"
editable_div
"
data
-
column
=
"
{{column}}
"
data
-
line
=
"
{{line}}
"
><
/div
>
{{
else
}}
<
a
href
=
"
{{href}}
"
class
=
"
ui-link
"
>
<
div
class
=
"
editable_div
"
data
-
column
=
"
{{column}}
"
data
-
line
=
"
{{line}}
"
><
/div
>
<
/a
>
{{
/
if
}}
{{
else
}}
<
a
href
=
"
{{href}}
"
class
=
"
ui-link
"
>
{{
text
}}
<
/a
>
{{
/
if
}}
<
/td
>
{{
/
each
}}
<
/tr
>
{{
/
each
}}
<
th
colspan
=
"
{{colspan}}
"
>
<
div
class
=
"
ui-controlgroup ui-controlgroup-horizontal ui-corner-all ui-paging-menu
"
>
<
div
class
=
"
ui-controlgroup-controls
"
>
<
a
class
=
"
{{previous_classname}}
"
data
-
i18n
=
"
Previous
"
href
=
"
{{previous_url}}
"
>
Previous
<
/a
>
<
a
class
=
"
{{next_classname}}
"
data
-
i18n
=
"
Next
"
href
=
"
{{next_url}}
"
>
Next
<
/a
>
<
span
class
=
"
ui-btn ui-disabled
"
data
-
i18n
=
"
{{record}}
"
>
{{
record
}}
<
/span
>
<
/div
>
<
/div
>
<
/th
>
<
/tfoot
>
<
/table
>
</script>
<script
id=
"listbox-tfoot-count-template"
type=
"text/x-handlebars-template"
>
<
table
>
<
tfoot
class
=
"
ui-bar-inherit tfoot
"
>
<
th
colspan
=
"
{{colspan}}
"
>
...
...
@@ -155,9 +190,8 @@
<
/table
>
<
/div
>
</script>
<script
id=
"error-message-template"
type=
"text/x-handlebars-template"
>
<
div
class
=
"
ui-listbox-error
"
>
<
a
class
=
"
ui-btn ui-corner-all ui-btn-inline
"
href
=
"
{{reset_url}}
"
>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_html.xml
View file @
80002630
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
2.24395.32903.29832
</string>
</value>
<value>
<string>
96
3.47536.5989.57173
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
15
06526285.9
</float>
<float>
15
11764805.38
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.js
View file @
80002630
...
...
@@ -19,10 +19,15 @@
.
innerHTML
,
listbox_show_tbody_template
=
Handlebars
.
compile
(
listbox_show_tbody_source
),
listbox_tfoot_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
listbox-tfoot-template
"
)
listbox_tfoot_s
um_s
ource
=
gadget_klass
.
__template_element
.
getElementById
(
"
listbox-tfoot-
sum-
template
"
)
.
innerHTML
,
listbox_tfoot_template
=
Handlebars
.
compile
(
listbox_tfoot_source
),
listbox_tfoot_sum_template
=
Handlebars
.
compile
(
listbox_tfoot_sum_source
),
listbox_tfoot_count_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
listbox-tfoot-count-template
"
)
.
innerHTML
,
listbox_tfoot_count_template
=
Handlebars
.
compile
(
listbox_tfoot_count_source
),
listbox_source
=
gadget_klass
.
__template_element
.
getElementById
(
"
listbox-template
"
)
...
...
@@ -49,14 +54,15 @@
gadget
.
props
.
listbox_uid_dict
=
{};
gadget
.
props
.
cell_gadget_list
=
[];
function
renderSubCell
(
element
,
sub_field_json
)
{
sub_field_json
.
editable
=
sub_field_json
.
editable
&&
gadget
.
state
.
editable
;
// XXX
sub_field_json
.
editable
=
sub_field_json
.
editable
&&
gadget
.
state
.
editable
;
// XXX
return
gadget
.
declareGadget
(
'
gadget_erp5_label_field.html
'
,
{
element
:
element
,
scope
:
sub_field_json
.
key
})
.
push
(
function
(
cell_gadget
)
{
gadget
.
props
.
cell_gadget_list
.
push
(
cell_gadget
);
return
cell_gadget
.
render
({
field_type
:
sub_field_json
.
type
,
field_json
:
sub_field_json
,
label
:
false
});
label
:
false
});
});
}
for
(
i
=
0
;
i
<
element_list
.
length
;
i
+=
1
)
{
...
...
@@ -79,41 +85,47 @@
return
RSVP
.
all
(
promise_list
);
}
/**Put resulting `row_list` into `template` together with necessary gadget.state parameters.
function
renderListboxTbody
(
gadget
,
template
,
body_value
)
{
var
tmp
,
First, it removes all similar containers from within the table! Currently it is tricky
to have multiple tbody/thead/tfoot elements! Feel free to refactor.
Example call: renderListboxTbody(gadget, compiled_template, row_list, "tbody");
**/
function
renderListboxTbody
(
gadget
,
template
,
row_list
,
container_name
)
{
var
container
,
column_list
=
JSON
.
parse
(
gadget
.
state
.
column_list_json
);
return
gadget
.
translateHtml
(
template
(
{
"
body_value
"
:
body_value
,
"
row_list
"
:
row_list
,
"
show_anchor
"
:
gadget
.
state
.
show_anchor
,
"
column_list
"
:
column_list
}
))
.
push
(
function
(
my_html
)
{
tmp
=
document
.
createElement
(
"
tbody
"
);
tmp
.
innerHTML
=
my_html
;
return
renderEditableField
(
gadget
,
tmp
,
column_list
);
container
=
document
.
createElement
(
container_name
);
container
.
innerHTML
=
my_html
;
return
renderEditableField
(
gadget
,
container
,
column_list
);
})
.
push
(
function
()
{
var
table
=
gadget
.
element
.
querySelector
(
"
table
"
),
tbody
=
table
.
querySelector
(
"
tbody
"
);
table
.
removeChild
(
tbody
);
table
.
appendChild
(
tmp
);
old_container
=
table
.
querySelector
(
container_name
);
table
.
removeChild
(
old_container
);
table
.
appendChild
(
container
);
});
}
function
renderListboxTfoot
(
gadget
,
foot
)
{
return
gadget
.
translateHtml
(
listbox_tfoot_template
(
function
renderListboxTfoot
(
gadget
,
foot
_count
,
foot_sum
)
{
return
gadget
.
translateHtml
(
listbox_tfoot_
count_
template
(
{
"
colspan
"
:
foot
.
colspan
,
"
previous_classname
"
:
foot
.
previous_classname
,
"
previous_url
"
:
foot
.
previous_url
,
"
record
"
:
foot
.
record
,
"
next_classname
"
:
foot
.
next_classname
,
"
next_url
"
:
foot
.
next_url
"
colspan
"
:
foot
_count
.
colspan
,
"
previous_classname
"
:
foot
_count
.
previous_classname
,
"
previous_url
"
:
foot
_count
.
previous_url
,
"
record
"
:
foot
_count
.
record
,
"
next_classname
"
:
foot
_count
.
next_classname
,
"
next_url
"
:
foot
_count
.
next_url
}
));
}
...
...
@@ -455,18 +467,18 @@
})
.
push
(
function
(
result_list
)
{
var
value
,
body_value
=
[]
,
tr_value
=
[]
,
var
row_list
=
[]
,
value
,
cell_list
,
tmp_url
,
listbox_tbody_template
;
for
(
i
=
0
;
i
<
counter
;
i
+=
1
)
{
tmp_url
=
result_list
[
i
];
tr_value
=
[];
cell_list
=
[];
for
(
j
=
0
;
j
<
column_list
.
length
;
j
+=
1
)
{
value
=
allDocs_result
.
data
.
rows
[
i
].
value
[
column_list
[
j
][
0
]]
||
""
;
tr_value
.
push
({
cell_list
.
push
({
"
type
"
:
value
.
type
,
"
editable
"
:
value
.
editable
&&
gadget
.
state
.
editable
,
"
href
"
:
tmp_url
,
...
...
@@ -475,10 +487,10 @@
"
column
"
:
j
});
}
body_value
.
push
({
row_list
.
push
({
"
value
"
:
allDocs_result
.
data
.
rows
[
i
].
value
.
uid
,
"
jump
"
:
tmp_url
,
"
tr_value
"
:
tr_value
,
"
cell_list
"
:
cell_list
,
"
line_icon
"
:
gadget
.
state
.
line_icon
});
}
...
...
@@ -489,7 +501,7 @@
listbox_tbody_template
=
listbox_hidden_tbody_template
;
}
return
renderListboxTbody
(
gadget
,
listbox_tbody_template
,
body_value
);
return
renderListboxTbody
(
gadget
,
listbox_tbody_template
,
row_list
,
"
tbody
"
);
})
.
push
(
function
()
{
var
prev_param
=
{},
...
...
@@ -513,28 +525,32 @@
})
.
push
(
function
(
url_list
)
{
var
foot
=
{};
foot
.
colspan
=
column_list
.
length
+
gadget
.
state
.
show_anchor
+
var
tfoot_count
=
{
"
previous_url
"
:
url_list
[
0
],
"
next_url
"
:
url_list
[
1
],
"
previous_classname
"
:
"
ui-btn ui-icon-carat-l ui-btn-icon-left responsive ui-first-child
"
,
"
next_classname
"
:
"
ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child
"
},
tfoot_sum
=
{};
tfoot_count
.
colspan
=
column_list
.
length
+
gadget
.
state
.
show_anchor
+
(
gadget
.
state
.
line_icon
?
1
:
0
);
foot
.
previous_classname
=
"
ui-btn ui-icon-carat-l ui-btn-icon-left responsive ui-first-child
"
;
foot
.
previous_url
=
url_list
[
0
];
foot
.
next_classname
=
"
ui-btn ui-icon-carat-r ui-btn-icon-right responsive ui-last-child
"
;
foot
.
next_url
=
url_list
[
1
];
if
((
gadget
.
state
.
begin_from
===
0
)
&&
(
counter
===
0
))
{
foo
t
.
record
=
variable
.
translated_no_record
;
tfoot_coun
t
.
record
=
variable
.
translated_no_record
;
}
else
if
((
allDocs_result
.
data
.
rows
.
length
<=
lines
)
&&
(
gadget
.
state
.
begin_from
===
0
))
{
foo
t
.
record
=
counter
+
"
"
+
variable
.
translated_records
;
tfoot_coun
t
.
record
=
counter
+
"
"
+
variable
.
translated_records
;
}
else
{
foo
t
.
record
=
variable
.
translated_records
+
"
"
+
(((
gadget
.
state
.
begin_from
+
lines
)
/
lines
-
1
)
*
lines
+
1
)
+
"
-
"
+
(((
gadget
.
state
.
begin_from
+
lines
)
/
lines
-
1
)
*
lines
+
counter
);
tfoot_coun
t
.
record
=
variable
.
translated_records
+
"
"
+
(((
gadget
.
state
.
begin_from
+
lines
)
/
lines
-
1
)
*
lines
+
1
)
+
"
-
"
+
(((
gadget
.
state
.
begin_from
+
lines
)
/
lines
-
1
)
*
lines
+
counter
);
}
if
(
gadget
.
state
.
begin_from
===
0
)
{
foo
t
.
previous_classname
+=
"
ui-disabled
"
;
tfoot_coun
t
.
previous_classname
+=
"
ui-disabled
"
;
}
if
(
allDocs_result
.
data
.
rows
.
length
<=
lines
)
{
foo
t
.
next_classname
+=
"
ui-disabled
"
;
tfoot_coun
t
.
next_classname
+=
"
ui-disabled
"
;
}
return
renderListboxTfoot
(
gadget
,
foot
);
return
renderListboxTfoot
(
gadget
,
tfoot_count
,
tfoot_sum
);
})
.
push
(
function
(
my_html
)
{
gadget
.
element
.
querySelector
(
"
.tfoot
"
).
innerHTML
=
my_html
;
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_listbox_js.xml
View file @
80002630
...
...
@@ -236,7 +236,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
1.56527.16709.20804
</string>
</value>
<value>
<string>
96
3.47634.31999.4898
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -254,7 +254,7 @@
</tuple>
<state>
<tuple>
<float>
15
06527031.12
</float>
<float>
15
11765129.91
</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