mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Add login-validation to actions DetailProperty in Edition and Piece detail view
This commit is contained in:
parent
1f7addb886
commit
d48da96e3b
js/components/ascribe_detail
@ -25,11 +25,11 @@ import LicenseDetail from './license_detail';
|
|||||||
import FurtherDetails from './further_details';
|
import FurtherDetails from './further_details';
|
||||||
|
|
||||||
import EditionActionPanel from './edition_action_panel';
|
import EditionActionPanel from './edition_action_panel';
|
||||||
|
import AclProxy from '../acl_proxy';
|
||||||
|
|
||||||
import Note from './note';
|
import Note from './note';
|
||||||
|
|
||||||
import ApiUrls from '../../constants/api_urls';
|
import ApiUrls from '../../constants/api_urls';
|
||||||
import AppConstants from '../../constants/application_constants';
|
|
||||||
import AscribeSpinner from '../ascribe_spinner';
|
import AscribeSpinner from '../ascribe_spinner';
|
||||||
|
|
||||||
import { getLangText } from '../../utils/lang_utils';
|
import { getLangText } from '../../utils/lang_utils';
|
||||||
@ -211,13 +211,15 @@ let EditionSummary = React.createClass({
|
|||||||
value={ edition.owner } />
|
value={ edition.owner } />
|
||||||
<LicenseDetail license={edition.license_type}/>
|
<LicenseDetail license={edition.license_type}/>
|
||||||
{this.getStatus()}
|
{this.getStatus()}
|
||||||
<EditionDetailProperty
|
<AclProxy show={currentUser && currentUser.email}>
|
||||||
label={getLangText('ACTIONS')}>
|
<EditionDetailProperty
|
||||||
<EditionActionPanel
|
label={getLangText('ACTIONS')}>
|
||||||
edition={edition}
|
<EditionActionPanel
|
||||||
currentUser={currentUser}
|
edition={edition}
|
||||||
handleSuccess={this.handleSuccess} />
|
currentUser={currentUser}
|
||||||
</EditionDetailProperty>
|
handleSuccess={this.handleSuccess} />
|
||||||
|
</EditionDetailProperty>
|
||||||
|
</AclProxy>
|
||||||
<hr/>
|
<hr/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -28,6 +28,7 @@ import CreateEditionsButton from '../ascribe_buttons/create_editions_button';
|
|||||||
import DeleteButton from '../ascribe_buttons/delete_button';
|
import DeleteButton from '../ascribe_buttons/delete_button';
|
||||||
|
|
||||||
import AclInformation from '../ascribe_buttons/acl_information';
|
import AclInformation from '../ascribe_buttons/acl_information';
|
||||||
|
import AclProxy from '../acl_proxy';
|
||||||
|
|
||||||
import ListRequestActions from '../ascribe_forms/list_form_request_actions';
|
import ListRequestActions from '../ascribe_forms/list_form_request_actions';
|
||||||
|
|
||||||
@ -181,38 +182,41 @@ let PieceContainer = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getActions() {
|
getActions() {
|
||||||
if (this.state.piece &&
|
const { piece, currentUser } = this.state;
|
||||||
this.state.piece.notifications &&
|
|
||||||
this.state.piece.notifications.length > 0) {
|
if (piece && piece.notifications && piece.notifications.length > 0) {
|
||||||
return (
|
return (
|
||||||
<ListRequestActions
|
<ListRequestActions
|
||||||
pieceOrEditions={this.state.piece}
|
pieceOrEditions={piece}
|
||||||
currentUser={this.state.currentUser}
|
currentUser={currentUser}
|
||||||
handleSuccess={this.loadPiece}
|
handleSuccess={this.loadPiece}
|
||||||
notifications={this.state.piece.notifications}/>);
|
notifications={piece.notifications}/>);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<DetailProperty label={getLangText('ACTIONS')}>
|
<AclProxy
|
||||||
<AclButtonList
|
show={currentUser && currentUser.email}>
|
||||||
className="ascribe-button-list"
|
<DetailProperty label={getLangText('ACTIONS')}>
|
||||||
availableAcls={this.state.piece.acl}
|
<AclButtonList
|
||||||
editions={this.state.piece}
|
className="ascribe-button-list"
|
||||||
handleSuccess={this.loadPiece}>
|
availableAcls={piece.acl}
|
||||||
<CreateEditionsButton
|
editions={piece}
|
||||||
label={getLangText('CREATE EDITIONS')}
|
handleSuccess={this.loadPiece}>
|
||||||
className="btn-sm"
|
<CreateEditionsButton
|
||||||
piece={this.state.piece}
|
label={getLangText('CREATE EDITIONS')}
|
||||||
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
|
className="btn-sm"
|
||||||
onPollingSuccess={this.handlePollingSuccess}/>
|
piece={piece}
|
||||||
<DeleteButton
|
toggleCreateEditionsDialog={this.toggleCreateEditionsDialog}
|
||||||
handleSuccess={this.handleDeleteSuccess}
|
onPollingSuccess={this.handlePollingSuccess}/>
|
||||||
piece={this.state.piece}/>
|
<DeleteButton
|
||||||
<AclInformation
|
handleSuccess={this.handleDeleteSuccess}
|
||||||
aim="button"
|
piece={piece}/>
|
||||||
verbs={['acl_share', 'acl_create_editions', 'acl_loan', 'acl_delete', 'acl_consign']}
|
<AclInformation
|
||||||
aclObject={this.state.piece.acl}/>
|
aim="button"
|
||||||
</AclButtonList>
|
verbs={['acl_share', 'acl_create_editions', 'acl_loan', 'acl_delete', 'acl_consign']}
|
||||||
</DetailProperty>
|
aclObject={piece.acl}/>
|
||||||
|
</AclButtonList>
|
||||||
|
</DetailProperty>
|
||||||
|
</AclProxy>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user