Skip to content

Commit

Permalink
[New #18] Added Publish button for Admin Operator
Browse files Browse the repository at this point in the history
  • Loading branch information
LaChope committed Nov 30, 2023
1 parent dddfdb9 commit fec9dfb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions js/components/record/Records.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import {Button, Card} from "react-bootstrap";
import {injectIntl} from "react-intl";
import withI18n from "../../i18n/withI18n";
import RecordTable from "./RecordTable";
import {ACTION_STATUS, ALERT_TYPES, ROLE} from "../../constants/DefaultConstants";
import {ACTION_STATUS, ALERT_TYPES, EXTENSION_CONSTANTS, ROLE} from "../../constants/DefaultConstants";
import AlertMessage from "../AlertMessage";
import {LoaderSmall} from "../Loader";
import PropTypes from "prop-types";
import {processTypeaheadOptions} from "./TypeaheadAnswer";
import {EXTENSIONS} from "../../../config";

const STUDY_CLOSED_FOR_ADDITION = false;
const STUDY_CREATE_AT_MOST_ONE_RECORD = false;
Expand All @@ -36,6 +37,9 @@ class Records extends React.Component {
const showCreateButton = STUDY_CREATE_AT_MOST_ONE_RECORD
? (!this.props.recordsLoaded.records || (this.props.recordsLoaded.records.length < 1))
: true;
const showPublishButton =
this.props.currentUser.role === ROLE.ADMIN
&& EXTENSIONS === EXTENSION_CONSTANTS.OPERATOR;
const createRecordDisabled =
STUDY_CLOSED_FOR_ADDITION
&& (!this._isAdmin());
Expand All @@ -55,11 +59,14 @@ class Records extends React.Component {
<RecordTable {...this.props}/>
<div>
{showCreateButton
? <Button variant='primary' size='sm'
? <Button className="mx-1" variant='primary' size='sm'
disabled={createRecordDisabled}
title={createRecordTooltip}
onClick={onCreateWithFormTemplate}>{this.i18n('records.create-tile')}</Button>
: null}
{showPublishButton ?
<Button className="mx-1" variant='success' size='sm'>{this.i18n('publish')}</Button>
: null}
</div>
{showAlert && recordDeleted.status === ACTION_STATUS.ERROR &&
<AlertMessage type={ALERT_TYPES.DANGER}
Expand Down
1 change: 1 addition & 0 deletions js/i18n/cs.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default {
'reject': 'Odmítnout',
'accept':'Přijmout',
'complete': 'Dokončit',
'publish': 'Publikovat',

'login.title': Constants.APP_NAME + ' - Přihlášení',
'login.username': 'Uživatelské jméno',
Expand Down
1 change: 1 addition & 0 deletions js/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export default {
'reject': 'Reject',
'accept':'Accept',
'complete': 'Complete',
'publish': 'Publish',

'login.title': Constants.APP_NAME + ' - Login',
'login.username': 'Username',
Expand Down

0 comments on commit fec9dfb

Please sign in to comment.