1
0
mirror of https://github.com/ascribe/onion.git synced 2025-02-14 21:10:27 +01:00

Merge remote-tracking branch 'origin/master' into AD-499-whitelabel-prize-with-sluice-as-k

This commit is contained in:
Tim Daubenschütz 2015-07-15 16:55:38 +02:00
commit 725e79bc4f
6 changed files with 73 additions and 60 deletions

View File

@ -41,6 +41,16 @@
<body> <body>
<div id="main"></div> <div id="main"></div>
<!-- Google Analytics tracking code -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-60614729-2', 'auto');
</script>
<!-- Intercom library --> <!-- Intercom library -->
<script> <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; (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;

View File

@ -52,7 +52,10 @@ class AppGateway {
} }
load(type) { load(type) {
Router.run(getRoutes(type), Router.HistoryLocation, (App) => { Router.run(getRoutes(type), Router.HistoryLocation, (App, state) => {
if (window.ga) {
window.ga('send', 'pageview');
}
React.render( React.render(
<App />, <App />,
document.getElementById('main') document.getElementById('main')

View File

@ -63,11 +63,11 @@ let AccordionListItem = React.createClass({
}, },
getGlyphicon(){ getGlyphicon(){
if (this.props.content.requestAction){ if (this.props.content.requestAction) {
return ( return (
<OverlayTrigger delay={500} placement="left" <OverlayTrigger delay={500} placement="left"
overlay={<Tooltip>{getLangText('You have actions pending in one of your editions')}</Tooltip>}> overlay={<Tooltip>{getLangText('You have actions pending in one of your editions')}</Tooltip>}>
<Glyphicon glyph='bell' /> <Glyphicon glyph='bell'/>
</OverlayTrigger>); </OverlayTrigger>);
} }
return null; return null;
@ -106,12 +106,13 @@ let AccordionListItem = React.createClass({
}, },
getCreateEditionsDialog() { getCreateEditionsDialog() {
if(this.props.content.num_editions < 1 && this.state.showCreateEditionsDialog) { if (this.props.content.num_editions < 1 && this.state.showCreateEditionsDialog) {
return ( return (
<div className="ascribe-accordion-list-item-table col-xs-12 col-sm-10 col-md-8 col-lg-8 col-sm-offset-1 col-md-offset-2 col-lg-offset-2"> <div
className="ascribe-accordion-list-item-table col-xs-12 col-sm-10 col-md-8 col-lg-8 col-sm-offset-1 col-md-offset-2 col-lg-offset-2">
<CreateEditionsForm <CreateEditionsForm
pieceId={this.props.content.id} pieceId={this.props.content.id}
handleSuccess={this.handleEditionCreationSuccess} /> handleSuccess={this.handleEditionCreationSuccess}/>
</div> </div>
); );
} }
@ -119,11 +120,14 @@ let AccordionListItem = React.createClass({
getLicences() { getLicences() {
// convert this to acl_view_licences later // convert this to acl_view_licences later
if(this.state.whitelabel.name === 'Creative Commons France') { if (this.state.whitelabel.name === 'Creative Commons France') {
return ( return (
<a href={this.props.content.license_type.url} target="_blank" className="pull-right"> <span>
{getLangText('%s license', this.props.content.license_type.code)} <span>, </span>
</a> <a href={this.props.content.license_type.url} target="_blank">
{getLangText('%s license', this.props.content.license_type.code)}
</a>
</span>
); );
} }
}, },
@ -131,7 +135,7 @@ let AccordionListItem = React.createClass({
render() { render() {
let linkData; let linkData;
if(this.props.content.num_editions < 1 || !this.props.content.first_edition) { if (this.props.content.num_editions < 1 || !this.props.content.first_edition) {
linkData = { linkData = {
to: 'piece', to: 'piece',
params: { params: {
@ -154,15 +158,18 @@ let AccordionListItem = React.createClass({
<div className="col-xs-4 col-sm-3 col-md-2 col-lg-2 clear-paddings"> <div className="col-xs-4 col-sm-3 col-md-2 col-lg-2 clear-paddings">
<div className="thumbnail-wrapper"> <div className="thumbnail-wrapper">
<Link {...linkData}> <Link {...linkData}>
<img src={this.props.content.thumbnail} /> <img src={this.props.content.thumbnail}/>
</Link> </Link>
</div> </div>
</div> </div>
<div className="col-xs-8 col-sm-9 col-md-9 col-lg-9 col-md-offset-1 col-lg-offset-1 accordion-list-item-header"> <div
className="col-xs-8 col-sm-9 col-md-9 col-lg-9 col-md-offset-1 col-lg-offset-1 accordion-list-item-header">
<Link {...linkData}> <Link {...linkData}>
<h1 className="truncate">{this.props.content.title}</h1> <h1 className="truncate">{this.props.content.title}</h1>
</Link> </Link>
<h3>{getLangText('by %s', this.props.content.artist_name)}</h3> <h3>{getLangText('by %s', this.props.content.artist_name)}</h3>
<div> <div>
<span className="pull-left">{this.props.content.date_created.split('-')[0]}</span> <span className="pull-left">{this.props.content.date_created.split('-')[0]}</span>
@ -187,13 +194,15 @@ let AccordionListItem = React.createClass({
<button <button
disabled disabled
className="btn btn-default btn-xs pull-right"> className="btn btn-default btn-xs pull-right">
{getLangText('Submitted to prize')} <span className="glyphicon glyphicon-ok" aria-hidden="true"></span> {getLangText('Submitted to prize')} <span className="glyphicon glyphicon-ok"
aria-hidden="true"></span>
</button> </button>
</AclProxy> </AclProxy>
{this.getLicences()} {this.getLicences()}
</div> </div>
</div> </div>
<span style={{'clear': 'both'}}></span> <span style={{'clear': 'both'}}></span>
<div className="request-action-batch"> <div className="request-action-batch">
{this.getGlyphicon()} {this.getGlyphicon()}
</div> </div>

View File

@ -6,12 +6,8 @@ import Router from 'react-router';
import Row from 'react-bootstrap/lib/Row'; import Row from 'react-bootstrap/lib/Row';
import Col from 'react-bootstrap/lib/Col'; import Col from 'react-bootstrap/lib/Col';
import CollapsibleParagraph from './../ascribe_collapsible/collapsible_paragraph';
import DetailProperty from './detail_property'; import DetailProperty from './detail_property';
import FurtherDetails from './further_details';
import UserActions from '../../actions/user_actions'; import UserActions from '../../actions/user_actions';
import UserStore from '../../stores/user_store'; import UserStore from '../../stores/user_store';
@ -37,13 +33,15 @@ import GlobalNotificationActions from '../../actions/global_notification_actions
import { getLangText } from '../../utils/lang_utils'; import { getLangText } from '../../utils/lang_utils';
import { mergeOptions } from '../../utils/general_utils'; import { mergeOptions } from '../../utils/general_utils';
/** /**
* This is the component that implements display-specific functionality * This is the component that implements display-specific functionality
*/ */
let Piece = React.createClass({ let Piece = React.createClass({
propTypes: { propTypes: {
piece: React.PropTypes.object, piece: React.PropTypes.object,
loadPiece: React.PropTypes.func loadPiece: React.PropTypes.func,
children: React.PropTypes.object
}, },
mixins: [Router.Navigation], mixins: [Router.Navigation],
@ -159,20 +157,8 @@ let Piece = React.createClass({
</AclButtonList> </AclButtonList>
{this.getCreateEditionsDialog()} {this.getCreateEditionsDialog()}
{this.props.children}
<CollapsibleParagraph
title="Further Details"
show={this.props.piece.acl.acl_edit
|| Object.keys(this.props.piece.extra_data).length > 0
|| this.props.piece.other_data !== null}
defaultExpanded={true}>
<FurtherDetails
editable={this.props.piece.acl.acl_edit}
pieceId={this.props.piece.id}
extraData={this.props.piece.extra_data}
otherData={this.props.piece.other_data}
handleSuccess={this.props.loadPiece}/>
</CollapsibleParagraph>
</Col> </Col>
</Row> </Row>
); );

View File

@ -71,25 +71,31 @@ let PrizePieceDetails = React.createClass({
piece: React.PropTypes.object piece: React.PropTypes.object
}, },
render() { render() {
if (this.props.piece.prize && this.props.piece.prize.name){ if (this.props.piece.prize
&& this.props.piece.prize.name
&& Object.keys(this.props.piece.extra_data).length !== 0){
return ( return (
<CollapsibleParagraph <CollapsibleParagraph
title="Prize Details" title="Prize Details"
show={true} show={true}
defaultExpanded={true}> defaultExpanded={true}>
<Form <Form ref='form'>
ref='form'> {Object.keys(this.props.piece.extra_data).map((data) => {
<Property let label = data.replace('_', ' ');
name='test' return (
label='test' <Property
editable={false}> name={data}
<InputTextAreaToggable label={label}
rows={1} editable={false}>
editable={false} <InputTextAreaToggable
defaultValue='test'/> rows={1}
</Property> editable={false}
<hr /> defaultValue={this.props.piece.extra_data[data]}/>
</Form> </Property>);
}
)}
<hr />
</Form>
</CollapsibleParagraph> </CollapsibleParagraph>
); );
} }

View File

@ -28,12 +28,11 @@ export function getLangText(s, ...args) {
return formatText(languages['en-US'][s], args); return formatText(languages['en-US'][s], args);
} }
} catch(err) { } catch(err) {
if(!(s in languages[lang])) { //if(!(s in languages[lang])) {
console.warn('Language-string is not in constants file. Add: "' + s + '" to the "' + lang + '" language file. Defaulting to keyname'); console.warn('Language-string is not in constants file. Add: "' + s + '" to the "' + lang + '" language file. Defaulting to keyname');
return s; return s;
} else { //} else {
console.error(err); // console.error(err);
} //}
} }
} }