mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 01:13:14 +01:00
commit
a7be0d82c7
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
(
|
||||
<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;
|
@ -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) {
|
||||
|
@ -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',
|
||||
|
@ -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() });
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user