Skip to content

Commit

Permalink
use htmlTitle
Browse files Browse the repository at this point in the history
  • Loading branch information
Swekka committed Sep 19, 2023
1 parent e041d9f commit f4f6cc9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
16 changes: 0 additions & 16 deletions resources/js/core-legacy/tooltip-default.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export default class TooltipDefault
$content =
if isTime
@timeagoTip el, title
else if (dateString = el.dataset.date)?
@tipWithDate el, title, dateString
else
htmlTitle ? $('<span>').text(title)

Expand Down Expand Up @@ -142,20 +140,6 @@ export default class TooltipDefault
.append $dateEl
.append ' '
.append $timeEl

tipWithDate: (el, title, dateString) =>
date = moment(dateString)

$titleEl = $('<div>')
.text title

$dateEl = $('<div>')
.addClass 'tooltip-default__date'
.text date.format('LL')

$('<div>')
.append $titleEl
.append $dateEl


tzString: (time) ->
Expand Down
9 changes: 7 additions & 2 deletions resources/js/profile-page/badges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import Img2x from 'components/img2x';
import UserBadgeJson from 'interfaces/user-badge-json';
import * as moment from 'moment';
import * as React from 'react';
import { Modifiers, classWithModifiers } from 'utils/css';
import { present } from 'utils/string';
Expand All @@ -21,12 +22,16 @@ export default class Badges extends React.PureComponent<Props> {
return (
<div className={classWithModifiers('profile-badges', this.props.modifiers)}>
{this.props.badges.map((badge) => {
const hasDate = present(badge.awarded_at);
const htmlTitle = hasDate ?`<div>${badge.description}</div>
<div class='tooltip-default__date'>${moment(badge.awarded_at).format('LL')}</div>` : null;

const img = (
<Img2x
className='profile-badges__badge'
data-date={badge.awarded_at}
data-html-title={htmlTitle}
src={badge.image_url}
title={badge.description}
title={hasDate ? '' : badge.description}
/>
);

Expand Down

0 comments on commit f4f6cc9

Please sign in to comment.