From 6aa19ef24755cbd5250590dcf83880ec20a17b6f Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Fri, 30 Oct 2015 16:58:49 -0700 Subject: [PATCH] Add a tag to links --- common/app/routes/Jobs/components/ShowJob.jsx | 14 ++++++++++++-- package.json | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/common/app/routes/Jobs/components/ShowJob.jsx b/common/app/routes/Jobs/components/ShowJob.jsx index d7076f0a5e..658a8f6295 100644 --- a/common/app/routes/Jobs/components/ShowJob.jsx +++ b/common/app/routes/Jobs/components/ShowJob.jsx @@ -1,6 +1,8 @@ import React, { PropTypes } from 'react'; import { Well, Row, Col, Thumbnail, Panel } from 'react-bootstrap'; +import urlRegexFactory from 'url-regex'; +const urlRegex = urlRegexFactory(); const defaultImage = 'https://s3.amazonaws.com/freecodecamp/camper-image-placeholder.png'; @@ -10,6 +12,12 @@ const thumbnailStyle = { maxWidth: '100px' }; +function addATags(text) { + return text.replace(urlRegex, function(match) { + return `${match}`; + }); +} + export default React.createClass({ displayName: 'ShowJob', propTypes: { @@ -90,10 +98,12 @@ export default React.createClass({ - How do I apply? + How do I apply?

- { howToApply } + diff --git a/package.json b/package.json index 10697a1778..38cdb03f2a 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,7 @@ "thundercats-react": "^0.3.0", "twit": "~1.1.20", "uglify-js": "~2.4.15", + "url-regex": "^3.0.0", "validator": "^3.22.1", "webpack": "^1.9.12", "xss-filters": "^1.2.6",