-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Me: Use SitesDropdown instead of SelectSite in /me/account #1837
Changes from 5 commits
5138ea7
3cf4ad5
59749fc
917fd78
a475546
21572e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ import LanguageSelector from 'components/forms/language-selector'; | |
import MeSidebarNavigation from 'me/sidebar-navigation'; | ||
import protectForm from 'lib/mixins/protect-form'; | ||
import formBase from 'me/form-base'; | ||
import SelectSite from 'me/select-site'; | ||
import config from 'config'; | ||
import Card from 'components/card'; | ||
import FormTextInput from 'components/forms/form-text-input'; | ||
|
@@ -41,6 +40,7 @@ import observe from 'lib/mixins/data-observe'; | |
import eventRecorder from 'me/event-recorder'; | ||
import Main from 'components/main'; | ||
import SectionHeader from 'components/section-header'; | ||
import SitesDropdown from 'components/sites-dropdown'; | ||
|
||
import _sites from 'lib/sites-list'; | ||
import _user from 'lib/user'; | ||
|
@@ -210,6 +210,13 @@ module.exports = React.createClass( { | |
} ); | ||
}, | ||
|
||
onSiteSelect( siteSlug ) { | ||
let selectedSite = sites.getSite( siteSlug ); | ||
if ( sites.getSite( siteSlug ) ) { | ||
this.props.userSettings.updateSetting( 'primary_site_ID', selectedSite.ID ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we not have a Flux-y action to update the primary site? This looks dangerously entangled here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is specifically for the |
||
} | ||
}, | ||
|
||
renderHolidaySnow() { | ||
// Note that years and months below are zero indexed | ||
const today = this.moment(); | ||
|
@@ -350,14 +357,15 @@ module.exports = React.createClass( { | |
); | ||
} | ||
|
||
let primarySiteId = this.props.userSettings.getSetting( 'primary_site_ID' ); | ||
|
||
return ( | ||
<SelectSite | ||
disabled={ this.getDisabledState() } | ||
id="primary_site_ID" | ||
name="primary_site_ID" | ||
onFocus={ this.recordFocusEvent( 'Primary Site Field' ) } | ||
sites={ sites } | ||
valueLink={ this.valueLink( 'primary_site_ID' ) } /> | ||
<SitesDropdown | ||
key={ primarySiteId } | ||
isPlaceholder={ ! primarySiteId } | ||
selected={ this.props.userSettings.getSetting( 'primary_site_ID' ) } | ||
onSiteSelect={ this.onSiteSelect } | ||
/> | ||
); | ||
}, | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a typo? should it be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heh... you're right 😄 I created the variable so I didn't have to get the site twice, and then I did it anyways 🐼