Skip to content

Commit

Permalink
Got the menu working again. Passing voter_device_id as a GET variable…
Browse files Browse the repository at this point in the history
… in the VoterGuideStore, so the "More Opinions" page works again.
  • Loading branch information
DaleMcGrew committed Feb 18, 2016
1 parent ea15baf commit f750168
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/js/Application.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default class Application extends Component {
<div className="container-fluid">
<div className="row">
<div className="col-xs-4 col-sm-4 col-md-4 no-show">
{ is_signed_in ? <MoreMenu {...voter} /> : <span></span> }
{ is_signed_in ? <MoreMenu {...voter} /> : <MoreMenu /> }
</div>
<div className="col-xs-8 col-sm-8 col-md-8">
{ this.props.children }
Expand Down
1 change: 1 addition & 0 deletions src/js/routes/More/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export default class About extends Component {
Kim Anderson - San Francisco, CA<br />
Adam Barry - San Francisco, CA<br />
Raphael Merx - San Francisco, CA<br />
Jesse Aldridge - San Francisco, CA<br />
Josh Levinger - Oakland, CA<br />
Leslie Castellanos - San Francisco, CA<br />
Jennifer Holmes - Pacifica, CA<br />
Expand Down
2 changes: 1 addition & 1 deletion src/js/stores/BallotStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let _google_civic_election_id = null;
const MEASURE = 'MEASURE';

function defaultSuccess (res) {
console.warn(res);
// console.warn(res);
}

function addItemsToBallotStore (ballot_item_list) {
Expand Down
19 changes: 19 additions & 0 deletions src/js/stores/VoterGuideStore.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import BallotStore from '../stores/BallotStore';
import { createStore } from '../utils/createStore';
import { get } from '../utils/service';
import {shallowClone} from '../utils/object-utils';

const AppDispatcher = require('../dispatcher/AppDispatcher');
const VoterGuideConstants = require('../constants/VoterGuideConstants');

const cookies = require("../utils/cookies");
const request = require('superagent');
const web_app_config = require('../config');

Expand Down Expand Up @@ -32,6 +34,7 @@ function retrieveVoterGuidesToFollowList () {
.withCredentials()
.query(web_app_config.test)
.query({ google_civic_election_id: BallotStore.getGoogleCivicElectionId() })
.query({ voter_device_id: cookies.getItem("voter_device_id") })
.end( function (err, res) {
if (err || !res.body.success)
reject(err || res.body.status);
Expand Down Expand Up @@ -59,6 +62,7 @@ function retrieveVoterGuidesFollowedList () {
return new Promise( (resolve, reject) => request
.get(`${web_app_config.WE_VOTE_SERVER_API_ROOT_URL}voterGuidesFollowedRetrieve/`)
.withCredentials()
.query({ voter_device_id: cookies.getItem("voter_device_id") })
.end( function (err, res) {
if (err || !res.body.success)
reject(err || res.body.status);
Expand Down Expand Up @@ -88,6 +92,7 @@ function retrieveOrganizations (data) {
.get(`${web_app_config.WE_VOTE_SERVER_API_ROOT_URL}organizationRetrieve/`)
.withCredentials()
.query({ organization_we_vote_id: we_vote_id })
.query({ voter_device_id: cookies.getItem("voter_device_id") })
.end( function (err, res) {
if (res.body.success) {
_organization_store[res.body.organization_we_vote_id] = shallowClone(res.body);
Expand All @@ -109,6 +114,7 @@ function retrieveOrganizationsFollowedList () {
return new Promise( (resolve, reject) => request
.get(`${web_app_config.WE_VOTE_SERVER_API_ROOT_URL}organizationsFollowedRetrieve/`)
.withCredentials()
.query({ voter_device_id: cookies.getItem("voter_device_id") })
.end( function (err, res) {
if (err || !res.body.success)
reject(err || res.body.status);
Expand All @@ -132,6 +138,7 @@ function followOrganization (we_vote_id) {
return new Promise((resolve, reject) => request
.get(`${web_app_config.WE_VOTE_SERVER_API_ROOT_URL}organizationFollow/`)
.withCredentials()
.query({ voter_device_id: cookies.getItem("voter_device_id") })
.query({ organization_id: _organization_store[we_vote_id].organization_id })
.end( function (err, res) {
if (res.body.success) {
Expand All @@ -151,6 +158,7 @@ function ignoreOrganization (we_vote_id) {
return new Promise((resolve, reject) => request
.get(`${web_app_config.WE_VOTE_SERVER_API_ROOT_URL}organizationFollowIgnore/`)
.withCredentials()
.query({ voter_device_id: cookies.getItem("voter_device_id") })
.query({ organization_id: _organization_store[we_vote_id].organization_id })
.end( function (err, res) {
if (res.body.success) {
Expand All @@ -170,6 +178,7 @@ function stopFollowingOrganization (we_vote_id) {
return new Promise((resolve, reject) => request
.get(`${web_app_config.WE_VOTE_SERVER_API_ROOT_URL}organizationStopFollowing/`)
.withCredentials()
.query({ voter_device_id: cookies.getItem("voter_device_id") })
.query({ organization_id: _organization_store[we_vote_id].id })
.end( function (err, res) {
if (res.body.success) {
Expand All @@ -183,6 +192,16 @@ function stopFollowingOrganization (we_vote_id) {
);
}

// Refactor to this structure?
//const VoterGuideAPIWorker = {
// voterBallotItemsRetrieveFromGoogleCivic: function (text_for_map_search, success) {
// return get({
// endpoint: 'voterBallotItemsRetrieveFromGoogleCivic',
// query: {text_for_map_search}, success: success || defaultSuccess
// });
// }
//};

const VoterGuideStore = createStore({
/**
* initialize the voter guide store with "guides to follow" data, if no data
Expand Down

0 comments on commit f750168

Please sign in to comment.