1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 18:35:09 +01:00

Merge branch 'AD-499-whitelabel-prize-with-sluice-as-k' of bitbucket.org:ascribe/onion into AD-499-whitelabel-prize-with-sluice-as-k

This commit is contained in:
vrde 2015-07-14 22:43:03 +02:00
commit 63c78d09d9
6 changed files with 116 additions and 6 deletions

View File

@ -40,6 +40,15 @@
</head> </head>
<body> <body>
<div id="main"></div> <div id="main"></div>
<!-- Intercom library -->
<script>
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;
s.src='https://widget.intercom.io/widget/{app_id}';
var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
</script>
<!-- actual app -->
<script src="<%= BASE_URL %>static/js/app.js"></script> <script src="<%= BASE_URL %>static/js/app.js"></script>
</body> </body>
</html> </html>

View File

@ -15,22 +15,31 @@ let AclProxy = React.createClass({
React.PropTypes.arrayOf(React.PropTypes.element), React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element React.PropTypes.element
]).isRequired, ]).isRequired,
aclObject: React.PropTypes.object.isRequired, aclObject: React.PropTypes.object,
aclName: React.PropTypes.string.isRequired aclName: React.PropTypes.string,
show: React.PropTypes.bool
}, },
render() { render() {
if(this.props.aclObject[this.props.aclName]) { if(this.props.show) {
return ( return (
<span> <span>
{this.props.children} {this.props.children}
</span> </span>
); );
} else { } else {
if(typeof this.props.aclObject[this.props.aclName] === 'undefined') { if(this.props.aclObject[this.props.aclName]) {
console.warn('The aclName you\'re filtering for was not present (undefined) in the aclObject.'); return (
<span>
{this.props.children}
</span>
);
} else {
if(typeof this.props.aclObject[this.props.aclName] === 'undefined') {
console.warn('The aclName you\'re filtering for was not present (undefined) in the aclObject.');
}
return null;
} }
return null;
} }
} }
}); });

View File

@ -16,6 +16,9 @@ import EditionListActions from '../../actions/edition_list_actions';
import GlobalNotificationModel from '../../models/global_notification_model'; import GlobalNotificationModel from '../../models/global_notification_model';
import GlobalNotificationActions from '../../actions/global_notification_actions'; import GlobalNotificationActions from '../../actions/global_notification_actions';
import AclProxy from '../acl_proxy';
import SubmitToPrizeButton from '../ascribe_buttons/submit_to_prize_button';
import { getLangText } from '../../utils/lang_utils'; import { getLangText } from '../../utils/lang_utils';
let Link = Router.Link; let Link = Router.Link;
@ -125,6 +128,20 @@ let AccordionListItem = React.createClass({
piece={this.props.content} piece={this.props.content}
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog} toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
onPollingSuccess={this.onPollingSuccess}/> onPollingSuccess={this.onPollingSuccess}/>
<AclProxy
show={this.props.content.prize_name === null}>
<SubmitToPrizeButton
className="pull-right"
piece={this.props.content} />
</AclProxy>
<AclProxy
show={this.props.content.prize_name}>
<button
disabled
className="btn btn-default btn-xs pull-right">
{getLangText('Submitted to prize')} <span className="glyphicon glyphicon-ok" aria-hidden="true"></span>
</button>
</AclProxy>
</div> </div>
</div> </div>
<span style={{'clear': 'both'}}></span> <span style={{'clear': 'both'}}></span>

View File

@ -0,0 +1,23 @@
'use strict';
import React from 'react';
import classNames from 'classnames';
import { getLangText } from '../../utils/lang_utils';
let SubmitToPrizeButton = React.createClass({
propTypes: {
className: React.PropTypes.string
},
render() {
return (
<button
className={classNames('btn', 'btn-default', 'btn-xs', this.props.className)}>
{getLangText('Submit to prize')}
</button>
);
}
});
export default SubmitToPrizeButton;

View File

@ -58,6 +58,8 @@ let Header = React.createClass({
handleLogout(){ handleLogout(){
UserActions.logoutCurrentUser(); UserActions.logoutCurrentUser();
Alt.flush(); Alt.flush();
// kill intercom (with fire)
window.Intercom('shutdown');
this.transitionTo('login'); this.transitionTo('login');
}, },
@ -89,6 +91,17 @@ let Header = React.createClass({
}, },
onChange(state) { onChange(state) {
this.setState(state); this.setState(state);
if(this.state.currentUser && this.state.currentUser.email) {
// bootup intercom if the user is logged in
window.Intercom('boot', {
app_id: 'oboxh5w1',
email: this.state.currentUser.email,
widget: {
activator: '#IntercomDefaultWidget'
}
});
}
}, },
render() { render() {

View File

@ -211,6 +211,19 @@ const languages = {
'read': 'read', 'read': 'read',
'If your email address exists in our database, you will receive a password recovery link in a few minutes.': 'If your email address exists in our database, you will receive a password recovery link in a few minutes.', 'If your email address exists in our database, you will receive a password recovery link in a few minutes.': 'If your email address exists in our database, you will receive a password recovery link in a few minutes.',
'REGISTREE': 'REGISTREE', 'REGISTREE': 'REGISTREE',
'Submit to the prize': 'Submit to the prize',
'Submit': 'Submit',
'Artist statement': 'Artist statement',
'Enter your statement': 'Enter your statement',
'Work description': 'Work description',
'Enter the description for your work': 'Enter the description for your work',
'I agree to the Terms of Service the art price': 'I agree to the Terms of Service the art price',
'Log in': 'Log in',
'Enter ascribe': 'Enter ascribe',
'Sign up to the prize': 'Sign up to the prize',
'(e.g. andy@warhol.co.uk)': '(e.g. andy@warhol.co.uk)',
'Use a combination of minimum 10 chars and numbers': 'Use a combination of minimum 10 chars and numbers',
'Log in with ascribe': 'Log in with ascribe'
}, },
'de': { 'de': {
'ID': 'ID', 'ID': 'ID',
@ -422,6 +435,19 @@ const languages = {
'read': 'read', 'read': 'read',
'If your email address exists in our database, you will receive a password recovery link in a few minutes.': 'If your email address exists in our database, you will receive a password recovery link in a few minutes.', 'If your email address exists in our database, you will receive a password recovery link in a few minutes.': 'If your email address exists in our database, you will receive a password recovery link in a few minutes.',
'REGISTREE': 'REGISTREE', 'REGISTREE': 'REGISTREE',
'Submit to the prize': 'Submit to the prize',
'Submit': 'Submit',
'Artist statement': 'Artist statement',
'Enter your statement': 'Enter your statement',
'Work description': 'Work description',
'Enter the description for your work': 'Enter the description for your work',
'I agree to the Terms of Service the art price': 'I agree to the Terms of Service the art price',
'Log in': 'Log in',
'Enter ascribe': 'Enter ascribe',
'Sign up to the prize': 'Sign up to the prize',
'(e.g. andy@warhol.co.uk)': '(e.g. andy@warhol.co.uk)',
'Use a combination of minimum 10 chars and numbers': 'Use a combination of minimum 10 chars and numbers',
'Log in with ascribe': 'Log in with ascribe'
}, },
'fr': { 'fr': {
'ID': 'ID', 'ID': 'ID',
@ -633,6 +659,19 @@ const languages = {
'read': 'read', 'read': 'read',
'If your email address exists in our database, you will receive a password recovery link in a few minutes.': 'Si votre adresse électronique existe dans notre base de données, vous recevrez un lien de récupération de mot de passe dans quelques minutes.', 'If your email address exists in our database, you will receive a password recovery link in a few minutes.': 'Si votre adresse électronique existe dans notre base de données, vous recevrez un lien de récupération de mot de passe dans quelques minutes.',
'REGISTREE': 'REGISTREE', 'REGISTREE': 'REGISTREE',
'Submit to the prize': 'Submit to the prize',
'Submit': 'Submit',
'Artist statement': 'Artist statement',
'Enter your statement': 'Enter your statement',
'Work description': 'Work description',
'Enter the description for your work': 'Enter the description for your work',
'I agree to the Terms of Service the art price': 'I agree to the Terms of Service the art price',
'Log in': 'Log in',
'Enter ascribe': 'Enter ascribe',
'Sign up to the prize': 'Sign up to the prize',
'(e.g. andy@warhol.co.uk)': '(e.g. andy@warhol.co.uk)',
'Use a combination of minimum 10 chars and numbers': 'Use a combination of minimum 10 chars and numbers',
'Log in with ascribe': 'Log in with ascribe'
} }
}; };