Commit 3d8edb37 authored by Viacheslav Pavlov's avatar Viacheslav Pavlov Committed by Viacheslav Pavlov
Browse files

Page titles not set

Added missing titles
fixed stepper pages
now titles are set by specific entity title not by generic "page type"
contentHeaderWithButton now sets it's background color depending on it's type
fixed vocabulary public routes
PageTitle introduced, setPageTitle now used only by PageTitle component
parent deee86d3
......@@ -254,7 +254,7 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<Grid item xs={ 12 } className="p-10" id="dataset-top">
<Card className={ classes.card } square>
<CardHeader className={ classes.cardHeader }
title={ <Markdown basic source={ dataset.title }/> }
title={ t('datasets.public.p.display.title') }
subheader={ <small>{ dataset.versionTag }</small> }/>
<CardContent className={ classes.cardContent }>
{ dataset.description && <Markdown className="mb-20" source={ dataset.description }/> }
......
......@@ -17,6 +17,7 @@ import PaginationComponent from 'ui/common/pagination';
import DescriptorListCard from 'descriptorlists/ui/c/Card';
import DescriptorListFilters from './c/Filters';
import PrettyFilters from 'ui/common/filter/PrettyFilters';
import PageTitle from 'ui/common/PageTitle';
import PageLayout, { PageContents } from 'ui/layout/PageLayout';
import ContentHeader from 'ui/common/heading/ContentHeader';
import BrowsePageTemplate from 'ui/pages/_base/BrowsePage';
......@@ -38,6 +39,7 @@ class BrowsePage extends BrowsePageTemplate<DescriptorList> {
<DescriptorListFilters initialValues={ paged && paged.filter || {} } onSubmit={ this.myApplyFilters }/>
}>
<ScrollToTopOnMount/>
<PageTitle title={ t('descriptorlists.common.modelName_plural') }/>
<ContentHeader
title={ t('descriptorlists.common.modelName_plural') }
subtitle={ t('descriptorlists.public.p.browse.subtitle') }
......
......@@ -13,6 +13,7 @@ import { copyDescriptor } from 'descriptors/actions/public';
import DescriptorList from 'model/catalog/DescriptorList';
import Loading from 'ui/common/Loading';
import ContentHeaderWithButton from 'ui/common/heading/ContentHeaderWithButton';
import PageTitle from 'ui/common/PageTitle';
import BackButton from 'ui/common/buttons/BackButton';
import PageLayout from 'ui/layout/PageLayout';
import DescriptorListDisplay from './c/DescriptorListDisplay';
......@@ -61,8 +62,10 @@ class DescriptorListPage extends React.Component<IDescriptorListPageProps, any>
return (
<PageLayout>
<ContentHeaderWithButton title={ t('descriptorlists.public.p.display.title') }
buttons={ <BackButton defaultTarget="/descriptorlists"/> }
<PageTitle title={ !stillLoading ? `${descriptorList.title} ${descriptorList.versionTag}` : t('common:label.loading', {what: t('descriptorlists.public.p.display.title')}) }/>
<ContentHeaderWithButton
title={ !stillLoading ? `${descriptorList.title} ${descriptorList.versionTag}` : t('common:label.loading', {what: t('descriptorlists.public.p.display.title')}) }
buttons={ <BackButton defaultTarget="/descriptorlists"/> }
/>
{ stillLoading ? <Loading className={ classes.contentContainer }/> :
<span>
......
......@@ -216,12 +216,7 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<Card className={ classes.card } square>
<CardHeader
className={ classes.cardHeader }
title={ (
<span>
<Markdown basic source={ descriptorList.title }/>
<small>{ descriptorList.versionTag }</small>
</span>
) }/>
title={ t('descriptorlists.public.p.display.title') }/>
<Divider/>
<CardContent className={ classes.cardContent }>
{ descriptorList.state !== PublishState.PUBLISHED &&
......
......@@ -21,7 +21,6 @@ interface IDescriptorListProps extends React.ClassAttributes<any> {
uuid: string;
pageTitle: string;
navigateTo: (path: string) => void;
setPageTitle: (title: string) => void;
t: any;
loadMyPartners: any;
......
......@@ -31,8 +31,8 @@
"admin": {
"p": {
"edit": {
"title": "Edit descriptor",
"dataPublication": "Data publication",
"title": "Edit {{title}} descriptor",
"details": "Descriptor details",
"back": "BACK TO DASHBOARD"
}
},
......
......@@ -14,6 +14,7 @@ import PaginationComponent from 'ui/common/pagination';
import DescriptorCard from 'descriptors/ui/c/DescriptorCard';
import DescriptorFilters from 'descriptors/ui/c/Filters';
import PrettyFilters from 'ui/common/filter/PrettyFilters';
import PageTitle from 'ui/common/PageTitle';
import PageLayout, { PageContents } from 'ui/layout/PageLayout';
import ContentHeader from 'ui/common/heading/ContentHeader';
......@@ -34,8 +35,10 @@ class BrowsePage extends BrowsePageTemplate<Descriptor> {
<PageLayout sidebar={
<DescriptorFilters initialValues={ paged && paged.filter || {} } onSubmit={ this.myApplyFilters }/>
}>
<ContentHeader title={ t('descriptors.public.p.browse.title') }
subtitle={ t('descriptors.public.p.browse.subtitle') }
<PageTitle title={ t('descriptors.public.p.browse.title') }/>
<ContentHeader
title={ t('descriptors.public.p.browse.title') }
subtitle={ t('descriptors.public.p.browse.subtitle') }
/>
<ScrollToTopOnMount/>
<PaginationComponent
......
......@@ -28,6 +28,7 @@ import DescriptorScale from 'descriptors/ui/c/DescriptorScale';
import BackButton from 'ui/common/buttons/BackButton';
import Permissions from 'ui/common/permission/Permissions';
import PageLayout from 'ui/layout/PageLayout';
import PageTitle from 'ui/common/PageTitle';
import Grid from '@material-ui/core/Grid';
import Card, { CardHeader, CardContent, CardActions } from 'ui/common/Card';
......@@ -136,12 +137,13 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
return (
<PageLayout>
<ScrollToTopOnMount/>
<ContentHeaderWithButton title={ t('descriptors.public.p.display.title') } buttons={ <BackButton defaultTarget="/descriptors"/> }/>
<PageTitle title={ !stillLoading ? descriptor.title : t('common:label.loading', { what: t('descriptors.public.p.display.title') }) }/>
<ContentHeaderWithButton title={ !stillLoading ? descriptor.title : t('common:label.loading', { what: t('descriptors.public.p.display.title') }) } buttons={ <BackButton defaultTarget="/descriptors"/> }/>
{ stillLoading ? <Loading/> :
<Grid container spacing={ 0 } className="p-10 back-gray">
<Grid item xs={ 12 } className="p-10">
<Card square>
<CardHeader title={ <Markdown basic source={ descriptor.title }/> }/>
<CardHeader title={ t('descriptors.public.p.display.title') }/>
<CardContent>
{ descriptor.state !== PublishState.PUBLISHED && <h2>{ t('descriptors.public.p.display.isNotPublishedAlert') }</h2> }
{ descriptor.key && <h2>{ t('descriptors.public.p.display.keyAlert') }</h2> }
......
......@@ -16,6 +16,7 @@ import Grid from '@material-ui/core/Grid';
import Paper from '@material-ui/core/Paper';
import ContentHeaderWithButton from 'ui/common/heading/ContentHeaderWithButton';
import BackButton from 'ui/common/buttons/BackButton';
import PageTitle from 'ui/common/PageTitle';
interface IDescriptorEditPageProps extends React.ClassAttributes<any> {
classes: any;
......@@ -74,8 +75,9 @@ class DescriptorEditPage extends React.Component<IDescriptorEditPageProps, any>
return (
<div>
<PageTitle title={ t('descriptors.admin.p.edit.title', {title: descriptor ? descriptor.title : ''}) }/>
<ContentHeaderWithButton
title={ t('descriptors.admin.p.edit.dataPublication') }
title={ t('descriptors.admin.p.edit.title', {title: descriptor ? descriptor.title : ''}) }
buttons={
<BackButton
defaultTarget="/dashboard/descriptors"
......@@ -89,7 +91,7 @@ class DescriptorEditPage extends React.Component<IDescriptorEditPageProps, any>
<Paper className="p-20">
<DescriptorForm
initialValues={ descriptor }
pageTitle={ t('descriptors.admin.p.edit.title') }
pageTitle={ t('descriptors.admin.p.edit.details') }
onPublish={ this.onPublish }
onSubmit={ this.onSave }
/>
......
......@@ -22,7 +22,6 @@ import Button from '@material-ui/core/Button';
import { Toggle } from 'ui/common/forms';
import Grid from '@material-ui/core/Grid';
import { setPageTitle } from 'actions/pageTitle';
import { bindActionCreators } from 'redux';
import RadioSelection from 'ui/common/forms/RadioSelection';
import withStyles from '@material-ui/core/styles/withStyles';
......@@ -42,12 +41,6 @@ const styles = (theme) => ({
class DescriptorForm extends React.Component<any, any> {
public constructor(props: any) {
super(props);
const { setPageTitle, pageTitle } = this.props;
setPageTitle(pageTitle);
}
private requiresMaxValue = () => {
const { dataType } = this.props;
return dataType === 'SCALE';
......@@ -267,7 +260,7 @@ const mapStateToProps = (state, ownProps) => ({
});
const mapDispatchToProps = (dispatch) => bindActionCreators({
setPageTitle,
// none
}, dispatch);
export default translate()(connect(mapStateToProps, mapDispatchToProps)(
......
......@@ -20,6 +20,7 @@ import ContentHeader from 'ui/common/heading/ContentHeader';
import LocationMap from 'ui/common/LocationMap';
import Loading from 'ui/common/Loading';
import Number from 'ui/common/Number';
import PageTitle from 'ui/common/PageTitle';
interface ICountryDisplayPageProps extends React.ClassAttributes<any> {
details: CountryDetails;
......@@ -78,6 +79,7 @@ class CountryDisplayPage extends React.Component<ICountryDisplayPageProps> {
return (
<PageLayout>
<PageTitle title={ `${t('geo.public.p.countryList.countryProfile', { code: isoCode }) }` } />
<ContentHeader title={ `${t('geo.public.p.countryList.countryProfile', { code: isoCode }) }` }/>
<div>
{ stillLoading ? <Loading /> :
......
......@@ -15,6 +15,7 @@ import ContentHeader from 'ui/common/heading/ContentHeader';
import GridContainer from 'ui/layout/GridContainer';
import CountryCard from 'geo/ui/c/CountryCard';
import Loading from 'ui/common/Loading';
import PageTitle from 'ui/common/PageTitle';
interface ICountryListPageProps extends React.ClassAttributes<any> {
t: any;
......@@ -46,6 +47,7 @@ class CountryListPage extends React.Component<ICountryListPageProps> {
return (
<PageLayout>
<PageTitle title={ t(`geo.public.p.countryList.title`) }/>
<ContentHeader
title={ t(`geo.public.p.countryList.title`) }
subTitle={ t(`geo.public.p.countryList.subTitle`) }
......
......@@ -21,6 +21,7 @@ import Loading from 'ui/common/Loading';
import GeoRegionCard from 'geo/ui/c/GeoRegionCard';
import CountryCard from 'geo/ui/c/CountryCard';
import ActionButton from 'ui/common/buttons/ActionButton';
import PageTitle from 'ui/common/PageTitle';
interface IRegionDisplayPageProps extends React.ClassAttributes<any> {
details: RegionDetails;
......@@ -63,6 +64,7 @@ class RegionDisplayPage extends React.Component<IRegionDisplayPageProps> {
return (
<PageLayout>
<PageTitle title={ details && details.name ? details.name : '' } />
<ContentHeader title={ details && details.name ? details.name : '' } />
{ stillLoading ? <Loading /> :
<div>
......
......@@ -15,6 +15,7 @@ import ContentHeader from 'ui/common/heading/ContentHeader';
import GridContainer from 'ui/layout/GridContainer';
import Loading from 'ui/common/Loading';
import GeoRegionCard from 'geo/ui/c/GeoRegionCard';
import PageTitle from 'ui/common/PageTitle';
interface IRegionListPageProps extends React.ClassAttributes<any> {
t: any;
......@@ -46,6 +47,7 @@ class RegionListPage extends React.Component<IRegionListPageProps> {
return (
<PageLayout>
<PageTitle title={ t(`geo.public.p.regionList.title`) }/>
<ContentHeader
title={ t(`geo.public.p.regionList.title`) }
subTitle={ t(`geo.public.p.regionList.subTitle`) }
......
......@@ -36,6 +36,11 @@
}
},
"dashboard": {
"p": {
"edit": {
"title": "Edit {{instName}}"
}
},
"c": {
"form": {
"gaTracker": "GA Tracker code",
......
......@@ -17,6 +17,7 @@ import Loading from 'ui/common/Loading';
import PagedLoader from 'ui/common/PagedLoader';
import PrettyFilters from 'ui/common/filter/PrettyFilters';
import PaginationComponent from 'ui/common/pagination';
import PageTitle from 'ui/common/PageTitle';
import InstituteCard from 'institutes/ui/с/InstituteCard';
import InstituteFilters from './с/Filters';
......@@ -38,6 +39,7 @@ class BrowsePage extends BrowsePageTemplate<FaoInstitute> {
<InstituteFilters initialValues={ paged && paged.filter || {} } onSubmit={ this.myApplyFilters } t={ t } />
}>
<PageTitle title={ t('institutes.public.p.browse.title') }/>
<ContentHeader title={ t('institutes.public.p.browse.title') } subTitle={ t('institutes.public.p.browse.subTitle') } />
<PaginationComponent
......
......@@ -33,6 +33,7 @@ import Permissions from 'ui/common/permission/Permissions';
import FaoInstitute from 'model/genesys/FaoInstitute';
import ButtonBar from 'ui/common/buttons/ButtonBar';
import DownloadDialog from 'ui/common/download-dialog';
import PageTitle from 'ui/common/PageTitle';
interface IDisplayPageProps extends React.ClassAttributes<any> {
t: any;
......@@ -127,7 +128,8 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
return (
<PageLayout withFooter>
<ScrollToTopOnMount />
<ContentHeader title={ t('institutes.public.p.display.title') }/>
<PageTitle title={ !stillLoading ? institute.details.fullName || institute.details.code : t('common:label.loading', { what: t('institutes.public.p.display.title') }) } />
<ContentHeader title={ !stillLoading ? institute.details.fullName || institute.details.code : t('common:label.loading', { what: t('institutes.public.p.display.title') }) } />
{ stillLoading ? <Loading /> :
<div>
......@@ -135,7 +137,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
{ institute &&
<PageContents className="pt-1rem">
<MainSection title={ `${institute.details.fullName}` }>
<MainSection title={ t('institutes.public.p.display.title') }>
<Properties>
<PropertiesItem title={ t('institutes.common.instituteCode') }>{ institute.details.code }</PropertiesItem>
<PropertiesItem title={ t('institutes.public.p.display.type') }>{ institute.details.type }</PropertiesItem>
......
......@@ -13,6 +13,8 @@ import { PageContents } from 'ui/layout/PageLayout';
import Grid from '@material-ui/core/Grid';
import Paper from '@material-ui/core/Paper';
import InstituteForm from './c/InstituteForm';
import ContentHeader from 'ui/common/heading/ContentHeader';
import PageTitle from 'ui/common/PageTitle';
interface IInstituteEditPageProps extends React.ClassAttributes<any> {
t: any;
......@@ -66,23 +68,27 @@ class InstituteEditPage extends React.Component<IInstituteEditPageProps, any> {
}
return (
<PageContents className="pt-1rem">
<Grid item xs={ 12 }>
<Paper className="p-20 mb-10">
<InstituteForm
wiewsCode={ wiewsCode }
initialValues={ {
settings: institute.settings,
codeSGSV: institute.codeSGSV,
uniqueAcceNumbs: `${institute.uniqueAcceNumbs}`,
allowMaterialRequests: `${institute.allowMaterialRequests}`,
} }
onSubmit={ this.onSave }
t={ t }
/>
</Paper>
</Grid>
</PageContents>
<div>
<PageTitle title={ t('institutes.dashboard.p.edit.title', {instName: institute && institute.fullName || wiewsCode || t('institutes.common.modelName') }) } />
<ContentHeader title={ t('institutes.dashboard.p.edit.title', {instName: institute && institute.fullName || wiewsCode || t('institutes.common.modelName') }) }/>
<PageContents className="pt-1rem">
<Grid item xs={ 12 }>
<Paper className="p-20 mb-10">
<InstituteForm
wiewsCode={ wiewsCode }
initialValues={ {
settings: institute.settings,
codeSGSV: institute.codeSGSV,
uniqueAcceNumbs: `${institute.uniqueAcceNumbs}`,
allowMaterialRequests: `${institute.allowMaterialRequests}`,
} }
onSubmit={ this.onSave }
t={ t }
/>
</Paper>
</Grid>
</PageContents>
</div>
);
}
......
......@@ -18,6 +18,7 @@ import { PageContents } from 'ui/layout/PageLayout';
import Loading from 'ui/common/Loading';
// import PagedLoader from 'ui/common/PagedLoader';
import ContentHeaderWithButton from 'ui/common/heading/ContentHeaderWithButton';
import PageTitle from 'ui/common/PageTitle';
import Grid from '@material-ui/core/Grid';
import ParameterDialog from './ParameterDialog';
import DimensionDialog from './DimensionDialog';
......@@ -68,6 +69,7 @@ class Dashboard extends React.Component<IDashboardProps, any> {
return (
<div>
<PageTitle title={ t(`kpi.admin.p.dashboard.title`) }/>
<ContentHeaderWithButton title={ t(`kpi.admin.p.dashboard.title`) } buttons={ <div>
<ParameterDialog/>
<DimensionDialog/>
......
......@@ -2,6 +2,8 @@ import * as React from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { translate } from 'react-i18next';
import withStyles from '@material-ui/core/styles/withStyles';
// Actions
import { deleteExecution, executeExecution, getExecution, listDimensions, listParameters, loadMoreExecutionRuns } from 'kpi/actions/admin';
import { showSnackbar } from 'actions/snackbar';
......@@ -23,8 +25,8 @@ import Button from '@material-ui/core/Button';
import RunTable from './c/RunTable';
import ExecutionDialog from './ExecutionDialog';
import FileCopyIcon from '@material-ui/icons/FileCopy';
import PageTitle from 'ui/common/PageTitle';
import DateInput from './c/DateInput';
import withStyles from '@material-ui/core/styles/withStyles';
// import { parse } from 'query-string';
......@@ -170,7 +172,8 @@ class ExecutionDisplay extends React.Component<IExecutionProps, any> {
return (
<div>
<ContentHeaderWithButton title={ t(`kpi.admin.p.executionDisplay.title`) } buttons={
<PageTitle title={ !stillLoading ? execution.title : t('common:label.loading', { what: t(`kpi.admin.p.executionDisplay.title`) }) }/>
<ContentHeaderWithButton title={ !stillLoading ? execution.title : t('common:label.loading', { what: t(`kpi.admin.p.executionDisplay.title`) }) } buttons={
<div>
<ExecutionDialog execution={ executionDetails && executionDetails.execution } buttonLabel={ t('common:action.edit') }/>
<Button variant="contained" onClick={ this.delete }>{ t('common:action.delete') }</Button>
......@@ -181,7 +184,7 @@ class ExecutionDisplay extends React.Component<IExecutionProps, any> {
<PageContents className="pt-1rem">
<Grid container spacing={ 8 }>
<Grid item sm={ 12 }>
<PageSection title={ execution.title }>
<PageSection title={ t(`kpi.admin.p.executionDisplay.title`) }>
<Properties>
<PropertiesItem title={ t('common:label.name') }><code>{ execution.name }</code></PropertiesItem>
<PropertiesItem title={ t('kpi.admin.c.executionCard.type') }><b>{ execution.type }</b></PropertiesItem>
......
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