Commit 06f64a9b authored by Romain Courteaud's avatar Romain Courteaud 🐙

WIP [erp5_web_renderjs_ui] Copy/Paste

parent f77434df
...@@ -71,6 +71,17 @@ ...@@ -71,6 +71,17 @@
view, view,
i; i;
if (action_name === 'copy_document_list') {
console.log('Copying', checked_uid_list);
return gadget.setSetting('clipboard', checked_uid_list)
.push(function () {
return gadget.notifySubmitted({
"message": "Copied.",
"status": "success"
});
});
}
for (i = 0; i < action_list.length; i += 1) { for (i = 0; i < action_list.length; i += 1) {
if (action_name === action_list[i].name) { if (action_name === action_list[i].name) {
view = action_list[i].href; view = action_list[i].href;
...@@ -94,6 +105,33 @@ ...@@ -94,6 +105,33 @@
command: 'reload' command: 'reload'
}); });
} }
if (action_name === 'paste_document_list') {
return gadget.getSetting('clipboard')
.push(function (uid_list) {
uid_list = uid_list || [];
if (uid_list.length === 0) {
// Nothing to paste, go away
uid_list = ['XXX'];
}
extended_search = updateSearchQueryFromSelection(
'',
uid_list,
'catalog.uid',
true
);
console.log('Pasting', uid_list);
return gadget.redirect({
command: 'display_dialog_with_history',
options: {
"jio_key": gadget.state.jio_key,
"view": view,
"extended_search": extended_search
}
}, true);
});
}
return gadget.redirect({ return gadget.redirect({
command: 'display_dialog_with_history', command: 'display_dialog_with_history',
options: { options: {
...@@ -108,12 +146,15 @@ ...@@ -108,12 +146,15 @@
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Acquired methods // Acquired methods
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("updateHeader", "updateHeader") .declareAcquiredMethod("updateHeader", "updateHeader")
.declareAcquiredMethod("getUrlForList", "getUrlForList") .declareAcquiredMethod("getUrlForList", "getUrlForList")
.declareAcquiredMethod("redirect", "redirect") .declareAcquiredMethod("redirect", "redirect")
.declareAcquiredMethod("getUrlParameter", "getUrlParameter") .declareAcquiredMethod("getUrlParameter", "getUrlParameter")
.declareAcquiredMethod("renderEditorPanel", "renderEditorPanel") .declareAcquiredMethod("renderEditorPanel", "renderEditorPanel")
.declareAcquiredMethod("getTranslationList", "getTranslationList") .declareAcquiredMethod("getTranslationList", "getTranslationList")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
///////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////
// Proxy methods to the child gadget // Proxy methods to the child gadget
...@@ -320,6 +361,9 @@ ...@@ -320,6 +361,9 @@
if (action_list[i].name === 'delete_document_list') { if (action_list[i].name === 'delete_document_list') {
continue; continue;
} }
if (action_list[i].name === 'paste_document_list') {
continue;
}
if (action_list[i].name === 'mass_workflow_jio') { if (action_list[i].name === 'mass_workflow_jio') {
icon = 'random'; icon = 'random';
} else { } else {
...@@ -365,7 +409,8 @@ ...@@ -365,7 +409,8 @@
}, true); }, true);
} }
if (action !== 'delete_document_list') { if ((action !== 'delete_document_list') &&
(action !== 'paste_document_list')) {
return triggerListboxClipboardAction.apply(this, [argument_list]); return triggerListboxClipboardAction.apply(this, [argument_list]);
} }
...@@ -378,9 +423,16 @@ ...@@ -378,9 +423,16 @@
i, i,
result_list = [], result_list = [],
icon; icon;
result_list.push({
title: 'Copy',
icon: 'copy',
action: 'copy_document_list'
});
for (i = 0; i < action_list.length; i += 1) { for (i = 0; i < action_list.length; i += 1) {
if (action_list[i].name === 'delete_document_list') { if (action_list[i].name === 'delete_document_list') {
icon = 'trash-o'; icon = 'trash-o';
} else if (action_list[i].name === 'paste_document_list') {
icon = 'paste';
} else { } else {
continue; continue;
} }
......
...@@ -228,7 +228,7 @@ ...@@ -228,7 +228,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>973.131.13855.5137</string> </value> <value> <string>974.42547.505.51302</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -246,7 +246,7 @@ ...@@ -246,7 +246,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1547545219.53</float> <float>1553763421.11</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment