Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove image caption #912

Merged
merged 1 commit into from
Mar 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions cypress/fixtures/seed/howtos.json
Original file line number Diff line number Diff line change
Expand Up @@ -2002,7 +2002,6 @@
],
"text": "Alright so before starting, here some basics to check out and prepare first.\n\nFor this technique you will need:\nMachines: Shredder (or already shredded plastic), Extrusion machine, Oven\nTools: Scissors / Knife, Pliers, Weighing scales and two containers, Silicone oil, Clamps, Spanner\nMaterials: Polystyrene and pigment\n\nIf you haven't extruded beams before, learn more in the How-to \"Make a mould for beams\".\n(https://community.preciousplastic.com/how-to/make-a-mould-for-extruding-beams)",
"_animationKey": "unique1",
"caption": "",
"title": "Get ready"
},
{
Expand All @@ -2020,7 +2019,6 @@
],
"text": "When melting plastic, bad fumes can be released. In order to work safer, make sure to use a breathing mask with ABEK filters to prevent inhaling possibly toxic fumes. Special attention on plastics like PS (polystyrene) and PVC. Also when handling with heated elements and plastic we recommend to wear working gloves.\n\nRecommended safety equipment: ABEK mask, gloves and glasses",
"_animationKey": "unique2",
"caption": "",
"title": "Stay safe"
},
{
Expand All @@ -2038,8 +2036,7 @@
}
],
"text": "Selecting the right material is crucial when it comes to aesthetics. What properties does the material have, what colour is it? \nAs PS stays transparent in the recycling process, it has the perfect quality to make a light. Collect your clean PS, which is typically found in old CD and cassette cases. Make sure to shred enough, the required amount will vary depending on the size of your mould.",
"_animationKey": "unique3",
"caption": ""
"_animationKey": "unique3"
},
{
"text": "Now we use pigment to add colour to the transparent polystyrene. You can find it online (search for 'pigment for polystyrene'), but do check out if you can find it in a local shop. Using pigment has the advantage that it keeps the translucency of your material. If you only have access to coloured PS plastic, you will probably not get the same effect (unless the plastic is also translucent), so this will need some testing.\n
Start by cutting one pellet of pigment into smaller pieces. The pigment we use (___) has a really strong affect so you only need a small amount to mix with.",
Expand Down
18 changes: 2 additions & 16 deletions cypress/integration/howto/write.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe('[How To]', () => {
stepNumber: number,
title: string,
description: string,
caption: string,
images: string[],
) => {
const stepIndex = stepNumber - 1
Expand All @@ -42,9 +41,6 @@ describe('[How To]', () => {
cy.get('[data-cy=step-description]')
.clear()
.type(`Description for step ${stepNumber}`)
cy.get('[data-cy=step-caption]')
.clear()
.type('What a step caption')
cy.step('Uploading pics')
const hasExistingPics =
Cypress.$($step).find('[data-cy=delete-step-img]').length > 0
Expand Down Expand Up @@ -76,7 +72,6 @@ describe('[How To]', () => {
const expected = {
_createdBy: 'howto_creator',
_deleted: false,
caption: 'Intro caption goes here ...',
description: 'After creating, the how-to will be deleted',
difficulty_level: 'Medium',
time: '1-2 weeks',
Expand All @@ -95,7 +90,6 @@ describe('[How To]', () => {
steps: [
{
_animationKey: 'unique1',
caption: 'What a step caption',
images: [
{
contentType: 'image/jpeg',
Expand All @@ -115,7 +109,6 @@ describe('[How To]', () => {
},
{
_animationKey: 'unique2',
caption: 'What a step caption',
images: [],
text: 'Description for step 2',
title: 'Step 2 is easy',
Expand Down Expand Up @@ -144,14 +137,13 @@ describe('[How To]', () => {
selectDifficultLevel(expected.difficulty_level as Difficulty)

cy.get('[data-cy=intro-description]').type(expected.description)
cy.get('[data-cy=intro-caption]').type(expected.caption)
cy.step('Upload a cover for the intro')
cy.get('[data-cy=intro-cover]')
.find(':file')
.uploadFiles('images/howto-intro.jpg')

expected.steps.forEach((step, index) => {
fillStep(index + 1, step.title, step.text, step.caption, [
fillStep(index + 1, step.title, step.text, [
'images/howto-step-pic1.jpg',
'images/howto-step-pic2.jpg',
])
Expand Down Expand Up @@ -185,7 +177,6 @@ describe('[How To]', () => {
const expected = {
_createdBy: 'howto_editor',
_deleted: false,
caption: 'Caption edited!',
description: 'After editing, all changes are reverted',
difficulty_level: 'Hard',
files: [],
Expand All @@ -202,7 +193,6 @@ describe('[How To]', () => {
steps: [
{
_animationKey: 'unique1',
caption: 'What a step caption',
images: [
{
contentType: 'image/jpeg',
Expand All @@ -222,7 +212,6 @@ describe('[How To]', () => {
},
{
_animationKey: 'unique3',
caption: 'What a step caption',
images: [
{
contentType: 'image/jpeg',
Expand Down Expand Up @@ -277,9 +266,6 @@ describe('[How To]', () => {
cy.get('[data-cy=intro-description]')
.clear()
.type(expected.description)
cy.get('[data-cy=intro-caption]')
.clear()
.type(expected.caption)

cy.step('Update a new cover for the intro')

Expand All @@ -292,7 +278,7 @@ describe('[How To]', () => {
deleteStep(2)

expected.steps.forEach((step, index) => {
fillStep(index + 1, step.title, step.text, step.caption, [
fillStep(index + 1, step.title, step.text, [
'images/howto-step-pic1.jpg',
'images/howto-step-pic2.jpg',
])
Expand Down
5 changes: 1 addition & 4 deletions cypress/support/custom-assertions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const eqHowto = (chaiObj, utils) => {
const {
_createdBy,
_deleted,
caption,
description,
difficulty_level,
slug,
Expand All @@ -29,7 +28,6 @@ const eqHowto = (chaiObj, utils) => {
expect(subject, 'Basic info').to.containSubset({
_createdBy,
_deleted,
caption,
description,
difficulty_level,
slug,
Expand All @@ -53,10 +51,9 @@ const eqHowto = (chaiObj, utils) => {
const eqHowtoStep = (chaiObj, utils) => {
function compare(this: any, expected: any, index: number) {
const subject: IHowtoStep = this._obj
const { _animationKey, caption, text, title } = expected
const { _animationKey, text, title } = expected
expect(subject, `Step ${index} with info`).to.containSubset({
_animationKey,
caption,
text,
title,
})
Expand Down
3 changes: 0 additions & 3 deletions src/models/howto.models.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ export interface IHowtoStep extends IHowToStepFormInput {
images: Array<IUploadedFileMeta | null>
title: string
text: string
caption?: string
_animationKey?: string
}

export interface IHowToStepFormInput {
images: Array<IUploadedFileMeta | IConvertedFileMeta | null>
title: string
text: string
caption?: string
_animationKey?: string
}

Expand All @@ -46,5 +44,4 @@ export interface IHowtoFormInput extends IModerable {
slug: string
// note, tags will remain optional as if populated {} will be stripped by db (firestore)
tags?: ISelectedTags
caption?: string
}
8 changes: 0 additions & 8 deletions src/pages/Howto/Content/Common/Howto.form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,6 @@ export class HowtoForm extends React.Component<IProps, IState> {
This image should be landscape. We advise
1280x960px
</Text>
<Flex mt={2}>
<Field
name="caption"
data-cy={'intro-caption'}
component={InputField}
placeholder="Insert Caption"
/>
</Flex>
</Flex>
</Flex>
</Flex>
Expand Down
Loading