mirror of
https://github.com/ascribe/onion.git
synced 2025-01-05 11:25:09 +01:00
switch between request action and acl buttons on piece detail page
This commit is contained in:
parent
8b6c5e6e0f
commit
7a09b863b5
@ -26,6 +26,8 @@ import CreateEditionsForm from '../ascribe_forms/create_editions_form';
|
|||||||
import CreateEditionsButton from '../ascribe_buttons/create_editions_button';
|
import CreateEditionsButton from '../ascribe_buttons/create_editions_button';
|
||||||
import DeleteButton from '../ascribe_buttons/delete_button';
|
import DeleteButton from '../ascribe_buttons/delete_button';
|
||||||
|
|
||||||
|
import RequestActionForm from '../ascribe_forms/form_request_action';
|
||||||
|
|
||||||
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';
|
||||||
|
|
||||||
@ -148,6 +150,34 @@ let PieceContainer = React.createClass({
|
|||||||
return {'id': this.state.piece.id};
|
return {'id': this.state.piece.id};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getActions(){
|
||||||
|
if (this.state.piece.request_action && this.state.piece.request_action.length > 0) {
|
||||||
|
return (
|
||||||
|
<RequestActionForm
|
||||||
|
currentUser={this.state.currentUser}
|
||||||
|
editions={ [this.state.piece] }
|
||||||
|
handleSuccess={this.showNotification}/>);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (
|
||||||
|
<AclButtonList
|
||||||
|
className="text-center ascribe-button-list"
|
||||||
|
availableAcls={this.state.piece.acl}
|
||||||
|
editions={this.state.piece}
|
||||||
|
handleSuccess={this.loadPiece}>
|
||||||
|
<CreateEditionsButton
|
||||||
|
label={getLangText('CREATE EDITIONS')}
|
||||||
|
className="btn-sm"
|
||||||
|
piece={this.state.piece}
|
||||||
|
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
|
||||||
|
onPollingSuccess={this.handlePollingSuccess}/>
|
||||||
|
<DeleteButton
|
||||||
|
handleSuccess={this.handleDeleteSuccess}
|
||||||
|
piece={this.state.piece}/>
|
||||||
|
</AclButtonList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
render() {
|
render() {
|
||||||
if('title' in this.state.piece) {
|
if('title' in this.state.piece) {
|
||||||
return (
|
return (
|
||||||
@ -170,23 +200,7 @@ let PieceContainer = React.createClass({
|
|||||||
<DetailProperty label={getLangText('ID')} value={ this.state.piece.bitcoin_id } ellipsis={true} />
|
<DetailProperty label={getLangText('ID')} value={ this.state.piece.bitcoin_id } ellipsis={true} />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
buttons={
|
buttons={this.getActions()}>
|
||||||
<AclButtonList
|
|
||||||
className="text-center ascribe-button-list"
|
|
||||||
availableAcls={this.state.piece.acl}
|
|
||||||
editions={this.state.piece}
|
|
||||||
handleSuccess={this.loadPiece}>
|
|
||||||
<CreateEditionsButton
|
|
||||||
label={getLangText('CREATE EDITIONS')}
|
|
||||||
className="btn-sm"
|
|
||||||
piece={this.state.piece}
|
|
||||||
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
|
|
||||||
onPollingSuccess={this.handlePollingSuccess}/>
|
|
||||||
<DeleteButton
|
|
||||||
handleSuccess={this.handleDeleteSuccess}
|
|
||||||
piece={this.state.piece}/>
|
|
||||||
</AclButtonList>
|
|
||||||
}>
|
|
||||||
{this.getCreateEditionsDialog()}
|
{this.getCreateEditionsDialog()}
|
||||||
|
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
|
Loading…
Reference in New Issue
Block a user