From 94c2730b2ab8ec036b46e61c8164617d5727ee2a Mon Sep 17 00:00:00 2001 From: Dale John McGrew Date: Fri, 15 Apr 2016 08:50:30 -0700 Subject: [PATCH 1/2] Updated components/Ballot/PositionItem.jsx to support individual voter opinions. --- src/js/components/Ballot/PositionItem.jsx | 43 +++++++++++++++++------ 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/src/js/components/Ballot/PositionItem.jsx b/src/js/components/Ballot/PositionItem.jsx index 417b71298..e7531a1c9 100644 --- a/src/js/components/Ballot/PositionItem.jsx +++ b/src/js/components/Ballot/PositionItem.jsx @@ -6,6 +6,7 @@ export default class PositionItem extends Component { static propTypes = { position_we_vote_id: PropTypes.string.isRequired, last_updated: PropTypes.string, + speaker_type: PropTypes.string, speaker_image_url_https: PropTypes.string, candidate_display_name: PropTypes.string.isRequired, speaker_display_name: PropTypes.string.isRequired @@ -17,8 +18,30 @@ export default class PositionItem extends Component { var dateText = moment(dateStr).startOf("day").fromNow(); var speaker_we_vote_id_link = "/voterguide/" + position.speaker_we_vote_id; + var image_placeholder = ""; + if (this.props.speaker_type == "O") { + image_placeholder = + } else if (this.props.speaker_type == "V") { + image_placeholder = + } + + var position_description = ; + if (position.vote_smart_rating) { + var position_description =

+ rates {this.props.candidate_display_name} {position.vote_smart_rating}% + { position.vote_smart_time_span ? + in {position.vote_smart_time_span} : + { dateText } } +

; + } else if (position.speaker_type == "V") { + var position_description =

+ {this.props.candidate_display_name} + { dateText } +

; + } + return
- {/* One organization's Position on this Candidate */} + {/* One Position on this Candidate */}
  • @@ -28,20 +51,18 @@ export default class PositionItem extends Component { src={this.props.speaker_image_url_https} width="50px" /> : - } + image_placeholder }

    - { this.props.speaker_display_name }
    + { this.props.speaker_display_name } + { position.is_support && !position.vote_smart_rating ? +  support : } + { position.is_oppose && !position.vote_smart_rating ? +  oppose : } +

    -

    rates {this.props.candidate_display_name} - { position.vote_smart_rating ? - {position.vote_smart_rating}% : - } - { position.vote_smart_time_span ? - in {position.vote_smart_time_span} : - { dateText } } -

    + { position_description }
  • From bd8c9a5bbfd1f3ecee6004bdadd7be876f5e382d Mon Sep 17 00:00:00 2001 From: Dale John McGrew Date: Fri, 15 Apr 2016 23:29:58 -0700 Subject: [PATCH 2/2] Update PositionItem.jsx Transitioned "var" to "let" per @pertrai1's suggestion. --- src/js/components/Ballot/PositionItem.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/js/components/Ballot/PositionItem.jsx b/src/js/components/Ballot/PositionItem.jsx index e7531a1c9..f2fa484f9 100644 --- a/src/js/components/Ballot/PositionItem.jsx +++ b/src/js/components/Ballot/PositionItem.jsx @@ -18,23 +18,23 @@ export default class PositionItem extends Component { var dateText = moment(dateStr).startOf("day").fromNow(); var speaker_we_vote_id_link = "/voterguide/" + position.speaker_we_vote_id; - var image_placeholder = ""; + let image_placeholder = ""; if (this.props.speaker_type == "O") { image_placeholder = } else if (this.props.speaker_type == "V") { image_placeholder = } - var position_description = ; + let position_description = ; if (position.vote_smart_rating) { - var position_description =

    + position_description =

    rates {this.props.candidate_display_name} {position.vote_smart_rating}% { position.vote_smart_time_span ? in {position.vote_smart_time_span} : { dateText } }

    ; } else if (position.speaker_type == "V") { - var position_description =

    + position_description =

    {this.props.candidate_display_name} { dateText }

    ;