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
f2155f45
Commit
f2155f45
authored
Apr 30, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_post: simplifying action gadget fields
parent
7f22d255
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
119 deletions
+23
-119
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
+10
-60
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
+13
-59
No files found.
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/gadget_field_new_action_js_script.js.js
View file @
f2155f45
...
...
@@ -8,12 +8,7 @@
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
@@ -22,7 +17,7 @@
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
var
gadget
=
this
,
doc
=
{
title
:
"
Untitled
Documen
t
"
,
title
:
"
Untitled
Pos
t
"
,
portal_type
:
options
.
portal_type
,
parent_relative_url
:
options
.
parent_relative_url
},
...
...
@@ -39,45 +34,15 @@
return
gadget
.
jio_post
(
doc
);
})
.
declareMethod
(
"
render
"
,
function
(
parent_options
,
action_reference
,
form_definition
)
{
var
gadget
=
this
;
return
gadget
.
changeState
({
doc
:
{
title
:
"
Untitled Document
"
},
parent_options
:
parent_options
,
child_gadget_url
:
'
gadget_erp5_pt_form_dialog.html
'
,
form_type
:
'
dialog
'
,
form_definition
:
form_definition
,
view
:
action_reference
,
editable
:
true
,
has_more_views
:
false
,
has_more_actions
:
true
});
.
declareMethod
(
"
preRenderDocument
"
,
function
(
parent_options
)
{
return
{
title
:
"
Untitled Post
"
};
})
.
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
=
{
portal_type
:
gadget
.
state
.
parent_options
.
portal_type
,
parent_relative_url
:
gadget
.
state
.
parent_options
.
parent_relative_url
,
my_source_reference
:
gadget
.
state
.
parent_options
.
my_source_reference
.
declareMethod
(
'
handleSubmit
'
,
function
(
content_dict
,
parent_options
)
{
var
document
=
{
my_title
:
parent_options
.
doc
.
title
,
portal_type
:
parent_options
.
parent_options
.
portal_type
,
parent_relative_url
:
parent_options
.
parent_options
.
parent_relative_url
},
property
;
delete
content_dict
.
dialog_method
;
for
(
property
in
content_dict
)
{
...
...
@@ -85,23 +50,8 @@
document
[
'
my_
'
+
property
]
=
content_dict
[
property
];
}
}
return
this
.
createDocument
(
document
)
.
push
(
function
(
id
)
{
jio_key
=
id
;
return
gadget
.
notifySubmitting
();
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
})
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
jio_key
:
jio_key
,
editable
:
true
}
});
});
document
.
my_source_reference
=
parent_options
.
parent_options
.
my_source_reference
;
return
this
.
createDocument
(
document
);
});
}(
window
,
rJS
,
RSVP
));
\ No newline at end of file
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/gadget_field_reply_action_js_script.js.js
View file @
f2155f45
...
...
@@ -10,9 +10,6 @@
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
@@ -21,7 +18,7 @@
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
var
gadget
=
this
,
doc
=
{
title
:
"
Untitled
Documen
t
"
,
title
:
"
Untitled
Pos
t
"
,
portal_type
:
options
.
portal_type
,
parent_relative_url
:
options
.
parent_relative_url
},
...
...
@@ -38,74 +35,31 @@
return
gadget
.
jio_post
(
doc
);
})
.
declareMethod
(
"
render
"
,
function
(
options
,
action_reference
,
form_definition
)
{
.
declareMethod
(
"
preRenderDocument
"
,
function
(
parent_options
)
{
var
gadget
=
this
;
return
gadget
.
jio_get
(
options
.
jio_key
)
return
gadget
.
jio_get
(
parent_
options
.
jio_key
)
.
push
(
function
(
parent_document
)
{
var
title
=
parent_document
.
title
;
if
(
!
title
.
startsWith
(
'
Re:
'
))
{
title
=
'
Re:
'
+
parent_document
.
title
;
}
return
gadget
.
changeState
({
doc
:
{
title
:
title
},
parent_document
:
parent_document
,
child_gadget_url
:
'
gadget_erp5_pt_form_dialog.html
'
,
form_type
:
'
dialog
'
,
form_definition
:
form_definition
,
view
:
action_reference
,
editable
:
true
,
has_more_views
:
false
,
has_more_actions
:
false
});
return
{
title
:
title
,
source_reference
:
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
.
declareMethod
(
'
handleSubmit
'
,
function
(
content_dict
,
parent_options
)
{
var
document
=
{
my_title
:
parent_options
.
doc
.
title
,
portal_type
:
parent_options
.
parent_options
.
portal_type
,
parent_relative_url
:
parent_options
.
parent_options
.
parent_relative_url
},
property
;
delete
content_dict
.
dialog_method
;
for
(
property
in
content_dict
)
{
if
(
content_dict
.
hasOwnProperty
(
property
))
{
document
[
'
my_
'
+
property
]
=
content_dict
[
property
];
}
}
return
this
.
createDocument
(
document
)
.
push
(
function
(
id
)
{
jio_key
=
id
;
return
gadget
.
notifySubmitting
();
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
({
message
:
'
Data Updated
'
,
status
:
'
success
'
});
})
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
jio_key
:
jio_key
,
editable
:
true
}
});
});
document
.
my_source_reference
=
parent_options
.
doc
.
source_reference
;
return
this
.
createDocument
(
document
);
});
}(
window
,
rJS
,
RSVP
));
\ No newline at end of file
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