Skip to content

Instantly share code, notes, and snippets.

@CoreyTrombley
Created March 7, 2015 18:10
Show Gist options
  • Save CoreyTrombley/ab92d8ae5259315308d4 to your computer and use it in GitHub Desktop.
Save CoreyTrombley/ab92d8ae5259315308d4 to your computer and use it in GitHub Desktop.
var LineItemDetailContainer = React.createClass({
displayName: 'LineItemDetailContainer',
mixins: [FluxMixin],
propTypes: {
/**
* lineItemId that we are displaying the
* page for.
*/
lineItemId: React.PropTypes.string.isRequired,
/**
* the lineitem data
*/
lineItem: React.PropTypes.object.isRequired,
campaigns: React.PropTypes.oneOfType([
React.PropTypes.array,
React.PropTypes.object
]),
adsets: React.PropTypes.array
},
getDefaultProps: function() {
//this was my attempt to have line item be black from the start
return {
lineItem: {}
};
},
componentDidMount: function() {
this.getFlux().actions.lineItem.fetch({id: this.props.lineItemId});
},
_renderTableContainer: function() {
var lineItem = this.props.lineItem;
var publisher = lineItem.publisher;
var unifiedTableTopper = <UnifiedCardTableTopper lineItem={lineItem}
lineItemId={lineItem.id}
initiativeId={this.props.initiativeId}
initiative={this.props.initiative} />;
var tableNavContainer = <TableNavContainer lineItemId={lineItem.id}
publisher={publisher}
campaigns={this.props.campaigns}
adsets={this.props.adsets}/>;
if (publisher) {
return (
<TableContainer publisher={publisher}
table={unifiedTableTopper}
navTable={tableNavContainer}/>
);
} else {
return <div />;
}
},
render: function() {
return (
<div className="content">
<div className='container-fluid container-full'>
<div className='row'>
<div className='col-md-12'>
{this._renderTableContainer()}
</div>
</div>
</div>
</div>
);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment