From fd2f99f1b09b017afeb314650475ddb8c6c6af93 Mon Sep 17 00:00:00 2001 From: diminator Date: Mon, 13 Jul 2015 20:16:08 +0200 Subject: [PATCH] acl indexof --- js/components/ascribe_buttons/acl_button.js | 2 +- .../ascribe_buttons/create_editions_button.js | 2 +- js/components/ascribe_buttons/delete_button.js | 4 ++-- js/components/ascribe_detail/edition.js | 14 +++++++------- js/components/ascribe_detail/piece.js | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/js/components/ascribe_buttons/acl_button.js b/js/components/ascribe_buttons/acl_button.js index e9d2aa2a..f5067e1f 100644 --- a/js/components/ascribe_buttons/acl_button.js +++ b/js/components/ascribe_buttons/acl_button.js @@ -120,7 +120,7 @@ ${this.props.currentUser.username} }, render() { - let shouldDisplay = this.props.availableAcls.indexOf(this.props.action) > -1; + let shouldDisplay = this.props.availableAcls[this.props.action]; let aclProps = this.actionProperties(); return ( 0){ + if (availableAcls.editions || piece.num_editions > 0){ return null; } diff --git a/js/components/ascribe_buttons/delete_button.js b/js/components/ascribe_buttons/delete_button.js index 0c9ef154..2f46b0ea 100644 --- a/js/components/ascribe_buttons/delete_button.js +++ b/js/components/ascribe_buttons/delete_button.js @@ -41,11 +41,11 @@ let DeleteButton = React.createClass({ let btnDelete = null; let content = null; - if (availableAcls.indexOf('delete') > -1) { + if (availableAcls.delete) { content = ; btnDelete = ; } - else if (availableAcls.indexOf('del_from_collection') > -1){ + else if (availableAcls.unshare){ content = ; btnDelete = ; } diff --git a/js/components/ascribe_detail/edition.js b/js/components/ascribe_detail/edition.js index a47f2148..0edcf4b8 100644 --- a/js/components/ascribe_detail/edition.js +++ b/js/components/ascribe_detail/edition.js @@ -85,7 +85,7 @@ let Edition = React.createClass({ -1}> + show={this.props.edition.acl.acl_coa}> @@ -114,7 +114,7 @@ let Edition = React.createClass({ -1 || this.props.edition.public_note)}> + (this.props.edition.acl.acl_edit || this.props.edition.public_note)}> -1 + show={this.props.edition.acl.acl_edit || Object.keys(this.props.edition.extra_data).length > 0 || this.props.edition.other_data !== null}> -1} + editable={this.props.edition.acl.acl_edit} pieceId={this.props.edition.parent} extraData={this.props.edition.extra_data} otherData={this.props.edition.other_data} @@ -170,7 +170,7 @@ let EditionSummary = React.createClass({ if (this.props.edition.status.length > 0){ let statusStr = this.props.edition.status.join().replace(/_/, ' '); status = ; - if (this.props.edition.pending_new_owner && this.props.edition.acl.indexOf('withdraw_transfer') > -1){ + if (this.props.edition.pending_new_owner && this.props.edition.acl.acl_withdraw_transfer){ status = (
-1; - if (this.props.edition.acl.indexOf('edit') > -1 || this.props.edition.public_note){ + let isEditable = this.props.edition.acl.acl_edit; + if (isEditable || this.props.edition.public_note){ return ( -1 + show={this.props.piece.acl.acl_edit || Object.keys(this.props.piece.extra_data).length > 0 || this.props.piece.other_data !== null} defaultExpanded={true}> -1} + editable={this.props.piece.acl.acl_edit} pieceId={this.props.piece.id} extraData={this.props.piece.extra_data} otherData={this.props.piece.other_data}