Commit c696f3f0 authored by Valeriy Panov's avatar Valeriy Panov
Browse files

#214 Supported licenses

parent 92092b22
export class License {
public code: string;
public title: string;
public url: string;
constructor(code: string, title: string, url: string) {
this.code = code;
this.title = title;
this.url = url;
}
}
export const AVAILABLE_LICENSES = [
new License('CC0', 'Public Domain Dedication', 'https://creativecommons.org/publicdomain/zero/1.0/'),
new License('CC BY 4.0', 'Attribution 4.0 International', 'https://creativecommons.org/licenses/by/4.0/'),
new License('CC BY-SA 4.0', 'Attribution-ShareAlike 4.0 International', 'https://creativecommons.org/licenses/by-sa/4.0/'),
new License('CC BY-NC 4.0', 'Attribution-NonCommercial 4.0 International', 'https://creativecommons.org/licenses/by-nc/4.0/'),
new License('CC BY-NC-ND 4.0', 'Attribution-NonCommercial-NoDerivatives 4.0 International', 'https://creativecommons.org/licenses/by-nc-nd/4.0/'),
];
......@@ -9,6 +9,7 @@ import { Descriptor } from 'model/descriptor.model';
import { RepositoryFile } from 'model/repositoryFile.model';
import { Creator } from 'model/creator.model';
import { Location } from 'model/location.model';
import { AVAILABLE_LICENSES } from 'model/license.model';
import confirm from 'utilities/confirmAlert';
import Authorize from 'ui/common/authorized/Authorize';
......@@ -191,6 +192,8 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
return null;
}
const license = dataset.rights && AVAILABLE_LICENSES.find((e) => e.code === dataset.rights);
return (
<div className={ classes.root }>
<Grid container spacing={ 0 }>
......@@ -230,7 +233,9 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
<Grid container spacing={ 0 } className="p-20">
<Properties>
<PropertiesItem title="Type:">
<div className="blue">{ dataset.rights }</div>
<div className="blue">
{ license && <a href={ license.url } target="_blank">{ license.title }</a> }
</div>
</PropertiesItem>
</Properties>
</Grid>
......
......@@ -2,6 +2,7 @@ import * as React from 'react';
import {FormLabel, FormControl, FormControlLabel} from 'material-ui/Form';
import Radio, {RadioGroup} from 'material-ui/Radio';
import {withStyles} from 'material-ui/styles';
import {AVAILABLE_LICENSES} from 'model/license.model';
const styles = {
tooltip: {
......@@ -21,33 +22,20 @@ const BasicInfoRadioGroup = ({input, meta, classes, ...rest}) => (
(event, value) => input.onChange(value) // tslint:disable-line
}
>
<FormControlLabel
value="CC0"
label={ (
<div>CCO <a href="https://creativecommons.org/publicdomain/zero/1.0/" target="_blank" className={ classes.tooltip }>
https://creativecommons.org/publicdomain/zero/1.0/
</a></div>
) }
control={ <Radio /> }
/>
<FormControlLabel
value="CC-BY"
label={ (
<div>CC-BY <a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" className={ classes.tooltip }>
https://creativecommons.org/licenses/by/4.0/
</a></div>
) }
control={ <Radio /> }
/>
<FormControlLabel
value="CC-BY-NC"
label={ (
<div>CC-BY-NC <a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" className={ classes.tooltip }>
https://creativecommons.org/licenses/by-nc/4.0/
</a></div>
) }
control={ <Radio /> }
/>
{
AVAILABLE_LICENSES.map((license) => (
<FormControlLabel
key={ license.code }
value={ license.code }
label={ (
<div>{ license.title } <a href={ license.url } target="_blank" className={ classes.tooltip }>
{ license.url }
</a></div>
) }
control={ <Radio /> }
/>
))
}
</RadioGroup>
</FormControl>
);
......
Supports Markdown
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