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
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
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mikolaï Krol
erp5
Commits
4c324ae9
Commit
4c324ae9
authored
Feb 06, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] erp5_officejs: using editable form view in discussion tool
- this will replace the use of post view
parent
073b2729
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
19 deletions
+85
-19
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
...e_module/gadget_officejs_controller_page_controller_js.js
+83
-17
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
..._module/gadget_officejs_controller_page_controller_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
View file @
4c324ae9
...
...
@@ -11,6 +11,9 @@
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
submitContent
"
,
"
submitContent
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
@@ -52,7 +55,8 @@
},
action
:
"
Base_edit
"
,
update_action
:
""
,
_links
:
{}
_links
:
{
"
type
"
:
{
name
:
""
}
},
_actions
:
{
"
put
"
:
true
}
};
})
...
...
@@ -76,12 +80,28 @@
field_info
[
"
default
"
]
=
document
[
element_id
];
}
form_json
.
erp5_document
.
_embedded
.
_view
[
my_element
]
=
field_info
;
form_json
.
erp5_document
.
_links
=
form_definition
.
_links
;
}
}
//form_json.erp5_document._embedded._view._actions = form_definition._actions;
form_json
.
erp5_document
.
_links
=
form_definition
.
_links
;
return
this
.
getUrlFor
({
command
:
"
change
"
,
options
:
{
"
page
"
:
"
ojs_add_post
"
}})
.
push
(
function
(
url
)
{
form_json
.
erp5_document
.
_embedded
.
_view
.
_actions
=
{
"
put
"
:
{
"
href
"
:
url
}
};
return
form_json
;
});
})
/*.allowPublicAcquisition('submitContent', function (options) {
console.log("CONTROLLER ADQUISITION OF submitContent. options");
console.log(options);
//return this.submitContent(options);
return this.getUrlFor({command: "change", options: {"page": "ojs_add_post"}})
.push(function (url) {
console.log("url");
console.log(url);
});
})*/
.
allowPublicAcquisition
(
'
notifySubmit
'
,
function
()
{
return
this
.
triggerSubmit
();
})
...
...
@@ -105,7 +125,37 @@
});
})
.
declareMethod
(
"
renderSubGadget
"
,
function
(
gadget
,
subgadget
,
form_json
)
{
return
subgadget
.
render
({
jio_key
:
gadget
.
state
.
jio_key
,
doc
:
gadget
.
state
.
doc
,
erp5_document
:
form_json
.
erp5_document
,
form_definition
:
form_json
.
form_definition
,
editable
:
gadget
.
state
.
editable
,
view
:
gadget
.
state
.
view
,
form_json
:
form_json
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_next
'
})
]);
})
.
push
(
function
(
url_list
)
{
return
subgadget
.
updateHeader
({
page_title
:
gadget
.
state
.
doc
.
title
,
save_action
:
true
,
selection_url
:
url_list
[
0
],
previous_url
:
url_list
[
1
],
next_url
:
url_list
[
2
]
});
});
})
.
declareMethod
(
"
render
"
,
function
(
options
)
{
console
.
log
(
"
CONTROLLER. render method -options-
"
);
console
.
log
(
options
);
var
gadget
=
this
,
child_gadget_url
;
return
gadget
.
jio_get
(
options
.
jio_key
)
...
...
@@ -114,6 +164,10 @@
child_gadget_url
=
'
gadget_officejs_jio_
'
+
result
.
portal_type
.
replace
(
/ /g
,
'
_
'
).
toLowerCase
()
+
'
_view.html
'
;
// [HARDCODED] force to use form view editable
//child_gadget_url = 'gadget_erp5_pt_form_view_editable.html'
}
else
{
throw
new
Error
(
'
Can not display document:
'
+
options
.
jio_key
);
}
...
...
@@ -124,12 +178,34 @@
jio_key
:
options
.
jio_key
,
doc
:
result
,
child_gadget_url
:
child_gadget_url
,
form_definition
:
form_definition
form_definition
:
form_definition
,
editable
:
options
.
editable
,
view
:
options
.
view
});
});
});
})
.
onEvent
(
'
submit
'
,
function
()
{
console
.
log
(
"
CONTROLLER submit method
"
);
var
gadget
=
this
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
getContent
();
})
.
push
(
function
(
content
)
{
return
gadget
.
updateDocument
(
content
);
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
});
})
.
onStateChange
(
function
(
modification_dict
)
{
console
.
log
(
"
CONTROLLER. onStateChange method
"
);
var
fragment
=
document
.
createElement
(
'
div
'
),
gadget
=
this
;
return
gadget
.
generateJsonRenderForm
(
gadget
.
state
.
form_definition
,
gadget
.
state
.
doc
)
...
...
@@ -137,11 +213,7 @@
if
(
!
modification_dict
.
hasOwnProperty
(
'
child_gadget_url
'
))
{
return
gadget
.
getDeclaredGadget
(
'
fg
'
)
.
push
(
function
(
child_gadget
)
{
return
child_gadget
.
render
({
jio_key
:
gadget
.
state
.
jio_key
,
doc
:
gadget
.
state
.
doc
,
form_json
:
form_json
});
return
gadget
.
renderSubGadget
(
gadget
,
child_gadget
,
form_json
);
});
}
// Clear first to DOM, append after to reduce flickering/manip
...
...
@@ -149,15 +221,9 @@
gadget
.
element
.
removeChild
(
gadget
.
element
.
firstChild
);
}
gadget
.
element
.
appendChild
(
fragment
);
return
gadget
.
declareGadget
(
gadget
.
state
.
child_gadget_url
,
{
element
:
fragment
,
scope
:
'
fg
'
})
return
gadget
.
declareGadget
(
gadget
.
state
.
child_gadget_url
,
{
element
:
fragment
,
scope
:
'
fg
'
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
render
({
jio_key
:
gadget
.
state
.
jio_key
,
doc
:
gadget
.
state
.
doc
,
form_json
:
form_json
});
return
gadget
.
renderSubGadget
(
gadget
,
form_gadget
,
form_json
);
});
});
});
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
View file @
4c324ae9
...
...
@@ -227,7 +227,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
973.3
0677.12698.50312
</string>
</value>
<value>
<string>
973.3
2497.3392.28501
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -245,7 +245,7 @@
</tuple>
<state>
<tuple>
<float>
1549
379093.01
</float>
<float>
1549
487174.88
</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