-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): add new Publication, Work and Creator display pages
- Loading branch information
1 parent
5d98090
commit e8d3937
Showing
4 changed files
with
347 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
/* | ||
* Copyright (C) 2017 Ben Ockmore | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
import * as bootstrap from 'react-bootstrap'; | ||
import * as entityHelper from '../../../helpers/entity'; | ||
|
||
import EntityFooter from './footer'; | ||
import EntityIdentifiers from './identifiers'; | ||
import EntityImage from './image'; | ||
import EntityRelationships from './relationships'; | ||
import EntityTitle from './title'; | ||
import React from 'react'; | ||
|
||
const {extractAttribute, getTypeAttribute, getEntityUrl} = entityHelper; | ||
const {Col, Row} = bootstrap; | ||
|
||
|
||
function CreatorAttributes({creator}) { | ||
const type = getTypeAttribute(creator.creatorType).data; | ||
const gender = extractAttribute(creator.gender, 'name'); | ||
const beginArea = extractAttribute(creator.beginArea, 'name'); | ||
const endArea = extractAttribute(creator.endArea, 'name'); | ||
const beginDate = extractAttribute(creator.beginDate); | ||
const endDate = extractAttribute(creator.endDate); | ||
|
||
return ( | ||
<div> | ||
<Row> | ||
<Col md={3}> | ||
<dl> | ||
<dt>Type</dt> | ||
<dd>{type}</dd> | ||
</dl> | ||
</Col> | ||
<Col md={3}> | ||
<dl> | ||
<dt>Gender</dt> | ||
<dd>{gender}</dd> | ||
</dl> | ||
</Col> | ||
<Col md={3}> | ||
<dl> | ||
<dt>Begin Date</dt> | ||
<dd>{beginDate}</dd> | ||
<dt>Begin Area</dt> | ||
<dd>{beginArea}</dd> | ||
</dl> | ||
</Col> | ||
{ | ||
creator.ended && | ||
<Col md={3}> | ||
<dl> | ||
<dt>End Date</dt> | ||
<dd>{endDate}</dd> | ||
<dt>End Area</dt> | ||
<dd>{endArea}</dd> | ||
</dl> | ||
</Col> | ||
} | ||
</Row> | ||
</div> | ||
); | ||
} | ||
CreatorAttributes.displayName = 'CreatorAttributes'; | ||
CreatorAttributes.propTypes = { | ||
creator: React.PropTypes.object.isRequired | ||
}; | ||
|
||
|
||
function CreatorDisplayPage({entity, identifierTypes}) { | ||
const urlPrefix = getEntityUrl(entity); | ||
return ( | ||
<div> | ||
<Row className="entity-display-background"> | ||
<Col className="entity-display-image-box text-center" md={2}> | ||
<EntityImage | ||
backupIcon="user" | ||
imageUrl={entity.imageUrl} | ||
/> | ||
</Col> | ||
<Col md={10}> | ||
<EntityTitle entity={entity}/> | ||
<CreatorAttributes creator={entity}/> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col md={8}> | ||
<EntityRelationships | ||
entityUrl={urlPrefix} | ||
relationships={entity.relationships} | ||
/> | ||
</Col> | ||
<Col md={4}> | ||
<EntityIdentifiers | ||
identifierSet={entity.identifierSet} | ||
identifierTypes={identifierTypes} | ||
/> | ||
</Col> | ||
</Row> | ||
<hr className="margin-top-d40"/> | ||
<EntityFooter | ||
entityUrl={urlPrefix} | ||
lastModified={entity.revision.revision.createdAt} | ||
/> | ||
</div> | ||
); | ||
} | ||
CreatorDisplayPage.displayName = 'CreatorDisplayPage'; | ||
CreatorDisplayPage.propTypes = { | ||
entity: React.PropTypes.object.isRequired, | ||
identifierTypes: React.PropTypes.array | ||
}; | ||
CreatorDisplayPage.defaultProps = { | ||
identifierTypes: [] | ||
}; | ||
|
||
export default CreatorDisplayPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright (C) 2017 Ben Ockmore | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
import * as bootstrap from 'react-bootstrap'; | ||
import * as entityHelper from '../../../helpers/entity'; | ||
|
||
import EditionTable from './edition-table'; | ||
import EntityFooter from './footer'; | ||
import EntityIdentifiers from './identifiers'; | ||
import EntityImage from './image'; | ||
import EntityRelationships from './relationships'; | ||
import EntityTitle from './title'; | ||
import React from 'react'; | ||
|
||
const {getTypeAttribute, getEntityUrl} = entityHelper; | ||
const {Col, Row} = bootstrap; | ||
|
||
function PublicationAttributes({publication}) { | ||
const type = getTypeAttribute(publication.publicationType).data; | ||
|
||
return ( | ||
<div> | ||
<Row> | ||
<Col md={3}> | ||
<dl> | ||
<dt>Type</dt> | ||
<dd>{type}</dd> | ||
</dl> | ||
</Col> | ||
</Row> | ||
</div> | ||
); | ||
} | ||
PublicationAttributes.displayName = 'PublicationAttributes'; | ||
PublicationAttributes.propTypes = { | ||
publication: React.PropTypes.object.isRequired | ||
}; | ||
|
||
|
||
function PublicationDisplayPage({entity, identifierTypes}) { | ||
const urlPrefix = getEntityUrl(entity); | ||
return ( | ||
<div> | ||
<Row className="entity-display-background"> | ||
<Col className="entity-display-image-box text-center" md={2}> | ||
<EntityImage | ||
backupIcon="th-list" | ||
imageUrl={entity.imageUrl} | ||
/> | ||
</Col> | ||
<Col md={10}> | ||
<EntityTitle entity={entity}/> | ||
<PublicationAttributes publication={entity}/> | ||
</Col> | ||
</Row> | ||
<EditionTable entity={entity}/> | ||
<Row> | ||
<Col md={8}> | ||
<EntityRelationships | ||
entityUrl={urlPrefix} | ||
relationships={entity.relationships} | ||
/> | ||
</Col> | ||
<Col md={4}> | ||
<EntityIdentifiers | ||
identifierSet={entity.identifierSet} | ||
identifierTypes={identifierTypes} | ||
/> | ||
</Col> | ||
</Row> | ||
<hr className="margin-top-d40"/> | ||
<EntityFooter | ||
entityUrl={urlPrefix} | ||
lastModified={entity.revision.revision.createdAt} | ||
/> | ||
</div> | ||
); | ||
} | ||
PublicationDisplayPage.displayName = 'PublicationDisplayPage'; | ||
PublicationDisplayPage.propTypes = { | ||
entity: React.PropTypes.object.isRequired, | ||
identifierTypes: React.PropTypes.array | ||
}; | ||
PublicationDisplayPage.defaultProps = { | ||
identifierTypes: [] | ||
}; | ||
|
||
export default PublicationDisplayPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* Copyright (C) 2017 Ben Ockmore | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along | ||
* with this program; if not, write to the Free Software Foundation, Inc., | ||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
*/ | ||
|
||
import * as bootstrap from 'react-bootstrap'; | ||
import * as entityHelper from '../../../helpers/entity'; | ||
|
||
import EntityFooter from './footer'; | ||
import EntityIdentifiers from './identifiers'; | ||
import EntityImage from './image'; | ||
import EntityRelationships from './relationships'; | ||
import EntityTitle from './title'; | ||
import React from 'react'; | ||
|
||
const {getLanguageAttribute, getTypeAttribute, getEntityUrl} = entityHelper; | ||
const {Col, Row} = bootstrap; | ||
|
||
|
||
function WorkAttributes({work}) { | ||
const type = getTypeAttribute(work.workType).data; | ||
const languages = getLanguageAttribute(work).data; | ||
|
||
return ( | ||
<div> | ||
<Row> | ||
<Col md={3}> | ||
<dl> | ||
<dt>Type</dt> | ||
<dd>{type}</dd> | ||
</dl> | ||
</Col> | ||
<Col md={3}> | ||
<dl> | ||
<dt>Language</dt> | ||
<dd>{languages}</dd> | ||
</dl> | ||
</Col> | ||
</Row> | ||
</div> | ||
); | ||
} | ||
WorkAttributes.displayName = 'WorkAttributes'; | ||
WorkAttributes.propTypes = { | ||
work: React.PropTypes.object.isRequired | ||
}; | ||
|
||
|
||
function WorkDisplayPage({entity, identifierTypes}) { | ||
const urlPrefix = getEntityUrl(entity); | ||
return ( | ||
<div> | ||
<Row className="entity-display-background"> | ||
<Col className="entity-display-image-box text-center" md={2}> | ||
<EntityImage | ||
backupIcon="file-text-o" | ||
imageUrl={entity.imageUrl} | ||
/> | ||
</Col> | ||
<Col md={10}> | ||
<EntityTitle entity={entity}/> | ||
<WorkAttributes work={entity}/> | ||
</Col> | ||
</Row> | ||
<Row> | ||
<Col md={8}> | ||
<EntityRelationships | ||
entityUrl={urlPrefix} | ||
relationships={entity.relationships} | ||
/> | ||
</Col> | ||
<Col md={4}> | ||
<EntityIdentifiers | ||
identifierSet={entity.identifierSet} | ||
identifierTypes={identifierTypes} | ||
/> | ||
</Col> | ||
</Row> | ||
<hr className="margin-top-d40"/> | ||
<EntityFooter | ||
entityUrl={urlPrefix} | ||
lastModified={entity.revision.revision.createdAt} | ||
/> | ||
</div> | ||
); | ||
} | ||
WorkDisplayPage.displayName = 'WorkDisplayPage'; | ||
WorkDisplayPage.propTypes = { | ||
entity: React.PropTypes.object.isRequired, | ||
identifierTypes: React.PropTypes.array | ||
}; | ||
WorkDisplayPage.defaultProps = { | ||
identifierTypes: [] | ||
}; | ||
|
||
export default WorkDisplayPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters