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
Amer
erp5
Commits
ca411361
Commit
ca411361
authored
Apr 24, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_post: refactoring on action gadgets
parent
194ce8e4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
32 deletions
+43
-32
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
+18
-15
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
+25
-17
No files found.
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/gadget_field_new_action_js_script.js.js
View file @
ca411361
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
(
function
(
window
,
rJS
,
RSVP
)
{
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
"
use strict
"
;
var
gadget_utils
;
var
parent_gadget
,
form_view_gadget
;
rJS
(
window
)
rJS
(
window
)
...
@@ -22,29 +22,32 @@
...
@@ -22,29 +22,32 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
handleRender
"
,
function
(
gadget
,
gadget_utils
,
options
,
action_reference
,
parent_portal_type
,
form_definition
)
{
.
declareMethod
(
"
render
"
,
function
(
gadget
)
{
var
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
return
form_view_gadget
.
renderGadget
(
gadget
);
})
.
declareMethod
(
"
handleRender
"
,
function
(
gadget
,
options
,
action_reference
,
form_definition
)
{
var
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
,
this_gadget
=
this
;
parent_gadget
=
gadget
;
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
getUrlParameter
(
'
portal_type
'
),
parent_gadget
.
getUrlParameter
(
'
portal_type
'
),
gadget
.
getUrlParameter
(
'
parent_relative_url
'
),
parent_gadget
.
getUrlParameter
(
'
parent_relative_url
'
),
gadget
.
getSetting
(
'
portal_type
'
),
parent_gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
)
parent_gadget
.
getSetting
(
'
parent_relative_url
'
),
parent_gadget
.
declareGadget
(
"
gadget_officejs_form_view.html
"
)
]);
]);
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
if
(
result
[
0
]
!==
undefined
)
{
options
.
portal_type
=
result
[
0
];
}
else
{
options
.
portal_type
=
result
[
2
];
}
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
];
}
if
(
result
[
1
]
!==
undefined
)
{
options
.
parent_relative_url
=
result
[
1
];
}
else
{
options
.
parent_relative_url
=
result
[
3
];
}
return
gadget_utils
.
getFormDefinition
(
parent_portal_type
,
action_reference
)
form_view_gadget
=
result
[
4
];
.
push
(
function
(
result
)
{
return
form_view_gadget
.
createDocument
(
options
)
form_definition
=
result
;
return
gadget_utils
.
createDocument
(
options
);
})
.
push
(
function
(
jio_key
)
{
.
push
(
function
(
jio_key
)
{
return
gadget
.
jio_get
(
jio_key
)
return
parent_
gadget
.
jio_get
(
jio_key
)
.
push
(
function
(
new_document
)
{
.
push
(
function
(
new_document
)
{
return
gadget
.
changeState
({
return
parent_
gadget
.
changeState
({
jio_key
:
jio_key
,
jio_key
:
jio_key
,
doc
:
new_document
,
doc
:
new_document
,
child_gadget_url
:
child_gadget_url
,
child_gadget_url
:
child_gadget_url
,
...
@@ -60,7 +63,7 @@
...
@@ -60,7 +63,7 @@
});
});
})
})
.
declareMethod
(
"
handleSubmit
"
,
function
(
gadget
,
gadget_utils
,
jio_key
,
content_dict
)
{
.
declareMethod
(
"
handleSubmit
"
,
function
(
gadget
,
jio_key
,
content_dict
)
{
return
gadget
.
notifySubmitting
()
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
jio_get
(
jio_key
);
return
gadget
.
jio_get
(
jio_key
);
...
...
bt5/erp5_post/SkinTemplateItem/portal_skins/erp5_post/gadget_field_reply_action_js_script.js.js
View file @
ca411361
...
@@ -22,27 +22,35 @@
...
@@ -22,27 +22,35 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
handleRender
"
,
function
(
gadget
,
gadget_utils
,
options
,
action_reference
,
parent_portal_type
,
form_definition
)
{
.
declareMethod
(
"
render
"
,
function
(
gadget
)
{
var
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
return
gadget_utils
.
renderGadget
(
gadget
);
return
gadget
.
jio_get
(
options
.
jio_key
)
})
.
push
(
function
(
parent_document
)
{
var
title
=
parent_document
.
title
;
.
declareMethod
(
"
handleRender
"
,
function
(
gadget
,
options
,
action_reference
,
form_definition
)
{
if
(
!
title
.
startsWith
(
'
Re:
'
))
{
title
=
'
Re:
'
+
parent_document
.
title
;
}
return
gadget
.
declareGadget
(
"
gadget_officejs_form_view.html
"
)
return
gadget
.
changeState
({
.
push
(
function
(
declared_gadget
)
{
doc
:
{
title
:
title
},
gadget_utils
=
declared_gadget
;
parent_document
:
parent_document
,
var
child_gadget_url
=
'
gadget_erp5_pt_form_view_editable.html
'
;
child_gadget_url
:
child_gadget_url
,
return
gadget
.
jio_get
(
options
.
jio_key
)
form_definition
:
form_definition
,
.
push
(
function
(
parent_document
)
{
view
:
action_reference
,
var
title
=
parent_document
.
title
;
editable
:
true
,
if
(
!
title
.
startsWith
(
'
Re:
'
))
{
title
=
'
Re:
'
+
parent_document
.
title
;
}
has_more_views
:
false
,
return
gadget
.
changeState
({
has_more_actions
:
false
,
doc
:
{
title
:
title
},
is_form_list
:
false
parent_document
:
parent_document
,
child_gadget_url
:
child_gadget_url
,
form_definition
:
form_definition
,
view
:
action_reference
,
editable
:
true
,
has_more_views
:
false
,
has_more_actions
:
false
,
is_form_list
:
false
});
});
});
});
});
})
})
.
declareMethod
(
"
handleSubmit
"
,
function
(
gadget
,
gadget_utils
,
jio_key
,
content_dict
)
{
.
declareMethod
(
"
handleSubmit
"
,
function
(
gadget
,
jio_key
,
content_dict
)
{
var
document
=
{
var
document
=
{
my_title
:
gadget
.
state
.
doc
.
title
,
my_title
:
gadget
.
state
.
doc
.
title
,
portal_type
:
gadget
.
state
.
parent_document
.
portal_type
,
portal_type
:
gadget
.
state
.
parent_document
.
portal_type
,
...
...
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