Commit 4dfa28e0 by Roque

erp5_web_project_ui: button links based on project tabs (views)

1 parent 5f0c72f5
......@@ -18,10 +18,10 @@
.declareMethod("render", function (options) {
var gadget = this;
return gadget.redirect({
'command': 'display',
'command': 'display_with_history',
'options': {
'page': 'form',
'editable': 1,
'editable': 0,
'jio_key': 'project_module',
'view': 'view',
'field_listbox_sort_list:json': [["title", "ascending"]],
......
......@@ -234,7 +234,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>979.3070.57073.63914</string> </value>
<value> <string>979.12948.23547.4915</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>1570796095.48</float>
<float>1571395014.27</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -7,7 +7,7 @@ if url_dict:
'command': 'display',
'options': {
'jio_key': jio_key,
'editable': False
'editable': True
},
'view_kw': {
'view': 'Project_viewQuickOverview',
......
/*jslint nomen: true, indent: 2 */
/*global window, rJS, RSVP, document, FileReader, Blob, jIO, //Handlebars,
/*global window, rJS, RSVP, document, FileReader, Blob, jIO, ensureArray, //Handlebars,
lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
(function (window, rJS, RSVP, document, FileReader, Blob, jIO, //Handlebars,
(function (window, rJS, RSVP, document, FileReader, Blob, jIO, ensureArray, //Handlebars,
lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue) {
"use strict";
......@@ -18,7 +18,6 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
}
function generateLink(gadget, link_element, command, options) {
//return gadget.getUrlFor({command: 'display', options: {page: "validator_form"}})
return gadget.getUrlFor({command: command, options: options})
/*.push(function (result) {
return gadget.translateHtml(
......@@ -51,10 +50,9 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
rJS(window)
.declareAcquiredMethod("getUrlFor", "getUrlFor")
.declareAcquiredMethod("jio_getAttachment", "jio_getAttachment")
.declareMethod('render', function (options) {
console.log("PROJECT INFO GADGET render options:");
console.log(options);
var state_dict = {
jio_key: options.jio_key || "",
//HACK
......@@ -70,58 +68,69 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
base_site = window.location.origin + window.location.pathname,
project_url = base_site + modification_dict.jio_key;
gadget.element.querySelectorAll("h1")[0].innerHTML = modification_dict.project_title;
return gadget.jio_getAttachment(modification_dict.jio_key, "links")
.push(function (erp5_document) {
var view_list = ensureArray(erp5_document._links.view), i,
task_view = view_list.filter(d => d.name === "task_list")[0].href,
bug_view = view_list.filter(d => d.name === "bug_list")[0].href,
milestone_view = view_list.filter(d => d.name === "milestone")[0].href,
task_report_view = view_list.filter(d => d.name === "task_report_list")[0].href;
gadget.element.querySelectorAll("h1")[0].innerHTML = modification_dict.project_title;
enableLink(document.getElementById("forum_link"), modification_dict.forum_link);
enableLink(document.getElementById("description_link"), modification_dict.description_link);
generateLink(gadget, document.getElementById("bug_link"), 'display_with_history', {
'jio_key': 'bug_module',
'page': 'form',
'view': bug_view,
'field_listbox_sort_list:json': [["start_date", "descending"]],
'field_listbox_column_list:json': ["title", "description", "start_date"],
//TODO: this should use a domain tree
'extended_search': 'translated_simulation_state_title: "Open"'
});
generateInfo(gadget, document.getElementById("bug_count"), project_url + "/Project_bugs");
generateInfo(gadget, document.getElementById("closed_bug_count"), project_url + "/Project_bugs?closed=1");
generateLink(gadget, document.getElementById("task_link"), 'display_with_history', {
'jio_key': 'task_module',
'page': 'form',
'view': task_view,
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]],
//TODO: this should use a domain tree
'extended_search': 'translated_simulation_state_title: "Open"'
});
generateInfo(gadget, document.getElementById("task_count"), project_url + "/Project_tasks");
generateInfo(gadget, document.getElementById("unassigned_task_count"), project_url + "/Project_tasksToAssigne");
generateLink(gadget, document.getElementById("report_link"), 'display_with_history', {
'jio_key': 'task_report_module',
'page': 'form',
'view': task_report_view,
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]]
//TODO: this should use a domain tree
//'extended_search': 'translated_simulation_state_title: "Open"'
});
generateInfo(gadget, document.getElementById("report_count"), project_url + "/Project_taskReports");
generateInfo(gadget, document.getElementById("closed_report_count"), project_url + "/Project_taskReports?closed=1");
generateLink(gadget, document.getElementById("test_result_link"), 'display_with_history', {
'jio_key': 'test_result_module',
'page': 'form',
'view': 'view',
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]]
});
generateInfo(gadget, document.getElementById("last_test_result"), project_url + "/Project_lastTestResult");
generateLink(gadget, document.getElementById("test_suite_link"), 'display_with_history', {
'jio_key': 'test_suite_module',
'page': 'form',
'view': 'view',
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]]
});
enableLink(document.getElementById("forum_link"), modification_dict.forum_link);
enableLink(document.getElementById("description_link"), modification_dict.description_link);
generateLink(gadget, document.getElementById("bug_link"), 'display', {
'jio_key': 'bug_module',
'page': 'form',
'view': 'view',
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]],
//'field_listbox_column_list:json': ["title", "default_destination_section_title"],
'extended_search': 'translated_simulation_state_title: "Open"'
});
generateInfo(gadget, document.getElementById("bug_count"), project_url + "/Project_bugs");
generateInfo(gadget, document.getElementById("closed_bug_count"), project_url + "/Project_bugs?closed=1");
generateLink(gadget, document.getElementById("task_link"), 'display', {
'jio_key': 'task_module',
'page': 'form',
'view': 'view',
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]]//,
//'field_listbox_column_list:json': ["title", "default_destination_section_title"],
//'extended_search': 'translated_simulation_state_title: "Open"'
});
generateInfo(gadget, document.getElementById("task_count"), project_url + "/Project_tasks");
generateInfo(gadget, document.getElementById("unassigned_task_count"), project_url + "/Project_tasksToAssigne");
generateLink(gadget, document.getElementById("report_link"), 'display', {
'jio_key': 'task_report_module',
'page': 'form',
'view': 'view',
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]]//,
//'field_listbox_column_list:json': ["title", "default_destination_section_title"],
//'extended_search': 'translated_simulation_state_title: "Open"'
});
generateInfo(gadget, document.getElementById("report_count"), project_url + "/Project_taskReports");
generateInfo(gadget, document.getElementById("closed_report_count"), project_url + "/Project_taskReports?closed=1");
generateLink(gadget, document.getElementById("test_result_link"), 'display', {
'jio_key': 'test_result_module',
'page': 'form',
'view': 'view',
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]]
});
generateInfo(gadget, document.getElementById("last_test_result"), project_url + "/Project_lastTestResult");
generateLink(gadget, document.getElementById("test_suite_link"), 'display', {
'jio_key': 'test_suite_module',
'page': 'form',
'view': 'view',
'field_listbox_sort_list:json': [["delivery.start_date", "descending"]]
});
});
})
.declareMethod('getContent', function () {
......@@ -132,5 +141,5 @@ lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue*/
return true;
});
}(window, rJS, RSVP, document, FileReader, Blob, jIO, //Handlebars,
}(window, rJS, RSVP, document, FileReader, Blob, jIO, ensureArray, //Handlebars,
lockGadgetInQueue, unlockGadgetInQueue, unlockGadgetInFailedQueue));
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!