Commit 2634437f authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '371-partner-label' into 'master'

Resolve "Partner label"

Closes #371

See merge request !302
parents 8b0e01ea b40c0797
Pipeline #6844 passed with stages
in 5 minutes and 32 seconds
......@@ -23,8 +23,8 @@
"descriptor_plural": "Descriptors",
"descriptorlist": "Crop descriptor",
"descriptorlist_plural": "Crop descriptors",
"partner": "Partner",
"partner_plural": "Partners",
"partner": "Data provider",
"partner_plural": "Data providers",
"vocabulary": "Controlled vocabulary",
"vocabulary_plural": "Controlled vocabularies",
"metadata": "Record metadata"
......@@ -44,7 +44,7 @@
"Home": "Home",
"My Dashboard": "My dashboard",
"My profile": "My profile",
"Partners": "Partners",
"Partners": "Data providers",
"Data providers": "Data providers"
},
"p": {
......@@ -61,7 +61,7 @@
},
"datasets": {
"title": "Datasets",
"subtitle": "Datasets published by Genesys partners"
"subtitle": "Datasets published by Genesys data providers"
},
"descriptorlists": {
"title": "Descriptor lists",
......@@ -80,8 +80,8 @@
"wiewsCodes": "FAO WIEWS codes"
},
"partners": {
"title": "Genesys Partners",
"subtitle": "Partners in the Catalog of Phenotypic Datasets"
"title": "Genesys Data providers",
"subtitle": "Data providers in the Catalog of Phenotypic Datasets"
},
"userprofile": {
"title": "User profile",
......@@ -90,6 +90,17 @@
"vocab": {
"subtitle": "Commonly used controlled vocabularies",
"title": "Vocabularies"
},
"editPartner": {
"name": {
"new": "New data provider",
"label": "Data provider name",
"placeholder": "Data provider name"
},
"description": {
"placeholder": "Data provider introduction text (markdown)"
},
"websites": "Data provider websites"
}
},
"stats": {
......@@ -98,10 +109,10 @@
"Browse datasets": "Explore datasets",
"Browse descriptor lists": "Browse descriptor lists",
"Browse descriptors": "Browse descriptors",
"Browse partners": "Browse partners",
"Browse partners": "Browse data providers",
"Descriptors": "Descriptor definitions",
"Descriptor lists": "Descriptor lists",
"Partners": "Partners",
"Partners": "Data providers",
"Phenotypic datasets": "C&E Datasets"
},
"welcome": {
......@@ -134,7 +145,8 @@
"DIGITIZER": "Digitizes data.",
"CURATOR": "Organizes and validates data and metadata in correct format, ensures quality of both."
}
}
},
"contact": "Data provider contact information"
},
"search": {
"group": {
......@@ -179,11 +191,20 @@
"name": "Name",
"shortName": "Short name"
},
"partners" : {
"partners": "Data providers",
"acronym": "Acronym",
"title": "Title",
"description": "Description",
"ICRISAT": "ICRISAT",
"international": "International",
"partnerDescription": "Data provider description"
},
"descriptorList": {
"_text": "Keywords",
"description": "Description",
"owner": {
"uuid": "Partner"
"uuid": "Data provider"
},
"published": "Published",
"publisher": "Publisher",
......@@ -198,7 +219,7 @@
"uuid": "Descriptor list"
},
"owner": {
"uuid": "Partner"
"uuid": "Data provider"
},
"published": "Published",
"uom": "UOM",
......@@ -240,6 +261,43 @@
"600": "GMO",
"999": "Other"
}
},
"sortOptions": {
"Partner name": "Data provider name",
"Acronym": "Acronym",
"Created date": "Created date",
"Last updated": "Last updated",
"Accession count (low to high)": "Accession count (low to high)",
"Accession count (high to low)": "Accession count (high to low)",
"Descriptor count (low to high)": "Descriptor count (low to high)",
"Descriptor count (high to low)": "Descriptor count (high to low)",
"Experiment end date": "Experiment end date",
"Experiment start date": "Experiment start date",
"Version": "Version",
"Title": "Title",
"Bibliographic citation": "Bibliographic citation",
"Crop": "Crop",
"Maintainer": "Maintainer",
"Publisher": "Publisher",
"Last update (newest first)": "Last update (newest first)",
"Last modified date (oldest first)": "Last modified date (oldest first)",
"Unit of measure": "Unit of measure",
"Key": "Key",
"Data type": "Data type",
"Column name": "Column name",
"Latest edit": "Latest edit",
"Owner": "Owner",
"URL": "URL"
},
"selectPartner": {
"label": {
"Data provider": "Data provider",
"Partner": "Data provider",
"Select partner": "Select data provider",
"Select Partner": "Select data provider",
"Select owner": "Select owner"
},
"select": "Select data provider"
}
}
}
......@@ -358,7 +358,7 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<Divider/>
<div className="pt-15 pb-15 pl-20 pr-20">
<h4 className="font-bold m-0">
Partner contact information
{ t('dataset.contact') }
</h4>
</div>
<Divider/>
......
......@@ -2,6 +2,7 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { withStyles } from '@material-ui/core/styles';
import { translate } from 'react-i18next';
import {log} from 'utilities/debug';
import { parse } from 'query-string';
......@@ -114,13 +115,12 @@ class PartnerListPage extends React.Component<IBrowsePageProps, any> {
public render() {
const { paged, pagination } = this.props;
const { paged, pagination, t } = this.props;
const stillLoading: boolean = (! paged || ! paged.content);
return (
<PageLayout sidebar={
<PartnerFilters initialValues={ pagination.filter } onSubmit={ this.applyFilters }/>
<PartnerFilters initialValues={ pagination.filter } onSubmit={ this.applyFilters } t={ t }/>
}>
<ScrollToTopOnMount />
<ContentHeader title="Genesys data providers" subtitle="Partners in the Catalog of Phenotypic Datasets" />
......@@ -175,4 +175,4 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
filterCodeToUrl,
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(PartnerListPage));
export default translate()(connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(PartnerListPage)));
......@@ -2,6 +2,7 @@
import * as React from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import { translate } from 'react-i18next';
import {savePartner} from 'partners/actions/editor';
import {loadPartner} from 'partners/actions/dashboard';
......@@ -19,6 +20,7 @@ interface IPartnerEditPageProps extends React.ClassAttributes<any> {
partner?: Partner;
loadPartner: any;
savePartner: any;
t: any;
}
// Page to edit a descriptor list
......@@ -43,6 +45,7 @@ class PartnerEditPage extends React.Component<IPartnerEditPageProps, any> {
}
public render() {
const { t } = this.props;
let { partner } = this.props;
if (! partner) {
......@@ -54,7 +57,8 @@ class PartnerEditPage extends React.Component<IPartnerEditPageProps, any> {
<Grid item xs={ 12 }>
<Paper className="p-20">
<PartnerForm initialValues={ partner }
onSubmit={ this.onSave } />
onSubmit={ this.onSave }
t={ t }/>
</Paper>
</Grid>
</PageLayout>
......@@ -72,4 +76,4 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
savePartner,
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(PartnerEditPage);
export default translate()(connect(mapStateToProps, mapDispatchToProps)(PartnerEditPage));
......@@ -8,12 +8,26 @@ import CollapsibleComponentSearch from 'ui/common/filter/CollapsibleComponentSea
import StringFilter from 'ui/common/filter/StringFilter';
import StringArrFilter from 'ui/common/filter/StringArrFilter';
const PartnerFilters = ({handleSubmit, initialValues, initialize, ...other}) => (
<FiltersBlock title="Partners" handleSubmit={ handleSubmit } initialize={ initialize } { ...other }>
const PartnerFilters = ({handleSubmit, initialValues, initialize, t, ...other}) => (
<FiltersBlock title={ t('f.partners.partners') } handleSubmit={ handleSubmit } initialize={ initialize } t={ t } { ...other }>
<CollapsibleComponentSearch title="Text search">
<StringArrFilter name="shortName" label="Acronym" placeholder="ICRISAT"/>
<StringFilter name="name" searchType="contains" label="Title" placeholder="International"/>
<StringFilter name="description" searchType="contains" label="Description" placeholder="Partner description"/>
<StringArrFilter
name="shortName"
label={ t('f.partners.acronym') }
placeholder={ t('f.partners.ICRISAT') }
/>
<StringFilter
name="name"
searchType="contains"
label={ t('f.partners.title') }
placeholder={ t('f.partners.international') }
/>
<StringFilter
name="description"
searchType="contains"
label={ t('f.partners.description') }
placeholder={ t('f.partners.partnerDescription') }
/>
</CollapsibleComponentSearch>
</FiltersBlock>
);
......
......@@ -25,7 +25,7 @@ class PartnerForm extends React.Component<any, void> {
public constructor(props: any) {
super(props);
const {setPageTitle, initialValues} = this.props;
setPageTitle(initialValues.name || 'New partner');
setPageTitle(initialValues.name || 'New data provider');
}
private onAddString() {
......@@ -38,12 +38,12 @@ class PartnerForm extends React.Component<any, void> {
}
public render() {
const {error, initialValues, handleSubmit, invalid, submitting} = this.props;
const {error, initialValues, handleSubmit, invalid, submitting, t} = this.props;
return (
<form onSubmit={ handleSubmit }>
<Heading title={ initialValues.name || 'New partner' } level={ 2 }/>
<Field required name="name" component={ TextField } type="text" label="Partner name"
placeholder="Partner name"
<Heading title={ initialValues.name || t('p.editPartner.name.new') } level={ 2 }/>
<Field required name="name" component={ TextField } type="text" label={ t('p.editPartner.name.label') }
placeholder={ t('p.editPartner.name.placeholder') }
validate={ [ Validators.required ] }
/>
......@@ -53,7 +53,7 @@ class PartnerForm extends React.Component<any, void> {
/>
<Field name="description" component={ MarkdownField } label="Description"
placeholder="Partner introduction text (markdown)" />
placeholder={ t('p.editPartner.description.placeholder') } />
<Field name="email" component={ TextField } type="text" label="Email address"
placeholder="name@domain.com"
......@@ -70,7 +70,7 @@ class PartnerForm extends React.Component<any, void> {
validate={ [ Validators.maxLength(500) ] }
/>
<Heading title="Partner websites" level={ 4 }/>
<Heading title={ t('p.editPartner.websites') } level={ 4 }/>
<ItemsEditor name="urls" itemLabel="Website" addItem={ this.onAddString } removeItem={ this.onRemoveString } component={ stringField } />
<Heading title="FAO WIEWS Codes" level={ 4 }/>
......
......@@ -2,6 +2,7 @@ import * as React from 'react';
import {withStyles} from '@material-ui/core/styles';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { translate } from 'react-i18next';
import {log} from 'utilities/debug';
......@@ -44,6 +45,7 @@ interface ISelectPartnerProps extends React.ClassAttributes<any> {
useUuid?: boolean; // toggle this if input contains the UUID instead of Partner object
allowNull?: boolean; // add blank option (null) to selection
multiple?: boolean; // allow multiple
t: any;
}
class SelectPartner extends React.Component<ISelectPartnerProps, any> {
......@@ -84,26 +86,25 @@ class SelectPartner extends React.Component<ISelectPartnerProps, any> {
}
public render() {
const { partners, classes, input, label, editable, required, meta, useUuid, allowNull, multiple } = this.props;
const { partners, classes, input, label, editable, required, meta, useUuid, allowNull, multiple, t } = this.props;
const allowsEdit = editable === undefined || editable;
const val = input && input.value ?
(multiple ? input.value[0] : input.value) : null;
if (! allowsEdit) {
return (
<FormControl fullWidth label={ label }>
<FormControl fullWidth label={ t(`f.selectPartner.label.${label}`) }>
<Input value={ val && val.name } className={ classes.input } disabled />
</FormControl>
);
}
return (
<FormControl fullWidth required={ required } meta={ meta } label={ label }>
<FormControl fullWidth required={ required } meta={ meta } label={ t(`f.selectPartner.label.${label}`) }>
<Select error={ meta.touched && meta.error } className={ classes.select } value={ useUuid ? val || '' : val && val.uuid || '' } onChange={ this.handleChange }
input={ <Input /> }
>
{ allowNull && <MenuItem key="noPartner" value=""><em>Select partner</em></MenuItem> }
{ allowNull && <MenuItem key="noPartner" value=""><em>{ t('f.selectPartner.select') }</em></MenuItem> }
{ partners && partners.sort((a, b) => a.shortName.localeCompare(b.shortName)).map((p) =>
<MenuItem key={ p.uuid } value={ p.uuid }><span className={ classes.shortName }>{ p.shortName }</span><Markdown source={ p.name }/></MenuItem>)
}
......@@ -125,4 +126,4 @@ const mapDispatchToProps = (dispatch) => bindActionCreators({
loadMyPartners,
}, dispatch);
export default connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(SelectPartner));
export default translate()(connect(mapStateToProps, mapDispatchToProps)(withStyles(styles)(SelectPartner)));
......@@ -243,13 +243,13 @@ class PaginationComponent extends React.Component<IPaginationComponentProps, any
if (typeof sortOptions[key] === 'string') {
return (
<MenuItem key={ i } value={ key } className={ classes.liItem }>
{ sortOptions[key] }
{ t(`f.sortOptions.${sortOptions[key]}`) }
</MenuItem>
);
} else {
return (
<MenuItem key={ i } value={ key } className={ classes.liItem }>
{ sortOptions[key].label }
{ t(`f.sortOptions.${sortOptions[key].label}`) }
</MenuItem>
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment