split jobs routes, add show comp

This commit is contained in:
Berkeley Martinez
2015-08-29 01:00:52 -07:00
parent ef5715fa24
commit ac193dc4c4
4 changed files with 79 additions and 57 deletions

View File

@ -52,7 +52,8 @@ export default contain(
key={ id }> key={ id }>
<Well> <Well>
<Thumbnail <Thumbnail
alt='200x200' src={ logo } alt={ company + 'company logo' }
src={ logo }
style={ thumbnailStyle } /> style={ thumbnailStyle } />
<Panel> <Panel>
Position: { position } Position: { position }

View File

@ -1,5 +1,6 @@
import React, { PropTypes } from 'react'; import React, { PropTypes } from 'react';
import { Thumbnail, Panel, Well } from 'react-bootstrap'; import { contain } from 'thundercats-react';
import { Row, Thumbnail, Panel, Well } from 'react-bootstrap';
import moment from 'moment'; import moment from 'moment';
const thumbnailStyle = { const thumbnailStyle = {
@ -7,53 +8,70 @@ const thumbnailStyle = {
maxHeight: '100px', maxHeight: '100px',
maxWidth: '100px' maxWidth: '100px'
}; };
export default React.createClass({
displayName: 'ShowJob', export default contain(
propTypes: { {
job: PropTypes.object store: 'jobsStore',
fetchAction: 'jobActions.getJob',
getPayload({ params }) {
return { id: params.id };
}
}, },
React.createClass({
displayName: 'ShowJob',
propTypes: {
job: PropTypes.object,
params: PropTypes.object
},
renderHeader({ company, position }) { renderHeader({ company, position }) {
return ( return (
<div> <div>
<h4 style={{ display: 'inline-block' }}>{ company }</h4> <h4 style={{ display: 'inline-block' }}>{ company }</h4>
<h5 <h5
className='pull-right hidden-xs hidden-md' className='pull-right hidden-xs hidden-md'
style={{ display: 'inline-block' }}> style={{ display: 'inline-block' }}>
{ position } { position }
</h5> </h5>
</div> </div>
); );
}, },
render() { render() {
const { job } = this.props; const { job } = this.props;
const { const {
logo, logo,
position, position,
city, city,
state, company,
email, state,
phone, email,
postedOn, phone,
description postedOn,
} = job; description
} = job;
return ( return (
<Well> <div>
<Thumbnail <Row>
alt='200x200' src={ logo } <Well>
style={ thumbnailStyle } /> <Thumbnail
<Panel> alt={ company + 'company logo' }
Position: { position } src={ logo }
Location: { city }, { state } style={ thumbnailStyle } />
<br /> <Panel>
Contact: { email || phone || 'N/A' } Position: { position }
<br /> Location: { city }, { state }
Posted On: { moment(postedOn).format('MMMM Do, YYYY') } <br />
</Panel> Contact: { email || phone || 'N/A' }
<p>{ description }</p> <br />
</Well> Posted On: { moment(postedOn).format('MMMM Do, YYYY') }
); </Panel>
} <p>{ description }</p>
}); </Well>
</Row>
</div>
);
}
})
);

View File

@ -5,9 +5,7 @@ const debug = debugFactory('freecc:jobs:actions');
export default Actions({ export default Actions({
setJobs: null, setJobs: null,
getJob(id) { getJob: null,
return { id };
},
getJobs(params) { getJobs(params) {
return { params }; return { params };
} }

View File

@ -1,14 +1,19 @@
import Jobs from './components/Jobs.jsx'; import Jobs from './components/Jobs.jsx';
import Show from './components/Show.jsx';
/* /*
* show: /jobs * index: /jobs list jobs
* showOne: /jobs/:id * show: /jobs/:id show one job
* edit /jobs/:id * create /jobs/new create a new job
* delete /jobs/:id
* createOne /jobs/new
*/ */
export default { export default {
path: 'jobs', path: 'jobs',
component: Jobs childRoutes: [{
path: 'jobs',
component: Jobs
}, {
path: 'jobs/:id',
component: Show
}]
}; };