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
138
Merge Requests
138
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
ef50c183
Commit
ef50c183
authored
Apr 29, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_post: action gadgets handle submit
parent
0e88bea9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
71 deletions
+70
-71
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/gadget_field_new_action_js_script.js.js
...l_skins/erp5_post/gadget_field_new_action_js_script.js.js
+38
-45
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/gadget_field_reply_action_js_script.js.js
...skins/erp5_post/gadget_field_reply_action_js_script.js.js
+32
-26
No files found.
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/gadget_field_new_action_js_script.js.js
View file @
ef50c183
...
...
@@ -3,9 +3,6 @@
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
var
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
,
form_view_gadget_url
=
"
gadget_officejs_form_view.html
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
...
...
@@ -14,8 +11,6 @@
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
'
getUrlParameter
'
,
'
getUrlParameter
'
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
...
...
@@ -44,52 +39,50 @@
return
gadget
.
jio_post
(
doc
);
})
.
declareMethod
(
"
render
"
,
function
(
parent_gadget
)
{
.
declareMethod
(
"
render
"
,
function
(
parent_options
,
action_reference
,
form_definition
)
{
var
gadget
=
this
;
return
gadget
.
createDocument
(
parent_options
)
.
push
(
function
(
jio_key
)
{
return
gadget
.
jio_get
(
jio_key
)
.
push
(
function
(
new_document
)
{
return
gadget
.
changeState
({
jio_key
:
jio_key
,
doc
:
new_document
,
child_gadget_url
:
'
gadget_erp5_pt_form_view_editable.html
'
,
form_definition
:
form_definition
,
view
:
action_reference
,
editable
:
true
,
has_more_views
:
false
,
has_more_actions
:
true
,
is_form_list
:
false
});
});
});
})
.
onStateChange
(
function
()
{
var
gadget
=
this
;
return
gadget
.
declareGadget
(
form_view_gadget_url
)
return
gadget
.
declareGadget
(
"
gadget_officejs_form_view.html
"
)
.
push
(
function
(
form_view_gadget
)
{
return
form_view_gadget
.
renderGadget
(
parent_
gadget
);
return
form_view_gadget
.
renderGadget
(
gadget
);
});
})
.
declareMethod
(
"
handleRender
"
,
function
(
parent_gadget
,
options
,
action_reference
,
form_definition
)
{
var
this_gadget
=
this
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
parent_gadget
.
getUrlParameter
(
'
portal_type
'
),
parent_gadget
.
getUrlParameter
(
'
parent_relative_url
'
),
parent_gadget
.
getSetting
(
'
portal_type
'
),
parent_gadget
.
getSetting
(
'
parent_relative_url
'
)
]);
})
.
push
(
function
(
result
)
{
if
(
result
[
0
]
!==
undefined
)
{
options
.
portal_type
=
result
[
0
];
}
else
{
options
.
portal_type
=
result
[
2
];
}
if
(
result
[
1
]
!==
undefined
)
{
options
.
parent_relative_url
=
result
[
1
];
}
else
{
options
.
parent_relative_url
=
result
[
3
];
}
return
this_gadget
.
createDocument
(
options
)
.
push
(
function
(
jio_key
)
{
return
parent_gadget
.
jio_get
(
jio_key
)
.
push
(
function
(
new_document
)
{
return
parent_gadget
.
changeState
({
jio_key
:
jio_key
,
doc
:
new_document
,
child_gadget_url
:
child_gadget_url
,
form_definition
:
form_definition
,
view
:
action_reference
,
editable
:
true
,
has_more_views
:
false
,
has_more_actions
:
true
,
is_form_list
:
false
});
});
});
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
return
this
.
getDeclaredGadget
(
'
fg
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
triggerSubmit
();
});
})
.
declareMethod
(
"
handleSubmit
"
,
function
(
parent_gadget
,
jio_key
,
content_dict
)
{
return
parent_gadget
.
notifySubmitting
()
.
allowPublicAcquisition
(
'
submitContent
'
,
function
(
options
)
{
var
gadget
=
this
,
jio_key
=
options
[
0
],
//target_url = options[1],
content_dict
=
options
[
2
];
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
parent_
gadget
.
jio_get
(
jio_key
);
return
gadget
.
jio_get
(
jio_key
);
})
.
push
(
function
(
document
)
{
var
property
;
...
...
@@ -98,13 +91,13 @@
document
[
property
]
=
content_dict
[
property
];
}
}
return
parent_
gadget
.
jio_put
(
jio_key
,
document
);
return
gadget
.
jio_put
(
jio_key
,
document
);
})
.
push
(
function
()
{
return
parent_
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
return
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
})
.
push
(
function
()
{
return
parent_
gadget
.
redirect
({
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
jio_key
:
jio_key
,
...
...
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/gadget_field_reply_action_js_script.js.js
View file @
ef50c183
...
...
@@ -3,19 +3,13 @@
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
var
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
,
form_view_gadget_url
=
"
gadget_officejs_form_view.html
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
'
getUrlParameter
'
,
'
getUrlParameter
'
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
...
...
@@ -44,23 +38,16 @@
return
gadget
.
jio_post
(
doc
);
})
.
declareMethod
(
"
render
"
,
function
(
parent_gadget
)
{
.
declareMethod
(
"
render
"
,
function
(
options
,
action_reference
,
form_definition
)
{
var
gadget
=
this
;
return
gadget
.
declareGadget
(
form_view_gadget_url
)
.
push
(
function
(
form_view_gadget
)
{
return
form_view_gadget
.
renderGadget
(
parent_gadget
);
});
})
.
declareMethod
(
"
handleRender
"
,
function
(
parent_gadget
,
options
,
action_reference
,
form_definition
)
{
return
parent_gadget
.
jio_get
(
options
.
jio_key
)
return
gadget
.
jio_get
(
options
.
jio_key
)
.
push
(
function
(
parent_document
)
{
var
title
=
parent_document
.
title
;
if
(
!
title
.
startsWith
(
'
Re:
'
))
{
title
=
'
Re:
'
+
parent_document
.
title
;
}
return
parent_
gadget
.
changeState
({
return
gadget
.
changeState
({
doc
:
{
title
:
title
},
parent_document
:
parent_document
,
child_gadget_url
:
child_gadget_url
,
child_gadget_url
:
'
gadget_erp5_pt_form_view_editable.html
'
,
form_definition
:
form_definition
,
view
:
action_reference
,
editable
:
true
,
...
...
@@ -71,12 +58,31 @@
});
})
.
declareMethod
(
"
handleSubmit
"
,
function
(
parent_gadget
,
jio_key
,
content_dict
)
{
var
document
=
{
my_title
:
parent_gadget
.
state
.
doc
.
title
,
portal_type
:
parent_gadget
.
state
.
parent_document
.
portal_type
,
parent_relative_url
:
parent_gadget
.
state
.
parent_document
.
parent_relative_url
,
my_source_reference
:
parent_gadget
.
state
.
parent_document
.
source_reference
.
onStateChange
(
function
()
{
var
gadget
=
this
;
return
gadget
.
declareGadget
(
"
gadget_officejs_form_view.html
"
)
.
push
(
function
(
form_view_gadget
)
{
return
form_view_gadget
.
renderGadget
(
gadget
);
});
})
.
declareMethod
(
'
triggerSubmit
'
,
function
()
{
return
this
.
getDeclaredGadget
(
'
fg
'
)
.
push
(
function
(
gadget
)
{
return
gadget
.
triggerSubmit
();
});
})
.
allowPublicAcquisition
(
'
submitContent
'
,
function
(
options
)
{
var
gadget
=
this
,
jio_key
=
options
[
0
],
//target_url = options[1],
content_dict
=
options
[
2
],
document
=
{
my_title
:
gadget
.
state
.
doc
.
title
,
portal_type
:
gadget
.
state
.
parent_document
.
portal_type
,
parent_relative_url
:
gadget
.
state
.
parent_document
.
parent_relative_url
,
my_source_reference
:
gadget
.
state
.
parent_document
.
source_reference
},
property
;
for
(
property
in
content_dict
)
{
if
(
content_dict
.
hasOwnProperty
(
property
))
{
...
...
@@ -86,13 +92,13 @@
return
this
.
createDocument
(
document
)
.
push
(
function
(
id
)
{
jio_key
=
id
;
return
parent_
gadget
.
notifySubmitting
();
return
gadget
.
notifySubmitting
();
})
.
push
(
function
()
{
return
parent_
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
return
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
})
.
push
(
function
()
{
return
parent_
gadget
.
redirect
({
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
jio_key
:
jio_key
,
...
...
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