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

Corrections to proposal help text #3243

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

AndrewKvalheim
Copy link
Member

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the upstream master branch.
  • The tests pass locally with my changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate).

Short description of what this resolves

Three interconnected issues related to help text on the proposal form:

  1. The proposal form ignores the length requirements of event types. It always displays a hard-coded value:

    Abstracts must be between 0 and 250 words.

  2. The static proposal form contains unevaluated view code:

    You have used = @event.abstract_word_count words.

  3. #3138 introduced a JavaScript error on pages that don’t contain the proposal form:

     Uncaught TypeError: text is undefined
       at word_count (app/assets/javascripts/osem.js:134)
    

Changes proposed in this pull request

  1. Restore the length requirement data accidentally lost in Rails7 #2914.

  2. Correct the malformed Haml.

  3. The purpose of the code that triggers the error is to immediately overwrite server-rendered content on the client. Ideally the server should just render the correct content in the first place. So do that, and remove the now unnecessary client side render.

Covers:

  - initial form of new proposal
  - changed form of new proposal
  - initial form of existing proposal
  - changed form of existing proposal
Accidentally lost during 81853d1

Resolves:

  1) Event as a participant not signed_in user submits proposal
     Failure/Error: expect(page).to have_text 'Abstracts must be between 0 and 500 words.'
       expected to find text "Abstracts must be between 0 and 500 words." in "…Abstracts must be between 0 and 250 words.…"
     # ./spec/features/proposals_spec.rb:94

250 is the initial value hard-coded in app/views/proposals/_form.html.haml
Prior to this the view literally contained:

    You have used = @event.abstract_word_count words.
Incidentally resolves a JavaScript error introduced in openSUSE#3138 affecting
pages without the proposal form:

    Uncaught TypeError: text is undefined
      at word_count (app/assets/javascripts/osem.js:134)
@AndrewKvalheim
Copy link
Member Author

Failed quality gates - This function has too many statements.

How do I run this locally? What JSHint configuration is it using?

@hennevogel
Copy link
Member

How do I run this locally?

I don't think Codacy supports this.

What JSHint configuration is it using?

The one setup in the tool. If you login there you can enabled/disabled hints. We can also carry a .jshintrc in the repo and Codacy would pick it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants