Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

adds banner error if no image submitted with reportback#6286

Merged
katiecrane merged 3 commits intoDoSomethingArchive:devfrom
katiecrane:rb-image
Mar 24, 2016
Merged

adds banner error if no image submitted with reportback#6286
katiecrane merged 3 commits intoDoSomethingArchive:devfrom
katiecrane:rb-image

Conversation

@katiecrane
Copy link
Contributor

What's this PR do?

If a user tries to submit a reportback with no image attached, they get a "Oops! Make sure to upload a photo of you completing the campaign before submitting." in the same way that they get an error when uploading their picture if their image is too small.

How should this be manually tested?

Try to submit a reportback with no image. Try to submit a reportback with no image a few times. Try to submit a correct reportback to make sure the error goes away. Yay!

What are the relevant tickets?

Fixes #5141

cc: @weerd @DFurnes

@angaither
Copy link
Contributor

handing this over to a :js:smen

if (!($reportbackSubmissions.find(".messages.error").length > 0)) {
$reportbackSubmissions.prepend("<div class='messages error'>Oops! Make sure to upload a photo of you completing the campaign before submitting.</div>");
}
return done({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like indentation might be a bit off here.

@DFurnes
Copy link
Contributor

DFurnes commented Mar 18, 2016

Not 100% necessary for merge, but I'd like to get in the habit of updating files to ES2015 syntax whenever we touch them. It should be pretty straightforward to remove the /* eslint-disable */ at the top of that file and fix whatever errors are displayed when you run grunt test in the theme directory.

* Initialize the ImageUpload interface.
*/
imageUploadInit: function() {
imageUpload(this.$uploadButton);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, is this from this rule? I think if we remove the new operator, all the references to this inside the ImageUpload function will refer to the window object, rather than being stored on the image uploader itself. I think a good solution for now would be to store new ImageUpload to a property on the Reportback object to silence the warning without changing behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DFurnes Sure is. Okay I will look into that. Thanks!

@DFurnes
Copy link
Contributor

DFurnes commented Mar 24, 2016

The rest of the changes in b9fbc51 look good! 👍

If you're up for it, it'd be great to remove the warnings from the js/validators/reportback.js that you had updated in this PR as well.

@katiecrane
Copy link
Contributor Author

@DFurnes Oh yeah, there are 3 changed files! Yeah I will go for that one as well

@DFurnes
Copy link
Contributor

DFurnes commented Mar 24, 2016

:shipit:

@katiecrane katiecrane merged commit 5fa2c8f into DoSomethingArchive:dev Mar 24, 2016
@katiecrane katiecrane deleted the rb-image branch March 24, 2016 17:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants