Skip to content

Commit

Permalink
Use Markdown for talk status (#4711)
Browse files Browse the repository at this point in the history
Replace HTML with Markdown in talk status template strings on the project home page. Any markup in project titles, or the number of active users, is now rendered as plain strings rather than parsed as HTML.
  • Loading branch information
eatyourgreens committed Jun 21, 2018
1 parent e56c441 commit 807d2dd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
6 changes: 3 additions & 3 deletions app/locales/en.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/locales/es.js
Expand Up @@ -68,9 +68,9 @@ export default {
subjects: 'Subjects'
},
talk: {
zero: 'Noone is talking about <strong>%(title)s</strong> right now.',
one: '<strong>1</strong> person is talking about <strong>%(title)s</strong> right now.',
other: '<strong>%(count)s</strong> people are talking about <strong>%(title)s</strong> right now.'
zero: 'Noone is talking about **%(title)s** right now.',
one: '**1** person is talking about **%(title)s** right now.',
other: '**%(count)s** people are talking about **%(title)s** right now.'
},
joinIn: 'Join in',
learnMore: 'Learn more',
Expand Down
6 changes: 3 additions & 3 deletions app/locales/it.js
Expand Up @@ -68,9 +68,9 @@ export default {
subjects: 'Subjects'
},
talk: {
zero: 'Nessuno sta parlando di <strong>%(title)s</strong> in questo momento.',
one: '<strong>1</strong> persona sta parlando di <strong>%(title)s</strong> in questo momento.',
other: '<strong>%(count)s</strong> persone stanno parlando di <strong>%(title)s</strong> in questo momento.'
zero: 'Nessuno sta parlando di **%(title)s** in questo momento.',
one: '**1** persona sta parlando di **%(title)s** in questo momento.',
other: '**%(count)s** persone stanno parlando di **%(title)s** in questo momento.'
},
joinIn: 'Partecipa',
learnMore: 'Learn more',
Expand Down
6 changes: 3 additions & 3 deletions app/locales/nl.js
Expand Up @@ -95,9 +95,9 @@ export default {
subjects: 'Onderwerpen'
},
talk: {
zero: 'Niemand praat over <strong>%(title)s</strong> op dit moment.',
one: '<strong>1</strong> persoon praat over <strong>%(title)s</strong> op dit moment.',
other: '<strong>%(count)s</strong> mensen praten over <strong>%(title)s</strong> op dit moment.'
zero: 'Niemand praat over **%(title)s** op dit moment.',
one: '**1** persoon praat over **%(title)s** op dit moment.',
other: '**%(count)s** mensen praten over **%(title)s** op dit moment.'
},
joinIn: 'Doe mee',
learnMore: 'Learn more',
Expand Down
21 changes: 12 additions & 9 deletions app/pages/project/home/talk-status.jsx
Expand Up @@ -2,6 +2,8 @@ import PropTypes from 'prop-types';
import React from 'react';
import { sugarApiClient } from 'panoptes-client/lib/sugar';
import { Link } from 'react-router';
import { Markdown } from 'markdownz';
import counterpart from 'counterpart';
import Translate from 'react-translate-component';

export default class TalkStatus extends React.Component {
Expand Down Expand Up @@ -30,14 +32,15 @@ export default class TalkStatus extends React.Component {
render() {
return (
<div className="project-home-page__talk-stat">
<Translate
content="project.home.talk"
with={{
count: this.state.activeUsers,
title: this.props.translation.display_name
}}
unsafe={true}
/>
<Markdown>
{counterpart(
'project.home.talk',
{
count: parseInt(this.state.activeUsers, 10),
title: this.props.translation.display_name
}
)}
</Markdown>
<div>
<Link to={`/projects/${this.props.project.slug}/talk`} className="join-in project-home-page__button">
<Translate content="project.home.joinIn" />
Expand Down Expand Up @@ -65,4 +68,4 @@ TalkStatus.propTypes = {
researcher_quote: PropTypes.string,
title: PropTypes.string
}).isRequired
};
};

0 comments on commit 807d2dd

Please sign in to comment.