mirror of https://github.com/OCA/web.git
commit
82dd49b9a0
|
@ -5,6 +5,35 @@
|
||||||
width: auto;
|
width: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vis-current-time {
|
||||||
|
background-color: #FF7F6E;
|
||||||
|
width: 2px;
|
||||||
|
z-index: 1;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-rolling-mode-btn {
|
||||||
|
height: 40px;
|
||||||
|
width: 40px;
|
||||||
|
position: absolute;
|
||||||
|
top: 7px;
|
||||||
|
right: 20px;
|
||||||
|
border-radius: 50%;
|
||||||
|
font-size: 28px;
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.8;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
background: #3876c2;
|
||||||
|
}
|
||||||
|
.vis-rolling-mode-btn:before {
|
||||||
|
content: "\26F6";
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-rolling-mode-btn:hover {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
.vis-timeline {
|
.vis-timeline {
|
||||||
/*
|
/*
|
||||||
-webkit-transition: height .4s ease-in-out;
|
-webkit-transition: height .4s ease-in-out;
|
||||||
|
@ -38,52 +67,6 @@
|
||||||
transition: height .4s ease-in-out, top .4s ease-in-out;
|
transition: height .4s ease-in-out, top .4s ease-in-out;
|
||||||
}
|
}
|
||||||
/**/
|
/**/
|
||||||
.vis-current-time {
|
|
||||||
background-color: #FF7F6E;
|
|
||||||
width: 2px;
|
|
||||||
z-index: 1;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-rolling-mode-btn {
|
|
||||||
height: 40px;
|
|
||||||
width: 40px;
|
|
||||||
position: absolute;
|
|
||||||
top: 7px;
|
|
||||||
right: 20px;
|
|
||||||
border-radius: 50%;
|
|
||||||
font-size: 28px;
|
|
||||||
cursor: pointer;
|
|
||||||
opacity: 0.8;
|
|
||||||
color: white;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
background: #3876c2;
|
|
||||||
}
|
|
||||||
.vis-rolling-mode-btn:before {
|
|
||||||
content: "\26F6";
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-rolling-mode-btn:hover {
|
|
||||||
opacity: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-timeline {
|
|
||||||
position: relative;
|
|
||||||
border: 1px solid #bfbfbf;
|
|
||||||
overflow: hidden;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-loading-screen {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
}
|
|
||||||
.vis-panel {
|
.vis-panel {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
||||||
|
@ -272,6 +255,23 @@
|
||||||
stroke: none;
|
stroke: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.vis-timeline {
|
||||||
|
position: relative;
|
||||||
|
border: 1px solid #bfbfbf;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-loading-screen {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
.vis-custom-time {
|
.vis-custom-time {
|
||||||
background-color: #6E94FF;
|
background-color: #6E94FF;
|
||||||
width: 2px;
|
width: 2px;
|
||||||
|
@ -393,6 +393,50 @@
|
||||||
display: inline-block
|
display: inline-block
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vis-labelset {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-labelset .vis-label {
|
||||||
|
position: relative;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
color: #4d4d4d;
|
||||||
|
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-labelset .vis-label {
|
||||||
|
border-bottom: 1px solid #bfbfbf;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-labelset .vis-label.draggable {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-group-is-dragging {
|
||||||
|
background: rgba(0, 0, 0, .1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-labelset .vis-label:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-labelset .vis-label .vis-inner {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.vis-labelset .vis-label .vis-inner.vis-hidden {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.vis-itemset {
|
.vis-itemset {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -571,50 +615,6 @@
|
||||||
height: 100%;
|
height: 100%;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vis-labelset {
|
|
||||||
position: relative;
|
|
||||||
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-labelset .vis-label {
|
|
||||||
position: relative;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
width: 100%;
|
|
||||||
color: #4d4d4d;
|
|
||||||
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-labelset .vis-label {
|
|
||||||
border-bottom: 1px solid #bfbfbf;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-labelset .vis-label.draggable {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-group-is-dragging {
|
|
||||||
background: rgba(0, 0, 0, .1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-labelset .vis-label:last-child {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-labelset .vis-label .vis-inner {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-labelset .vis-label .vis-inner.vis-hidden {
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.vis-time-axis {
|
.vis-time-axis {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -66,6 +66,7 @@ odoo.define("web_timeline.TimelineController", function (require) {
|
||||||
kwargs: {
|
kwargs: {
|
||||||
fields: fields,
|
fields: fields,
|
||||||
domain: domains,
|
domain: domains,
|
||||||
|
order: [{name: this.renderer.arch.attrs.default_group_by}],
|
||||||
},
|
},
|
||||||
context: this.getSession().user_context,
|
context: this.getSession().user_context,
|
||||||
}).then((data) =>
|
}).then((data) =>
|
||||||
|
|
|
@ -11,6 +11,7 @@ odoo.define("web_timeline.TimelineModel", function (require) {
|
||||||
load: function (params) {
|
load: function (params) {
|
||||||
this.modelName = params.modelName;
|
this.modelName = params.modelName;
|
||||||
this.fieldNames = params.fieldNames;
|
this.fieldNames = params.fieldNames;
|
||||||
|
this.default_group_by = params.default_group_by;
|
||||||
if (!this.preload_def) {
|
if (!this.preload_def) {
|
||||||
this.preload_def = $.Deferred();
|
this.preload_def = $.Deferred();
|
||||||
$.when(
|
$.when(
|
||||||
|
@ -55,9 +56,12 @@ odoo.define("web_timeline.TimelineModel", function (require) {
|
||||||
return this._rpc({
|
return this._rpc({
|
||||||
model: this.modelName,
|
model: this.modelName,
|
||||||
method: "search_read",
|
method: "search_read",
|
||||||
context: this.data.context,
|
kwargs: {
|
||||||
fields: this.fieldNames,
|
fields: this.fieldNames,
|
||||||
domain: this.data.domain,
|
domain: this.data.domain,
|
||||||
|
order: [{name: this.default_group_by}],
|
||||||
|
context: this.data.context,
|
||||||
|
},
|
||||||
}).then((events) => {
|
}).then((events) => {
|
||||||
this.data.data = events;
|
this.data.data = events;
|
||||||
this.data.rights = {
|
this.data.rights = {
|
||||||
|
|
|
@ -35,6 +35,7 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||||
this.date_delay = params.date_delay;
|
this.date_delay = params.date_delay;
|
||||||
this.colors = params.colors;
|
this.colors = params.colors;
|
||||||
this.fieldNames = params.fieldNames;
|
this.fieldNames = params.fieldNames;
|
||||||
|
this.default_group_by = params.default_group_by;
|
||||||
this.dependency_arrow = params.dependency_arrow;
|
this.dependency_arrow = params.dependency_arrow;
|
||||||
this.modelClass = params.view.model;
|
this.modelClass = params.view.model;
|
||||||
this.fields = params.fields;
|
this.fields = params.fields;
|
||||||
|
@ -376,7 +377,8 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
const groups = [];
|
const groups = [];
|
||||||
groups.push({id: -1, content: _t("<b>UNASSIGNED</b>")});
|
groups.push({id: -1, content: _t("<b>UNASSIGNED</b>"), order: -1});
|
||||||
|
var seq = 1;
|
||||||
for (const evt of events) {
|
for (const evt of events) {
|
||||||
const group_name = evt[_.first(group_bys)];
|
const group_name = evt[_.first(group_bys)];
|
||||||
if (group_name) {
|
if (group_name) {
|
||||||
|
@ -389,7 +391,9 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||||
groups.push({
|
groups.push({
|
||||||
id: group_name[0],
|
id: group_name[0],
|
||||||
content: group_name[1],
|
content: group_name[1],
|
||||||
|
order: seq,
|
||||||
});
|
});
|
||||||
|
seq += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,6 +474,7 @@ odoo.define("web_timeline.TimelineRenderer", function (require) {
|
||||||
start: date_start,
|
start: date_start,
|
||||||
content: content,
|
content: content,
|
||||||
id: evt.id,
|
id: evt.id,
|
||||||
|
order: evt.order,
|
||||||
group: group,
|
group: group,
|
||||||
evt: evt,
|
evt: evt,
|
||||||
style: `background-color: ${this.color};`,
|
style: `background-color: ${this.color};`,
|
||||||
|
|
|
@ -72,8 +72,10 @@ odoo.define("web_timeline.TimelineView", function (require) {
|
||||||
|
|
||||||
const colors = this.parse_colors();
|
const colors = this.parse_colors();
|
||||||
for (const color of colors) {
|
for (const color of colors) {
|
||||||
|
if (!fieldNames.includes(color.field)) {
|
||||||
fieldNames.push(color.field);
|
fieldNames.push(color.field);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (dependency_arrow) {
|
if (dependency_arrow) {
|
||||||
fieldNames.push(dependency_arrow);
|
fieldNames.push(dependency_arrow);
|
||||||
|
@ -106,11 +108,13 @@ odoo.define("web_timeline.TimelineView", function (require) {
|
||||||
this.rendererParams.date_delay = date_delay;
|
this.rendererParams.date_delay = date_delay;
|
||||||
this.rendererParams.colors = colors;
|
this.rendererParams.colors = colors;
|
||||||
this.rendererParams.fieldNames = fieldNames;
|
this.rendererParams.fieldNames = fieldNames;
|
||||||
|
this.rendererParams.default_group_by = attrs.default_group_by;
|
||||||
this.rendererParams.min_height = min_height;
|
this.rendererParams.min_height = min_height;
|
||||||
this.rendererParams.dependency_arrow = dependency_arrow;
|
this.rendererParams.dependency_arrow = dependency_arrow;
|
||||||
this.rendererParams.fields = fields;
|
this.rendererParams.fields = fields;
|
||||||
this.loadParams.modelName = this.modelName;
|
this.loadParams.modelName = this.modelName;
|
||||||
this.loadParams.fieldNames = fieldNames;
|
this.loadParams.fieldNames = fieldNames;
|
||||||
|
this.loadParams.default_group_by = attrs.default_group_by;
|
||||||
this.controllerParams.open_popup_action = open_popup_action;
|
this.controllerParams.open_popup_action = open_popup_action;
|
||||||
this.controllerParams.date_start = date_start;
|
this.controllerParams.date_start = date_start;
|
||||||
this.controllerParams.date_stop = date_stop;
|
this.controllerParams.date_stop = date_stop;
|
||||||
|
@ -121,7 +125,7 @@ odoo.define("web_timeline.TimelineView", function (require) {
|
||||||
|
|
||||||
_preapre_vis_timeline_options: function (attrs) {
|
_preapre_vis_timeline_options: function (attrs) {
|
||||||
return {
|
return {
|
||||||
groupOrder: this.group_order,
|
groupOrder: "order",
|
||||||
orientation: "both",
|
orientation: "both",
|
||||||
selectable: true,
|
selectable: true,
|
||||||
multiselect: true,
|
multiselect: true,
|
||||||
|
@ -134,24 +138,6 @@ odoo.define("web_timeline.TimelineView", function (require) {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Order function for groups.
|
|
||||||
* @param {Object} grp1
|
|
||||||
* @param {Object} grp2
|
|
||||||
* @returns {Integer}
|
|
||||||
*/
|
|
||||||
group_order: function (grp1, grp2) {
|
|
||||||
// Display non grouped elements first
|
|
||||||
if (grp1.id === -1) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (grp2.id === -1) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return grp1.content.localeCompare(grp2.content);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse the colors attribute.
|
* Parse the colors attribute.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue