Commit bf154435 authored by Audrey Hamelers's avatar Audrey Hamelers

add URLs to manuscript citation. First migration!

parent 0f3e1102
Pipeline #12297 passed with stages
in 3 minutes and 15 seconds
......@@ -73,6 +73,22 @@ const EDay = props => (
const ESeason = props => (
<TextField className={props.className} label="Season" {...props.field} />
)
const CiteUrl = props => (
<TextField
className={props.className}
invalidTest={props.invalidTest}
label="Citation URL"
{...props.field}
/>
)
const FullUrl = props => (
<TextField
className={props.className}
invalidTest={props.invalidTest}
label="Full text URL (include if full text is Open Access)"
{...props.field}
/>
)
const toggleSwitch = button => {
if (!button.classList.contains('current')) {
......@@ -238,6 +254,23 @@ const CitationForm = ({ values, errors, touched, ...props }) => (
</Flex>
</div>
</Flex>
<H4>URLs</H4>
<Field
component={CiteUrl}
invalidTest={errors.citeref && touched.citeref}
name="citeref"
/>
{errors.citeref && touched.citeref && (
<ErrorText>{errors.citeref}</ErrorText>
)}
<Field
component={FullUrl}
invalidTest={errors.fulltext && touched.fulltext}
name="fulltext"
/>
{errors.fulltext && touched.fulltext && (
<ErrorText>{errors.fulltext}</ErrorText>
)}
<Buttons right>
<Button primary type="submit">
Save
......@@ -263,6 +296,8 @@ const handleSubmit = async (
elocationId: values.elocationId,
},
publicationDates: [],
citerefUrl: values.citeref,
fulltextUrl: values.fulltext,
}
if (values.printyear) {
const ppub = {
......@@ -325,6 +360,8 @@ const enhancedFormik = withFormik({
electronicmonth: '',
electronicday: '',
electronicseason: '',
citeref: '',
fulltext: '',
},
mapPropsToValues: props => {
const { meta } = props
......@@ -335,6 +372,8 @@ const enhancedFormik = withFormik({
location,
publicationDates,
title,
citerefUrl,
fulltextUrl,
} = meta
const doi =
(articleIds && articleIds.find(aid => aid.pubIdType === 'doi')) || ''
......@@ -360,6 +399,8 @@ const enhancedFormik = withFormik({
electronicmonth: (e && e.month) || '',
electronicday: (e && e.day) || '',
electronicseason: (e && e.season) || '',
citeref: citerefUrl || '',
fulltext: fulltextUrl || '',
}
},
validationSchema: yup.object().shape({
......@@ -404,6 +445,8 @@ const enhancedFormik = withFormik({
.max(31, 'Invalid day')
.typeError('Must be a number'),
electronicseason: yup.string(),
citeref: yup.string().url('Invalid URL'),
fulltext: yup.string().url('Invalid URL'),
}),
displayName: 'manual-citation',
handleSubmit,
......
......@@ -39,6 +39,8 @@ export const QUERY_ACTIVITY_INFO = gql`
lpage
elocationId
}
citerefUrl
fulltextUrl
}
claiming {
givenNames
......
......@@ -158,6 +158,7 @@
"lint:style": "stylelint app/**/*.scss app/**/*.css",
"precommit": "lint-staged",
"setupdb": "pubsweet setupdb",
"migrate": "npx knex migrate:latest",
"seed": "npx knex seed:run && node scripts/seed.js",
"seed:journals": "node --harmony-promise-finally server/populate-journal/api.js",
"reset": "pubsweet setupdb --clobber",
......@@ -166,7 +167,7 @@
"start:services": "docker-compose up postgres ftpd_server minio xsweet",
"start:services:dev": "docker-compose -f ./docker-compose.yml -f ./docker-compose.dev.yml up postgres ftpd_server minio",
"ftp:listener": "./runFtpMonitor.sh &",
"server": "pubsweet server",
"server": "npm run migrate && pubsweet server",
"build": "NODE_ENV=production pubsweet build",
"rebuild:node-libxml": "./rebuild-node-libxml.sh",
"unit": "jest --config test/unit/jest.conf.js --coverage"
......
......@@ -4,6 +4,8 @@ echo "Running cron service"
# Add the env variables at the beginning of the cron file
env | cat - /etc/cron.d/crontab > temp && crontab temp
service cron start
echo 'Running migrations'
yarn migrate
echo "Running Seed"
yarn seed
......
#!/bin/bash
echo 'Running migrations'
yarn migrate
......@@ -107,6 +107,8 @@ class Manuscript extends EpmcBaseModel {
},
'meta,releaseDelay': { type: ['string', 'null'] },
'meta,unmatchedJournal': { type: ['string', 'null'] },
'meta,citerefUrl': { type: ['string', 'null'] },
'meta,fulltextUrl': { type: ['string', 'null'] },
teams: {
type: 'array',
items: {
......
exports.up = (knex, Promise) =>
knex.schema.table('manuscript', t => {
t.string('meta,citeref_url')
t.string('meta,fulltext_url')
})
exports.down = (knex, Promise) =>
knex.schema.table('manuscript', t => {
t.dropColumn('meta,citeref_url')
t.dropColumn('meta,fulltext_url')
})
......@@ -65,6 +65,8 @@ input ManuscriptMetaInput {
fundingGroup: [FundingGroupInput]
releaseDelay: String
unmatchedJournal: String
citerefUrl: String
fulltextUrl: String
}
input LocationInput {
......
......@@ -50,6 +50,8 @@ extend type ManuscriptMeta {
fundingGroup: [Grants]
releaseDelay: String
unmatchedJournal: String
citerefUrl: String
fulltextUrl: String
}
type Location {
......
#!/bin/bash
echo "Running pre_init.sh script"
./pre_init.sh
echo "Running server in the background"
cmd="pm2 start pm2.pubsweet.config.js"
......
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