Skip to content

Commit

Permalink
ERM-1619: Actions menu doesn't display for Agreements (#793)
Browse files Browse the repository at this point in the history
* ERM-1619: change permission for tags pane as workaround

* ERM-1619: Aditya's solution for action menu

* ERM-1619: Fixing console error

* ERM-1619: Linting
  • Loading branch information
peterboehm authored and EthanFreestone committed Apr 21, 2021
1 parent 49fa286 commit 605cb9d
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions src/components/views/Agreement.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
collapseAllSections,
expandAllSections
} from '@folio/stripes/components';
import { AppIcon, IfPermission, TitleManager, withStripes } from '@folio/stripes/core';
import { AppIcon, TitleManager, withStripes } from '@folio/stripes/core';
import { NotesSmartAccordion } from '@folio/stripes/smart-components';
import SafeHTMLMessage from '@folio/react-intl-safe-html';
import DuplicateAgreementModal from '../DuplicateAgreementModal';
Expand Down Expand Up @@ -115,6 +115,7 @@ class Agreement extends React.Component {
if (stripes.hasPerm('ui-agreements.agreements.edit')) {
buttons.push(
<Button
key="clickable-dropdown-edit-agreement"
buttonStyle="dropdownItem"
id="clickable-dropdown-edit-agreement"
onClick={this.props.handlers.onEdit}
Expand All @@ -126,6 +127,7 @@ class Agreement extends React.Component {
);
buttons.push(
<Button
key="clickable-dropdown-duplicate-agreement"
buttonStyle="dropdownItem"
id="clickable-dropdown-duplicate-agreement"
onClick={() => {
Expand All @@ -143,6 +145,7 @@ class Agreement extends React.Component {
if (stripes.hasPerm('ui-agreements.agreements.view')) {
buttons.push(
<Button
key="clickable-dropdown-export-agreement"
buttonStyle="dropdownItem"
id="clickable-dropdown-export-agreement"
onClick={() => {
Expand All @@ -160,6 +163,7 @@ class Agreement extends React.Component {
if (stripes.hasPerm('ui-agreements.agreements.delete')) {
buttons.push(
<Button
key="clickable-dropdown-delete-agreement"
buttonStyle="dropdownItem"
id="clickable-dropdown-delete-agreement"
onClick={() => {
Expand Down Expand Up @@ -200,27 +204,25 @@ class Agreement extends React.Component {
const {
data: { agreement },
handlers,
stripes
} = this.props;

return (
<IfPermission perm="ui-agreements.agreements.edit">
<PaneMenu>
{handlers.onToggleTags &&
<FormattedMessage id="ui-agreements.agreements.showTags">
{ariaLabel => (
<IconButton
ariaLabel={ariaLabel}
badgeCount={agreement?.tags?.length ?? 0}
icon="tag"
id="clickable-show-tags"
onClick={handlers.onToggleTags}
/>
)}
</FormattedMessage>
}
</PaneMenu>
</IfPermission>
);
return stripes.hasPerm('ui-agreements.agreements.edit') ? (
<PaneMenu>
{handlers.onToggleTags &&
<FormattedMessage id="ui-agreements.agreements.showTags">
{ariaLabel => (
<IconButton
ariaLabel={ariaLabel}
badgeCount={agreement?.tags?.length ?? 0}
icon="tag"
id="clickable-show-tags"
onClick={handlers.onToggleTags}
/>
)}
</FormattedMessage>
}
</PaneMenu>
) : null;
}

render() {
Expand Down

0 comments on commit 605cb9d

Please sign in to comment.