datetimeShort ref

This commit is contained in:
Yuri Kuznetsov
2024-10-07 11:36:28 +03:00
parent 4ff67f11ed
commit 2c4d853a5b
10 changed files with 69 additions and 31 deletions
@@ -2,5 +2,5 @@
{"name": "personStringData", "width":18, "notSortable": true, "noLabel": true},
{"name": "subject", "link": true, "notSortable": true},
{"name": "parent", "notSortable": true, "width": 21},
{"name": "dateSent", "view": "views/fields/datetime-short", "notSortable": true, "width": 10, "align": "right"}
{"name": "dateSent", "notSortable": true, "width": 10, "align": "right"}
]
@@ -1,5 +1,5 @@
[
{"name":"personStringData", "width":20, "notSortable": true, "customLabel": ""},
{"name":"subject", "link":true, "notSortable": true},
{"name":"dateSent", "view": "views/fields/datetime-short", "notSortable": true, "width": 16, "align": "right"}
{"name":"personStringData", "width":20, "notSortable": true, "noLabel": true},
{"name":"subject", "link": true, "notSortable": true},
{"name":"dateSent", "notSortable": true, "width": 16, "align": "right"}
]
@@ -404,7 +404,8 @@
"type": "datetime",
"customizationDisabled": true,
"layoutDefaultSidePanelDisabled": true,
"massUpdateDisabled": true
"massUpdateDisabled": true,
"view": "views/email/fields/date-sent"
},
"deliveryDate": {
"type": "datetime",
@@ -1,5 +1,6 @@
{{#if dateValue ~}}
<span
{{#if titleDateValue}}title="{{titleDateValue}}"{{/if}}
{{#if style}}class="text-{{style}}"{{/if}}
>{{dateValue}}</span>
{{~/if}}
+1 -1
View File
@@ -1,6 +1,6 @@
{{#if dateValue~}}
<span
title="{{dateValue}}"
{{#if titleDateValue}}title="{{titleDateValue}}"{{/if}}
{{#if style}}class="text-{{style}}"{{/if}}
>{{dateValue}}</span>
{{~/if}}
@@ -1,14 +0,0 @@
{{#if dateValue ~}}
<span
title="{{fullDateValue}}"
{{#if style}}class="text-{{style}}"{{/if}}
>{{dateValue}}</span>
{{~/if}}
{{#if isNone}}
<span class="none-value">{{translate 'None'}}</span>
{{/if}}
{{#if isLoading}}
<span class="loading-value"></span>
{{/if}}
@@ -1,6 +0,0 @@
{{#if dateValue~}}
<span
title="{{fullDateValue}}"
{{#if style}}class="text-{{style}}"{{/if}}
>{{dateValue}}</span>
{{~/if}}
@@ -0,0 +1,34 @@
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
import DatetimeShortFieldView from 'views/fields/datetime-short';
export default class extends DatetimeShortFieldView {
shortInDetailMode = false
}
+4
View File
@@ -165,6 +165,10 @@ class DateFieldView extends BaseFieldView {
}
}
if (this.isListMode()) {
data.titleDateValue = data.dateValue;
}
// noinspection JSValidateTypes
return data;
}
+23 -5
View File
@@ -33,21 +33,39 @@ import moment from 'moment';
class DatetimeShortFieldView extends DatetimeFieldView {
listTemplate = 'fields/datetime-short/list'
detailTemplate = 'fields/datetime-short/detail'
/**
* @protected
* @type {boolean}
*/
shortInListMode = true
/**
* @protected
* @type {boolean}
*/
shortInDetailMode = true
data() {
const data = super.data();
if (this.mode === this.MODE_LIST || this.mode === this.MODE_DETAIL) {
data.fullDateValue = super.getDateStringValue();
if (this.toApplyShort()) {
data.titleDateValue = super.getDateStringValue();
}
return data;
}
/**
* @private
* @return {boolean}
*/
toApplyShort() {
return this.shortInListMode && this.mode === this.MODE_LIST ||
this.shortInDetailMode && this.mode === this.MODE_DETAIL;
}
getDateStringValue() {
if (!(this.mode === this.MODE_LIST || this.mode === this.MODE_DETAIL)) {
if (!this.toApplyShort()) {
return super.getDateStringValue();
}