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
Sven Franck
erp5
Commits
c026778f
Commit
c026778f
authored
Aug 29, 2017
by
Tomáš Peterka
Committed by
Tomáš Peterka
Sep 01, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[renderjs_ui] LinesField implementation
parent
7bb9396b
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
763 additions
and
16 deletions
+763
-16
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_html.html
...Item/web_page_module/rjs_gadget_erp5_linesfield_html.html
+17
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_html.xml
...eItem/web_page_module/rjs_gadget_erp5_linesfield_html.xml
+324
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
...lateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
+86
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
...ateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
+320
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_textarea_js.js
...plateItem/web_page_module/rjs_gadget_html5_textarea_js.js
+14
-14
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_textarea_js.xml
...lateItem/web_page_module/rjs_gadget_html5_textarea_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_html.html
0 → 100644
View file @
c026778f
<!DOCTYPE html>
<html>
<head>
<meta
http-equiv=
"Content-type"
content=
"text/html; charset=utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
ERP5 Linesfield
</title>
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"gadget_erp5_field_lines.js"
type=
"text/javascript"
></script>
</head>
<body>
</body>
</html>
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_html.xml
0 → 100644
View file @
c026778f
This diff is collapsed.
Click to expand it.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.js
0 → 100644
View file @
c026778f
/*global window, rJS */
/*jslint indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
)
{
"
use strict
"
;
function
listToNewlines
(
list
)
{
if
(
list
.
constructor
===
Array
)
{
return
list
.
join
(
"
\n
"
);
}
return
list
;
}
function
listToBR
(
list
)
{
if
(
list
.
constructor
===
Array
)
{
return
list
.
join
(
"
<br/>
\n
"
);
}
return
list
;
}
rJS
(
window
)
.
declareMethod
(
'
render
'
,
function
(
options
)
{
return
this
.
changeState
(
options
.
field_json
);
})
.
onStateChange
(
function
(
modification_dict
)
{
var
gadget
=
this
,
url
,
value
;
if
(
modification_dict
.
hasOwnProperty
(
'
editable
'
))
{
if
(
gadget
.
state
.
editable
)
{
url
=
'
gadget_html5_textarea.html
'
;
value
=
listToNewlines
(
gadget
.
state
.
value
||
gadget
.
state
.
default
||
[]);
}
else
{
url
=
'
gadget_html5_element.html
'
;
value
=
listToBR
(
gadget
.
state
.
value
||
gadget
.
state
.
default
||
[]);
}
return
this
.
declareGadget
(
url
,
{
scope
:
'
sub
'
})
.
push
(
function
(
sub_gadget
)
{
// Clear first to DOM, append after to reduce flickering/manip
while
(
gadget
.
element
.
firstChild
)
{
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
}
gadget
.
element
.
appendChild
(
sub_gadget
.
element
);
// Use full-blown render when the widget is new
return
sub_gadget
.
render
({
value
:
value
,
name
:
gadget
.
state
.
key
,
editable
:
gadget
.
state
.
editable
,
required
:
gadget
.
state
.
required
,
title
:
gadget
.
state
.
title
,
hidden
:
gadget
.
state
.
hidden
});
});
}
return
gadget
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
input
)
{
if
(
modification_dict
.
hasOwnProperty
(
"
value
"
))
{
if
(
gadget
.
state
.
editable
)
{
modification_dict
.
value
=
listToNewlines
(
modification_dict
.
value
);
}
else
{
modification_dict
.
value
=
listToBR
(
modification_dict
.
value
);
}
}
// when we only receive changes we can simply pass (minimaly modified) modification dictionary
input
.
render
(
modification_dict
);
});
})
.
declareMethod
(
'
getContent
'
,
function
()
{
var
gadget
=
this
;
return
gadget
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
sub_gadget
)
{
return
sub_gadget
.
getContent
();
});
})
.
declareMethod
(
'
checkValidity
'
,
function
()
{
if
(
this
.
state
.
editable
)
{
return
this
.
getDeclaredGadget
(
'
sub
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
checkValidity
();
});
}
return
true
;
});
}(
window
,
rJS
));
\ No newline at end of file
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_linesfield_js.xml
0 → 100644
View file @
c026778f
This diff is collapsed.
Click to expand it.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_textarea_js.js
View file @
c026778f
...
...
@@ -21,24 +21,24 @@
})
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
state_dict
=
{
value
:
options
.
value
,
editable
:
options
.
editable
,
name
:
options
.
name
,
title
:
options
.
title
,
hidden
:
options
.
hidden
};
return
this
.
changeState
(
state_dict
);
return
this
.
changeState
(
options
);
})
.
onStateChange
(
function
()
{
.
onStateChange
(
function
(
modification_dict
)
{
var
textarea
=
this
.
element
.
querySelector
(
'
textarea
'
);
// textarea.setAttribute('value', this.state.value);
textarea
.
value
=
this
.
state
.
value
;
textarea
.
setAttribute
(
'
name
'
,
this
.
state
.
name
);
textarea
.
setAttribute
(
'
id
'
,
this
.
state
.
name
);
textarea
.
setAttribute
(
'
title
'
,
this
.
state
.
title
);
if
(
modification_dict
.
hasOwnProperty
(
"
value
"
))
{
textarea
.
value
=
modification_dict
.
value
;
}
if
(
modification_dict
.
hasOwnProperty
(
"
name
"
))
{
textarea
.
setAttribute
(
'
name
'
,
modification_dict
.
name
);
textarea
.
setAttribute
(
'
id
'
,
modification_dict
.
name
);
}
if
(
modification_dict
.
hasOwnProperty
(
"
title
"
))
{
textarea
.
setAttribute
(
'
title
'
,
modification_dict
.
title
);
}
if
(
this
.
state
.
required
)
{
textarea
.
setAttribute
(
'
required
'
,
'
required
'
);
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_html5_textarea_js.xml
View file @
c026778f
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
56.58742.58866.48708
</string>
</value>
<value>
<string>
9
61.46307.16912.53794
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1
490622800.75
</float>
<float>
1
503932678.28
</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