Max - Modifies frontend to make sure date is displayed correctly at each place and adds at when showing hours and minutes [skip ci]

This commit is contained in:
Max Red 2016-12-13 16:33:58 -03:00
parent be3cdf25f9
commit 02e799cc9f
5 changed files with 19 additions and 17 deletions

View File

@ -2,6 +2,8 @@ import React from 'react';
import classNames from 'classnames';
import i18n from 'lib-app/i18n';
import DateTransformer from 'lib-core/date-transformer';
import Icon from 'core-components/icon';
class TicketEvent extends React.Component {
@ -22,7 +24,6 @@ class TicketEvent extends React.Component {
render() {
let iconNode = null;
if (this.props.type === 'COMMENT' && this.props.author && this.props.author.staff) {
iconNode = this.renderStaffPic();
} else {
@ -80,7 +81,7 @@ class TicketEvent extends React.Component {
<span className="ticket-event__comment-author-name">{this.props.author.name}</span>
<span className="ticket-event__comment-author-type">({i18n((this.props.author.staff) ? 'STAFF' : 'CUSTOMER')})</span>
</div>
<div className="ticket-event__comment-date">{this.props.date}</div>
<div className="ticket-event__comment-date">{DateTransformer.transformToString(this.props.date, true)}</div>
<div className="ticket-event__comment-content" dangerouslySetInnerHTML={{__html: this.props.content}}></div>
{this.renderFileRow(this.props.file)}
</div>
@ -92,7 +93,7 @@ class TicketEvent extends React.Component {
<div className="ticket-event__circled">
<span className="ticket-event__circled-author">{this.props.author.name}</span>
<span className="ticket-event__circled-text"> assigned this ticket</span>
<span className="ticket-event__circled-date"> on {this.props.date}</span>
<span className="ticket-event__circled-date"> on {DateTransformer.transformToString(this.props.date, true)}</span>
</div>
)
}
@ -102,7 +103,7 @@ class TicketEvent extends React.Component {
<div className="ticket-event__circled">
<span className="ticket-event__circled-author">{this.props.author.name}</span>
<span className="ticket-event__circled-text"> unassigned this ticket</span>
<span className="ticket-event__circled-date"> on {this.props.date}</span>
<span className="ticket-event__circled-date"> on {DateTransformer.transformToString(this.props.date, true)}</span>
</div>
)
}
@ -112,7 +113,7 @@ class TicketEvent extends React.Component {
<div className="ticket-event__circled">
<span className="ticket-event__circled-author">{this.props.author.name}</span>
<span className="ticket-event__circled-text"> closed this ticket</span>
<span className="ticket-event__circled-date"> on {this.props.date}</span>
<span className="ticket-event__circled-date"> on {DateTransformer.transformToString(this.props.date, true)}</span>
</div>
)
}
@ -122,7 +123,7 @@ class TicketEvent extends React.Component {
<div className="ticket-event__circled">
<span className="ticket-event__circled-author">{this.props.author.name}</span>
<span className="ticket-event__circled-text"> reopen this ticket</span>
<span className="ticket-event__circled-date"> on {this.props.date}</span>
<span className="ticket-event__circled-date"> on {DateTransformer.transformToString(this.props.date, true)}</span>
</div>
);
}
@ -133,7 +134,7 @@ class TicketEvent extends React.Component {
<span className="ticket-event__circled-author">{this.props.author.name}</span>
<span className="ticket-event__circled-text"> change department to</span>
<span className="ticket-event__circled-indication"> {this.props.content}</span>
<span className="ticket-event__circled-date"> on {this.props.date}</span>
<span className="ticket-event__circled-date"> on {DateTransformer.transformToString(this.props.date, true)}</span>
</div>
);
}
@ -144,7 +145,7 @@ class TicketEvent extends React.Component {
<span className="ticket-event__circled-author">{this.props.author.name}</span>
<span className="ticket-event__circled-text"> change priority to</span>
<span className="ticket-event__circled-indication"> {this.props.content}</span>
<span className="ticket-event__circled-date"> on {this.props.date}</span>
<span className="ticket-event__circled-date"> on {DateTransformer.transformToString(this.props.date, true)}</span>
</div>
);
}
@ -225,4 +226,4 @@ class TicketEvent extends React.Component {
}
}
export default TicketEvent;
export default TicketEvent;

View File

@ -177,7 +177,7 @@ class TicketList extends React.Component {
priority: this.getTicketPriority(ticket.priority),
department: ticket.department.name,
author: ticket.author.name,
date: DateTransformer.transformToString(ticket.date, true),
date: DateTransformer.transformToString(ticket.date, false),
unread: this.isTicketUnread(ticket),
highlighted: this.isTicketUnread(ticket)
};

View File

@ -8,6 +8,7 @@ import SessionStore from 'lib-app/session-store';
import TicketEvent from 'app-components/ticket-event';
import AreYouSure from 'app-components/are-you-sure';
import DateTransformer from 'lib-core/date-transformer';
import Form from 'core-components/form';
import FormField from 'core-components/form-field';
import SubmitButton from 'core-components/submit-button';
@ -88,7 +89,7 @@ class TicketViewer extends React.Component {
onChange={this.onDepartmentDropdownChanged.bind(this)} />
</div>
<div className="col-md-4">{ticket.author.name}</div>
<div className="col-md-4">{ticket.date}</div>
<div className="col-md-4">{DateTransformer.transformToString(ticket.date, true)}</div>
</div>
<div className="ticket-viewer__info-row-header row">
<div className="col-md-4">{i18n('PRIORITY')}</div>
@ -132,7 +133,7 @@ class TicketViewer extends React.Component {
<div className="ticket-viewer__info-row-values row">
<div className="ticket-viewer__department col-md-4">{ticket.department.name}</div>
<div className="ticket-viewer__author col-md-4">{ticket.author.name}</div>
<div className="ticket-viewer__date col-md-4">{ticket.date}</div>
<div className="ticket-viewer__date col-md-4">{DateTransformer.transformToString(ticket.date, false)}</div>
</div>
<div className="ticket-viewer__info-row-header row">
<div className="ticket-viewer__department col-md-4">{i18n('PRIORITY')}</div>
@ -317,7 +318,7 @@ class TicketViewer extends React.Component {
this.setState({
loading: false
});
this.onTicketModification();
}
@ -326,7 +327,7 @@ class TicketViewer extends React.Component {
loading: false
});
}
onTicketModification() {
if (this.props.onChange) {
this.props.onChange();
@ -334,4 +335,4 @@ class TicketViewer extends React.Component {
}
}
export default TicketViewer;
export default TicketViewer;

View File

@ -96,7 +96,7 @@ class AdminPanelListUsers extends React.Component {
{user.tickets}
</span>
),
signupDate: DateTransformer.transformToString(user.signupDate, true)
signupDate: DateTransformer.transformToString(user.signupDate, false)
};
}

View File

@ -14,6 +14,6 @@ export default {
let hr = date.substring(8, 10);
let min = date.substring(10, 12);
return d + " " + month[m] + " " + y + " " + hr + ":" + min;
return d + " " + month[m] + " " + y + " at " + hr + ":" + min;
}
};