mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-22 23:27:54 -05:00
Merge branch 'develop' into feature/react-intl
* develop: Fix 'M' issue in Firefox Widen modal to account for tooltip overflow Name Registration component Refresh session, close popup after registration Add standalone legacy registration iframe # Conflicts: # server/proxies.json # src/components/navigation/navigation.jsx
This commit is contained in:
commit
997b94a91c
7 changed files with 85 additions and 22 deletions
|
@ -2,12 +2,12 @@
|
|||
{
|
||||
"root": "/",
|
||||
"paths": [
|
||||
"/accounts/",
|
||||
"/accounts/",
|
||||
"/csrf_token/",
|
||||
"/fragment/",
|
||||
"/get_image/",
|
||||
"/session/",
|
||||
"/site-api/"
|
||||
"/static/"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
19
src/_mixins.scss
Normal file
19
src/_mixins.scss
Normal file
|
@ -0,0 +1,19 @@
|
|||
@mixin modal-iframe($iframe-width, $iframe-height, $padding: 0) {
|
||||
&.ReactModal__Content {
|
||||
top: 50%;
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
left: 50%;
|
||||
margin-top: -($iframe-height + $padding * 2)/2;
|
||||
margin-left: -($iframe-width + $padding * 2)/2;
|
||||
padding: $padding;
|
||||
width: $iframe-width;
|
||||
height: $iframe-height;
|
||||
|
||||
iframe {
|
||||
border: 0;
|
||||
width: $iframe-width;
|
||||
height: $iframe-height;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
@import "../../colors";
|
||||
@import "../../mixins";
|
||||
|
||||
.intro {
|
||||
display: flex;
|
||||
|
@ -224,22 +225,5 @@
|
|||
}
|
||||
|
||||
.video-modal {
|
||||
$video-width: 570px;
|
||||
$video-height: 357px;
|
||||
$padding: 15px;
|
||||
top: 50%;
|
||||
right: auto;
|
||||
bottom: auto;
|
||||
left: 50%;
|
||||
margin-top: -($video-height + $padding * 2)/2;
|
||||
margin-left: -($video-width + $padding * 2)/2;
|
||||
padding: $padding;
|
||||
width: $video-width;
|
||||
height: $video-height;
|
||||
|
||||
iframe {
|
||||
border: 0;
|
||||
width: $video-width;
|
||||
height: $video-height;
|
||||
}
|
||||
@include modal-iframe(570px, 357px, 15px);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ var Dropdown = require('./dropdown.jsx');
|
|||
var Input = require('../forms/input.jsx');
|
||||
var log = require('../../lib/log.js');
|
||||
var Login = require('../login/login.jsx');
|
||||
var Registration = require('../registration/registration.jsx');
|
||||
var Session = require('../../mixins/session.jsx');
|
||||
|
||||
require('./navigation.scss');
|
||||
|
@ -35,9 +36,10 @@ var Navigation = React.createClass({
|
|||
],
|
||||
getInitialState: function () {
|
||||
return {
|
||||
'accountNavOpen': false,
|
||||
'loginOpen': false,
|
||||
'loginError': null,
|
||||
'accountNavOpen': false
|
||||
'registrationOpen': false
|
||||
};
|
||||
},
|
||||
componentDidUpdate: function (prevProps, prevState) {
|
||||
|
@ -52,6 +54,10 @@ var Navigation = React.createClass({
|
|||
if (!this.state.session.user) return;
|
||||
return '/users/' + this.state.session.user.username + '/';
|
||||
},
|
||||
handleJoinClick: function (e) {
|
||||
e.preventDefault();
|
||||
this.setState({'registrationOpen': true});
|
||||
},
|
||||
handleLoginClick: function (e) {
|
||||
e.preventDefault();
|
||||
this.setState({'loginOpen': !this.state.loginOpen});
|
||||
|
@ -100,6 +106,13 @@ var Navigation = React.createClass({
|
|||
closeAccountNav: function () {
|
||||
this.setState({'accountNavOpen': false});
|
||||
},
|
||||
closeRegistration: function () {
|
||||
this.setState({'registrationOpen': false});
|
||||
},
|
||||
completeRegistration: function () {
|
||||
window.refreshSession();
|
||||
this.closeRegistration();
|
||||
},
|
||||
render: function () {
|
||||
var classes = classNames({
|
||||
'inner': true,
|
||||
|
@ -198,6 +211,11 @@ var Navigation = React.createClass({
|
|||
id='general.joinScratch'
|
||||
defaultMessage={'Join Scratch'} />
|
||||
</a></li>,
|
||||
<Registration
|
||||
key="registration"
|
||||
isOpen={this.state.registrationOpen}
|
||||
onRequestClose={this.closeRegistration}
|
||||
onRegistrationDone={this.completeRegistration} />,
|
||||
<li className="link right login-item" key="login">
|
||||
<a
|
||||
href="#"
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
padding-left: 10px;
|
||||
width: 30px;
|
||||
overflow: hidden;
|
||||
text-indent: 100%;
|
||||
text-indent: 50px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
|
36
src/components/registration/registration.jsx
Normal file
36
src/components/registration/registration.jsx
Normal file
|
@ -0,0 +1,36 @@
|
|||
var React = require('react');
|
||||
var Modal = require('../modal/modal.jsx');
|
||||
|
||||
require('./registration.scss');
|
||||
|
||||
Modal.setAppElement(document.getElementById('view'));
|
||||
|
||||
var Registration = React.createClass({
|
||||
propTypes: {
|
||||
isOpen: React.PropTypes.bool,
|
||||
onRegistrationDone: React.PropTypes.func,
|
||||
onRequestClose: React.PropTypes.func
|
||||
},
|
||||
onMessage: function (e) {
|
||||
if (e.origin != window.location.origin) return;
|
||||
if (e.data == 'registration-done') this.props.onRegistrationDone();
|
||||
},
|
||||
componentDidMount: function () {
|
||||
window.addEventListener('message', this.onMessage);
|
||||
},
|
||||
componentWillUnmount: function () {
|
||||
window.removeEventListener('message', this.onMessage);
|
||||
},
|
||||
render: function () {
|
||||
return (
|
||||
<Modal
|
||||
isOpen={this.props.isOpen}
|
||||
onRequestClose={this.props.onRequestClose}
|
||||
className="registration">
|
||||
<iframe src="/accounts/standalone-registration/" />
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Registration;
|
6
src/components/registration/registration.scss
Normal file
6
src/components/registration/registration.scss
Normal file
|
@ -0,0 +1,6 @@
|
|||
@import "../../mixins";
|
||||
|
||||
.registration {
|
||||
@include modal-iframe(610px, 438px);
|
||||
overflow: hidden;
|
||||
}
|
Loading…
Reference in a new issue