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 authored and blcham committed Dec 17, 2023
1 parent 4ce6727 commit c5977e1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions js/components/record/Records.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
'use strict';

import React from "react";
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";
import ExportRecordsDropdown from "./ExportRecordsDropdown";

const STUDY_CLOSED_FOR_ADDITION = false;
Expand Down Expand Up @@ -35,6 +38,9 @@ class Records extends React.Component {
const showCreateButton = STUDY_CREATE_AT_MOST_ONE_RECORD
? (!recordsLoaded.records || (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 @@ -54,11 +60,14 @@ class Records extends React.Component {
<RecordTable {...this.props}/>
<div className="d-flex justify-content-between">
{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}
<ExportRecordsDropdown onExport={this.props.handlers.onExport} records={recordsLoaded.records}/>
</div>
{showAlert && recordDeleted.status === ACTION_STATUS.ERROR &&
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 c5977e1

Please sign in to comment.