mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
Making AclInformation more robust by adding checks for if the information to display is available
This commit is contained in:
parent
738e94a43d
commit
8417c2781e
@ -32,8 +32,8 @@ let AclInformation = React.createClass({
|
||||
getInfoText(title, info, example){
|
||||
let aim = this.props.aim;
|
||||
|
||||
if (aim) {
|
||||
if (aim === 'form') {
|
||||
if(aim) {
|
||||
if(aim === 'form') {
|
||||
return (
|
||||
<p>
|
||||
<span className="info">
|
||||
@ -45,7 +45,7 @@ let AclInformation = React.createClass({
|
||||
</p>
|
||||
);
|
||||
}
|
||||
else if (aim === 'button') {
|
||||
else if(aim === 'button') {
|
||||
return (
|
||||
<p>
|
||||
<span className="title">
|
||||
@ -70,11 +70,15 @@ let AclInformation = React.createClass({
|
||||
const { titles, informationSentences, exampleSentences } = InformationTexts;
|
||||
const { verbs, aim } = this.props;
|
||||
|
||||
const availableInformations = intersectAcls(verbs, Object.keys(titles));
|
||||
|
||||
// sorting is not needed, as `this.props.verbs` takes care of sorting already
|
||||
// So we assume a user of `AclInformationButton` puts an ordered version of
|
||||
// `verbs` into `propTypes`
|
||||
let verbsToDisplay = [];
|
||||
if(aim === 'form') {
|
||||
|
||||
|
||||
if(aim === 'form' && availableInformations.length > 0) {
|
||||
verbsToDisplay = verbsToDisplay.concat(verbs);
|
||||
} else if(aim === 'button' && this.props.aclObject) {
|
||||
const { aclObject } = this.props;
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
export const InformationTexts = {
|
||||
'titles': {
|
||||
'acl_transfer': 'TRANSFER',
|
||||
'acl_consign': 'CONSIGN',
|
||||
'acl_loan': 'LOAN',
|
||||
'acl_share': 'SHARE',
|
||||
@ -12,8 +11,6 @@ export const InformationTexts = {
|
||||
'acl_request_unconsign': 'REQUEST UNCONSIGN'
|
||||
},
|
||||
'informationSentences': {
|
||||
'acl_transfer': ' - Changes ownership of an Edition. As with a physical piece of work, ' +
|
||||
'transferring ownership of an Edition does not transfer copyright in the Work.',
|
||||
'acl_consign': ' - Lets someone represent you in dealing with the work, under the terms you agree to.',
|
||||
'acl_loan': ' - Lets someone use or put the Work on display for a limited amount of time.',
|
||||
'acl_share': ' - Lets someone view the Work or Edition, but does not give rights to publish or display it.',
|
||||
@ -24,7 +21,6 @@ export const InformationTexts = {
|
||||
'acl_request_unconsign': 'Lets the owner ask the consignee to confirm that they will no longer manage the work.'
|
||||
},
|
||||
'exampleSentences': {
|
||||
'acl_transfer': '(e.g. a musician Transfers limited edition 1 of 10 of her new album to a very happy fan)',
|
||||
'acl_consign': '(e.g. an artist Consigns 10 Editions of her new Work to a gallery ' +
|
||||
'so the gallery can sell them on her behalf, under the terms the artist and the gallery have agreed to)',
|
||||
'acl_loan': '(e.g. a collector Loans a Work to a gallery for one month for display in the gallery\'s show)',
|
||||
|
Loading…
Reference in New Issue
Block a user