Commit 0b67ee8b authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza
Browse files

Descriptor list + URL

parent eac6dbc5
......@@ -101,6 +101,7 @@ export class DescriptorList extends UuidModel implements IUserPermissions {
public owner: Partner;
public crop: string;
public title: string;
public url: string;
public description: string;
public published: boolean;
public versionTag: string;
......
......@@ -107,6 +107,10 @@ const FaoWiewsLink = ({wiewsCode, children}) => (
<a href={ `http://www.fao.org/wiews/data/organizations/en/?instcode=${wiewsCode}` } target="_blank" rel="nofollow">{ children }</a>
);
const ExternalLink = ({link, children}) => (
<a href={ link } target="_blank" rel="nofollow">{ children }</a>
);
const PartnerLink_ = ({ to: partner, edit = false, children, loadPartner }: { to: Partner, edit?: boolean, children?: any } & any) => {
const clickMe = (e) => {
log('You clicked me!', partner);
......@@ -184,4 +188,4 @@ const CropLink = connect(({}) => ((state, ownProps) => ({
crops: new Map<string, Crop>(state.lookups.crops),
})), null) (CropLink1);
export { DatasetLink, DescriptorLink, DescriptorListLink, FaoWiewsLink, PartnerLink, VocabularyLink, CropLink };
export { DatasetLink, DescriptorLink, DescriptorListLink, FaoWiewsLink, PartnerLink, VocabularyLink, CropLink, ExternalLink };
import * as React from 'react';
import { DescriptorList } from 'model/descriptor.model';
import { DescriptorListLink, CropLink } from 'ui/catalog/Links';
import { DescriptorListLink, CropLink, ExternalLink } from 'ui/catalog/Links';
import { Properties, PropertiesItem } from 'ui/catalog/Properties';
import Card, { CardHeader, CardContent } from 'ui/common/Card';
......@@ -19,6 +19,7 @@ const DescriptorListCard = ({descriptorList, className}: {descriptorList: Descri
<Properties>
{ descriptorList.crop && <PropertiesItem title="Crop:"><CropLink code={ descriptorList.crop } /></PropertiesItem> }
<PropertiesItem title="Publisher:">{ descriptorList.publisher || <i>Not specified</i> }</PropertiesItem>
{ descriptorList.url && <PropertiesItem title="URL:">{ <ExternalLink link={ descriptorList.url }>{ descriptorList.url }</ExternalLink> }</PropertiesItem> }
<PropertiesItem title="Version:">{ descriptorList.versionTag }</PropertiesItem>
</Properties>
</CardContent>
......
......@@ -21,7 +21,7 @@ import Loading from 'ui/common/Loading';
import Markdown from 'ui/catalog/markdown';
import DescriptorCard from 'ui/catalog/descriptor/DescriptorCard';
import ContentHeaderWithButton from 'ui/common/heading/ContentHeaderWithButton';
import {PartnerLink, DescriptorListLink, CropLink, DescriptorLink} from 'ui/catalog/Links';
import {PartnerLink, DescriptorListLink, CropLink, DescriptorLink, ExternalLink} from 'ui/catalog/Links';
import { Properties, PropertiesItem } from 'ui/catalog/Properties';
import BackButton from 'ui/common/buttons/BackButton';
import { ScrollToTopOnMount } from 'ui/common/page/scrollers';
......@@ -205,6 +205,9 @@ class DescriptorListPage extends React.Component<IDescriptorListPageProps, any>
<PropertiesItem title="Publisher:">{ descriptorList.publisher || <i>Not specified</i> }</PropertiesItem>
{ descriptorList.url &&
<PropertiesItem title="URL:">{ <ExternalLink link={ descriptorList.url }>{ descriptorList.url }</ExternalLink> }</PropertiesItem> }
{ descriptorList.bibliographicCitation &&
<PropertiesItem title="Bibliographic citation:">{ descriptorList.bibliographicCitation }</PropertiesItem> }
......
......@@ -45,6 +45,7 @@ const DescriptorListForm = ({invalid, submitting, error, handleSubmit, initialVa
<Field required name="title" label="Descriptor list title" placeholder="Descriptors for" basicMarkdown component={ MarkdownField } validate={ [ Validators.required ] } />
<Field required disabled={ initialValues.uuid } name="versionTag" label="Version tag" placeholder="1.0" component={ TextField } validate={ [ Validators.required ] }/>
<Field name="description" label="Description" placeholder="Full description of the descriptor list" component={ MarkdownField } />
<Field name="url" label="URL to definition" placeholder="https://" component={ TextField } validate={ [ Validators.url ] } />
<Field name="publisher" label="Publisher" placeholder="" component={ TextField } />
<Field name="bibliographicCitation" label="Bibliographic citation" placeholder="" component={ TextField } multiline />
......
......@@ -15,7 +15,7 @@ import Loading from 'ui/common/Loading';
import Markdown from 'ui/catalog/markdown';
import DescriptorCard from 'ui/catalog/descriptor/DescriptorCard';
import ContentHeaderWithButton from 'ui/common/heading/ContentHeaderWithButton';
import { PartnerLink, DescriptorListLink, CropLink } from 'ui/catalog/Links';
import { PartnerLink, DescriptorListLink, CropLink, ExternalLink } from 'ui/catalog/Links';
import { Properties, PropertiesItem } from 'ui/catalog/Properties';
import Grid from 'material-ui/Grid';
......@@ -150,6 +150,9 @@ class DescriptorListPage extends React.Component<IDescriptorListPageProps, any>
<PropertiesItem title="Publisher:">{ descriptorList.publisher || <i>Not specified</i> }</PropertiesItem>
{ descriptorList.url &&
<PropertiesItem title="URL:">{ <ExternalLink link={ descriptorList.url }>{ descriptorList.url }</ExternalLink> }</PropertiesItem> }
{ descriptorList.bibliographicCitation &&
<PropertiesItem title="Bibliographic citation:">{ descriptorList.bibliographicCitation }</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