1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

Add login-validation to actions DetailProperty in Edition and Piece detail view

This commit is contained in:
Tim Daubenschütz 2015-10-26 11:21:22 +01:00
parent 1f7addb886
commit d48da96e3b
2 changed files with 41 additions and 35 deletions

View File

@ -25,11 +25,11 @@ import LicenseDetail from './license_detail';
import FurtherDetails from './further_details';
import EditionActionPanel from './edition_action_panel';
import AclProxy from '../acl_proxy';
import Note from './note';
import ApiUrls from '../../constants/api_urls';
import AppConstants from '../../constants/application_constants';
import AscribeSpinner from '../ascribe_spinner';
import { getLangText } from '../../utils/lang_utils';
@ -211,13 +211,15 @@ let EditionSummary = React.createClass({
value={ edition.owner } />
<LicenseDetail license={edition.license_type}/>
{this.getStatus()}
<EditionDetailProperty
label={getLangText('ACTIONS')}>
<EditionActionPanel
edition={edition}
currentUser={currentUser}
handleSuccess={this.handleSuccess} />
</EditionDetailProperty>
<AclProxy show={currentUser && currentUser.email}>
<EditionDetailProperty
label={getLangText('ACTIONS')}>
<EditionActionPanel
edition={edition}
currentUser={currentUser}
handleSuccess={this.handleSuccess} />
</EditionDetailProperty>
</AclProxy>
<hr/>
</div>
);

View File

@ -28,6 +28,7 @@ import CreateEditionsButton from '../ascribe_buttons/create_editions_button';
import DeleteButton from '../ascribe_buttons/delete_button';
import AclInformation from '../ascribe_buttons/acl_information';
import AclProxy from '../acl_proxy';
import ListRequestActions from '../ascribe_forms/list_form_request_actions';
@ -181,38 +182,41 @@ let PieceContainer = React.createClass({
},
getActions() {
if (this.state.piece &&
this.state.piece.notifications &&
this.state.piece.notifications.length > 0) {
const { piece, currentUser } = this.state;
if (piece && piece.notifications && piece.notifications.length > 0) {
return (
<ListRequestActions
pieceOrEditions={this.state.piece}
currentUser={this.state.currentUser}
pieceOrEditions={piece}
currentUser={currentUser}
handleSuccess={this.loadPiece}
notifications={this.state.piece.notifications}/>);
notifications={piece.notifications}/>);
} else {
return (
<DetailProperty label={getLangText('ACTIONS')}>
<AclButtonList
className="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}/>
<AclInformation
aim="button"
verbs={['acl_share', 'acl_create_editions', 'acl_loan', 'acl_delete', 'acl_consign']}
aclObject={this.state.piece.acl}/>
</AclButtonList>
</DetailProperty>
<AclProxy
show={currentUser && currentUser.email}>
<DetailProperty label={getLangText('ACTIONS')}>
<AclButtonList
className="ascribe-button-list"
availableAcls={piece.acl}
editions={piece}
handleSuccess={this.loadPiece}>
<CreateEditionsButton
label={getLangText('CREATE EDITIONS')}
className="btn-sm"
piece={piece}
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
onPollingSuccess={this.handlePollingSuccess}/>
<DeleteButton
handleSuccess={this.handleDeleteSuccess}
piece={piece}/>
<AclInformation
aim="button"
verbs={['acl_share', 'acl_create_editions', 'acl_loan', 'acl_delete', 'acl_consign']}
aclObject={piece.acl}/>
</AclButtonList>
</DetailProperty>
</AclProxy>
);
}
},