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
1
Issues
1
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
Roque
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 @@
...
@@ -8,12 +8,7 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
...
@@ -22,7 +17,7 @@
...
@@ -22,7 +17,7 @@
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
var
gadget
=
this
,
var
gadget
=
this
,
doc
=
{
doc
=
{
title
:
"
Untitled
Documen
t
"
,
title
:
"
Untitled
Pos
t
"
,
portal_type
:
options
.
portal_type
,
portal_type
:
options
.
portal_type
,
parent_relative_url
:
options
.
parent_relative_url
parent_relative_url
:
options
.
parent_relative_url
},
},
...
@@ -39,45 +34,15 @@
...
@@ -39,45 +34,15 @@
return
gadget
.
jio_post
(
doc
);
return
gadget
.
jio_post
(
doc
);
})
})
.
declareMethod
(
"
render
"
,
function
(
parent_options
,
action_reference
,
form_definition
)
{
.
declareMethod
(
"
preRenderDocument
"
,
function
(
parent_options
)
{
var
gadget
=
this
;
return
{
title
:
"
Untitled Post
"
};
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
});
})
})
.
onStateChange
(
function
()
{
.
declareMethod
(
'
handleSubmit
'
,
function
(
content_dict
,
parent_options
)
{
var
gadget
=
this
;
var
document
=
{
return
gadget
.
declareGadget
(
"
gadget_officejs_form_view.html
"
)
my_title
:
parent_options
.
doc
.
title
,
.
push
(
function
(
form_view_gadget
)
{
portal_type
:
parent_options
.
parent_options
.
portal_type
,
return
form_view_gadget
.
renderGadget
(
gadget
);
parent_relative_url
:
parent_options
.
parent_options
.
parent_relative_url
});
})
.
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
},
property
;
},
property
;
delete
content_dict
.
dialog_method
;
delete
content_dict
.
dialog_method
;
for
(
property
in
content_dict
)
{
for
(
property
in
content_dict
)
{
...
@@ -85,23 +50,8 @@
...
@@ -85,23 +50,8 @@
document
[
'
my_
'
+
property
]
=
content_dict
[
property
];
document
[
'
my_
'
+
property
]
=
content_dict
[
property
];
}
}
}
}
return
this
.
createDocument
(
document
)
document
.
my_source_reference
=
parent_options
.
parent_options
.
my_source_reference
;
.
push
(
function
(
id
)
{
return
this
.
createDocument
(
document
);
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
}
});
});
});
});
}(
window
,
rJS
,
RSVP
));
}(
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 @@
...
@@ -10,9 +10,6 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
...
@@ -21,7 +18,7 @@
...
@@ -21,7 +18,7 @@
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
var
gadget
=
this
,
var
gadget
=
this
,
doc
=
{
doc
=
{
title
:
"
Untitled
Documen
t
"
,
title
:
"
Untitled
Pos
t
"
,
portal_type
:
options
.
portal_type
,
portal_type
:
options
.
portal_type
,
parent_relative_url
:
options
.
parent_relative_url
parent_relative_url
:
options
.
parent_relative_url
},
},
...
@@ -38,74 +35,31 @@
...
@@ -38,74 +35,31 @@
return
gadget
.
jio_post
(
doc
);
return
gadget
.
jio_post
(
doc
);
})
})
.
declareMethod
(
"
render
"
,
function
(
options
,
action_reference
,
form_definition
)
{
.
declareMethod
(
"
preRenderDocument
"
,
function
(
parent_options
)
{
var
gadget
=
this
;
var
gadget
=
this
;
return
gadget
.
jio_get
(
options
.
jio_key
)
return
gadget
.
jio_get
(
parent_
options
.
jio_key
)
.
push
(
function
(
parent_document
)
{
.
push
(
function
(
parent_document
)
{
var
title
=
parent_document
.
title
;
var
title
=
parent_document
.
title
;
if
(
!
title
.
startsWith
(
'
Re:
'
))
{
title
=
'
Re:
'
+
parent_document
.
title
;
}
if
(
!
title
.
startsWith
(
'
Re:
'
))
{
title
=
'
Re:
'
+
parent_document
.
title
;
}
return
gadget
.
changeState
({
return
{
title
:
title
,
doc
:
{
title
:
title
},
source_reference
:
parent_document
.
source_reference
};
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
});
});
});
})
})
.
onStateChange
(
function
()
{
.
declareMethod
(
'
handleSubmit
'
,
function
(
content_dict
,
parent_options
)
{
var
gadget
=
this
;
var
document
=
{
return
gadget
.
declareGadget
(
"
gadget_officejs_form_view.html
"
)
my_title
:
parent_options
.
doc
.
title
,
.
push
(
function
(
form_view_gadget
)
{
portal_type
:
parent_options
.
parent_options
.
portal_type
,
return
form_view_gadget
.
renderGadget
(
gadget
);
parent_relative_url
:
parent_options
.
parent_options
.
parent_relative_url
});
})
.
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
;
},
property
;
delete
content_dict
.
dialog_method
;
for
(
property
in
content_dict
)
{
for
(
property
in
content_dict
)
{
if
(
content_dict
.
hasOwnProperty
(
property
))
{
if
(
content_dict
.
hasOwnProperty
(
property
))
{
document
[
'
my_
'
+
property
]
=
content_dict
[
property
];
document
[
'
my_
'
+
property
]
=
content_dict
[
property
];
}
}
}
}
return
this
.
createDocument
(
document
)
document
.
my_source_reference
=
parent_options
.
doc
.
source_reference
;
.
push
(
function
(
id
)
{
return
this
.
createDocument
(
document
);
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
}
});
});
});
});
}(
window
,
rJS
,
RSVP
));
}(
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