Merge pull request #208 from ascribe/bokk-integration

bokk.ascribe.io
This commit is contained in:
Tim Daubenschütz 2016-10-14 11:56:31 +02:00 committed by GitHub
commit a7be0d82c7
6 changed files with 159 additions and 5 deletions

View File

@ -55,7 +55,7 @@ const AppGateway = {
if (subdomain) {
// Some whitelabels have landing pages so we should not automatically redirect from / to /collection.
// Only www and cc do not have a landing page.
if (subdomain !== 'cc') {
if (subdomain !== 'cc' || subdomain === 'bokk') {
redirectRoute = null;
}

View File

@ -114,7 +114,7 @@ let AccordionListItemWallet = React.createClass({
const { content, whitelabel } = this.props;
// convert this to acl_view_licences later
if (whitelabel.name === 'Creative Commons France') {
if (whitelabel.subdomain === 'cc' || whitelabel.subdomain === 'bokk') {
return (
<span>
<span>, </span>

View File

@ -0,0 +1,105 @@
'use strict';
import React from 'react';
import RegisterPiece from '../../../../register_piece';
import Property from '../../../../ascribe_forms/property';
import LicenseActions from '../../../../../actions/license_actions';
import LicenseStore from '../../../../../stores/license_store';
import { getLangText } from '../../../../../utils/lang_utils';
import { setDocumentTitle } from '../../../../../utils/dom_utils';
import { mergeOptions } from '../../../../../utils/general_utils';
let BokkRegisterPiece = React.createClass({
propTypes: {
// Provided from AscribeApp
currentUser: React.PropTypes.object,
whitelabel: React.PropTypes.object,
// Provided from router
location: React.PropTypes.object
},
getInitialState() {
return mergeOptions(
LicenseStore.getState(),
{
selectedLicense: 0
}
);
},
componentDidMount() {
LicenseStore.listen(this.onChange);
LicenseActions.fetchLicense();
},
componentWillUnmount() {
LicenseStore.unlisten(this.onChange);
},
onChange(state) {
this.setState(state);
},
onLicenseChange(event){
this.setState({selectedLicense: event.target.selectedIndex});
},
getLicenses() {
if (this.state.licenses && this.state.licenses.length > 1) {
return (
<Property
name='license'
label={getLangText('Copyright license%s', '...')}
onChange={this.onLicenseChange}
footer={
<span className="pull-right">
<a
href={this.state.licenses[this.state.selectedLicense].url}
target="_blank">
{getLangText('Learn more about ') + this.state.licenses[this.state.selectedLicense].code}
</a>
&nbsp;(
<a
href='https://www.ascribe.io/faq/#legals'
target="_blank">
{getLangText('ascribe faq')}
</a>)
</span>
}>
<select name="license">
{this.state.licenses.map((license, i) => {
return (
<option
name={i}
key={i}
value={ license.code }>
{ license.code.toUpperCase() }: { license.name }
</option>
);
})}
</select>
</Property>);
}
return null;
},
render() {
setDocumentTitle(getLangText('Register a new piece'));
return (
<RegisterPiece
{...this.props}
enableLocalHashing={false}
headerMessage={getLangText('Register under a Creative Commons license with Bokk')}
submitMessage={getLangText('Submit')}
location={this.props.location}>
{this.getLicenses()}
</RegisterPiece>
);
}
});
export default BokkRegisterPiece;

View File

@ -20,6 +20,7 @@ import ErrorNotFoundPage from '../../../components/error_not_found_page';
import Footer from '../../../components/footer.js';
import CCRegisterPiece from './components/cc/cc_register_piece';
import BokkRegisterPiece from './components/bokk/bokk_register_piece';
import CylandLanding from './components/cyland/cyland_landing';
import CylandPieceContainer from './components/cyland/cyland_detail/cyland_piece_container';
@ -448,7 +449,50 @@ let ROUTES = {
<Route path='verify' component={CoaVerifyContainer} />
<Route path='*' component={ErrorNotFoundPage} />
</Route>
)
),
'bokk': (
<Route path='/' component={WalletApp}>
<Route
path='login'
component={ProxyHandler(AuthRedirect({to: '/collection', when: 'loggedIn'}))(LoginContainer)} />
<Route
path='logout'
component={ProxyHandler(AuthRedirect({to: '/', when: 'loggedOut'}))(LogoutContainer)} />
<Route
path='signup'
component={ProxyHandler(AuthRedirect({to: '/collection', when: 'loggedIn'}))(SignupContainer)} />
<Route
path='password_reset'
component={ProxyHandler(AuthRedirect({to: '/collection', when: 'loggedIn'}))(PasswordResetContainer)} />
<Route
path='settings'
component={ProxyHandler(AuthRedirect({to: '/login', when: 'loggedOut'}))(SettingsContainer)} />
<Route
path='contract_settings'
component={ProxyHandler(AuthRedirect({to: '/login', when: 'loggedOut'}))(ContractSettings)} />
<Route
path='register_piece'
component={ProxyHandler(AuthRedirect({to: '/login', when: 'loggedOut'}))(BokkRegisterPiece)}
headerTitle={getLangText('+ NEW WORK')} />
<Route
path='collection'
component={ProxyHandler(AuthRedirect({to: '/login', when: 'loggedOut'}))(PieceList)}
headerTitle={getLangText('COLLECTION')}
disableOn='noPieces' />
<Route
path='pieces/:pieceId'
component={PieceContainer} />
<Route
path='editions/:editionId'
component={EditionContainer} />
<Route
path='coa_verify'
component={CoaVerifyContainer} />
<Route
path='*'
component={ErrorNotFoundPage} />
</Route>
),
};
function getRoutes(commonRoutes, subdomain) {

View File

@ -77,7 +77,12 @@ const constants = {
'subdomain': 'portfolioreview',
'name': 'Portfolio Review',
'type': 'prize'
}
},
{
'subdomain': 'bokk',
'name': 'bokk Creative Commons France',
'type': 'wallet'
},
],
'defaultDomain': {
'type': 'default',

View File

@ -10,7 +10,7 @@ let LicenseFetcher = {
* Fetch the available licenses from the API (might be bound to the subdomain e.g. cc.ascribe.io).
*/
fetch() {
return requests.get('licenses', {'subdomain': getSubdomain()});
return requests.get('licenses', {'subdomain': getSubdomain() });
}
};