mirror of
https://github.com/ascribe/onion.git
synced 2024-06-30 13:41:57 +02:00
Merge remote-tracking branch 'remotes/origin/AD-996-add-action-buttons-to-piece-detai' into AD-943-add-custom-additional-fields
This commit is contained in:
commit
a8976ca54a
|
@ -13,6 +13,12 @@ let IkonotvSubmitButton = React.createClass({
|
||||||
piece: React.PropTypes.object.isRequired
|
piece: React.PropTypes.object.isRequired
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getDefaultProps() {
|
||||||
|
return {
|
||||||
|
className: 'btn-xs'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let piece = this.props.piece;
|
let piece = this.props.piece;
|
||||||
let startFrom = 1;
|
let startFrom = 1;
|
||||||
|
@ -34,7 +40,7 @@ let IkonotvSubmitButton = React.createClass({
|
||||||
'start_from': startFrom,
|
'start_from': startFrom,
|
||||||
'piece_id': piece.id
|
'piece_id': piece.id
|
||||||
}}
|
}}
|
||||||
className={classNames('btn', 'btn-default', 'btn-xs', this.props.className)}>
|
className={classNames('btn', 'btn-default', this.props.className)}>
|
||||||
{getLangText('Loan to IkonoTV')}
|
{getLangText('Loan to IkonoTV')}
|
||||||
</ButtonLink>
|
</ButtonLink>
|
||||||
);
|
);
|
||||||
|
|
|
@ -11,6 +11,11 @@ import Piece from '../../../../../../components/ascribe_detail/piece';
|
||||||
|
|
||||||
import AppConstants from '../../../../../../constants/application_constants';
|
import AppConstants from '../../../../../../constants/application_constants';
|
||||||
|
|
||||||
|
import ListRequestActions from '../../../../../ascribe_forms/list_form_request_actions';
|
||||||
|
import AclButtonList from '../../../../../ascribe_buttons/acl_button_list';
|
||||||
|
import DeleteButton from '../../../../../ascribe_buttons/delete_button';
|
||||||
|
import IkonotvSubmitButton from '../ascribe_buttons/ikonotv_submit_button';
|
||||||
|
|
||||||
import Form from '../../../../../../components/ascribe_forms/form';
|
import Form from '../../../../../../components/ascribe_forms/form';
|
||||||
import Property from '../../../../../../components/ascribe_forms/property';
|
import Property from '../../../../../../components/ascribe_forms/property';
|
||||||
import InputTextAreaToggable from '../../../../../../components/ascribe_forms/input_textarea_toggable';
|
import InputTextAreaToggable from '../../../../../../components/ascribe_forms/input_textarea_toggable';
|
||||||
|
@ -21,6 +26,8 @@ import Note from '../../../../../ascribe_detail/note';
|
||||||
|
|
||||||
import DetailProperty from '../../../../../ascribe_detail/detail_property';
|
import DetailProperty from '../../../../../ascribe_detail/detail_property';
|
||||||
|
|
||||||
|
import AclProxy from '../../../../../acl_proxy';
|
||||||
|
|
||||||
import ApiUrls from '../../../../../../constants/api_urls';
|
import ApiUrls from '../../../../../../constants/api_urls';
|
||||||
|
|
||||||
import { getLangText } from '../../../../../../utils/lang_utils';
|
import { getLangText } from '../../../../../../utils/lang_utils';
|
||||||
|
@ -66,6 +73,50 @@ let IkonotvPieceContainer = React.createClass({
|
||||||
PieceActions.fetchOne(this.props.params.pieceId);
|
PieceActions.fetchOne(this.props.params.pieceId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getActions(){
|
||||||
|
if (this.state.piece &&
|
||||||
|
this.state.piece.notifications &&
|
||||||
|
this.state.piece.notifications.length > 0) {
|
||||||
|
return (
|
||||||
|
<ListRequestActions
|
||||||
|
pieceOrEditions={this.state.piece}
|
||||||
|
currentUser={this.state.currentUser}
|
||||||
|
handleSuccess={this.loadPiece}
|
||||||
|
notifications={this.state.piece.notifications}/>);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
//We need to disable the normal acl_loan because we're inserting a custom acl_loan button
|
||||||
|
let availableAcls;
|
||||||
|
|
||||||
|
if(this.state.piece && this.state.piece.acl && typeof this.state.piece.acl.acl_loan !== 'undefined') {
|
||||||
|
// make a copy to not have side effects
|
||||||
|
availableAcls = mergeOptions({}, this.state.piece.acl);
|
||||||
|
availableAcls.acl_loan = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AclButtonList
|
||||||
|
className="text-center ascribe-button-list"
|
||||||
|
availableAcls={availableAcls}
|
||||||
|
editions={this.state.piece}
|
||||||
|
handleSuccess={this.loadPiece}>
|
||||||
|
<AclProxy
|
||||||
|
aclObject={availableAcls}
|
||||||
|
aclName="acl_submit">
|
||||||
|
<IkonotvSubmitButton
|
||||||
|
className="btn-sm"
|
||||||
|
handleSuccess={this.handleSubmitSuccess}
|
||||||
|
piece={this.state.piece}/>
|
||||||
|
</AclProxy>
|
||||||
|
<DeleteButton
|
||||||
|
handleSuccess={this.handleDeleteSuccess}
|
||||||
|
piece={this.state.piece}/>
|
||||||
|
</AclButtonList>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if(this.state.piece && this.state.piece.title) {
|
if(this.state.piece && this.state.piece.title) {
|
||||||
return (
|
return (
|
||||||
|
@ -88,7 +139,7 @@ let IkonotvPieceContainer = React.createClass({
|
||||||
<hr/>
|
<hr/>
|
||||||
</div>
|
</div>
|
||||||
}>
|
}>
|
||||||
|
{this.getActions()}
|
||||||
<CollapsibleParagraph
|
<CollapsibleParagraph
|
||||||
title={getLangText('Loan History')}
|
title={getLangText('Loan History')}
|
||||||
show={this.state.piece.loan_history && this.state.piece.loan_history.length > 0}>
|
show={this.state.piece.loan_history && this.state.piece.loan_history.length > 0}>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user