mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +01:00
adjust acl proxy
This commit is contained in:
parent
d183b9ba1c
commit
8f386dc0cf
@ -15,22 +15,31 @@ let AclProxy = React.createClass({
|
||||
React.PropTypes.arrayOf(React.PropTypes.element),
|
||||
React.PropTypes.element
|
||||
]).isRequired,
|
||||
aclObject: React.PropTypes.object.isRequired,
|
||||
aclName: React.PropTypes.string.isRequired
|
||||
aclObject: React.PropTypes.object,
|
||||
aclName: React.PropTypes.string,
|
||||
show: React.PropTypes.bool
|
||||
},
|
||||
|
||||
render() {
|
||||
if(this.props.aclObject[this.props.aclName]) {
|
||||
if(this.props.show) {
|
||||
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.');
|
||||
if(this.props.aclObject[this.props.aclName]) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -16,6 +16,9 @@ import EditionListActions from '../../actions/edition_list_actions';
|
||||
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||
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';
|
||||
|
||||
let Link = Router.Link;
|
||||
@ -125,6 +128,20 @@ let AccordionListItem = React.createClass({
|
||||
piece={this.props.content}
|
||||
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
|
||||
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>
|
||||
<span style={{'clear': 'both'}}></span>
|
||||
|
23
js/components/ascribe_buttons/submit_to_prize_button.js
Normal file
23
js/components/ascribe_buttons/submit_to_prize_button.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user