Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Update article comment form ids #483

Merged
merged 2 commits into from
Nov 10, 2015
Merged

Update article comment form ids #483

merged 2 commits into from
Nov 10, 2015

Conversation

cshold
Copy link
Contributor

@cshold cshold commented Nov 4, 2015

A pending PR in Shopify (https://github.com/Shopify/shopify/pull/57450) will reload the page after a comment form submission with either #comments or #comment_form as a hash in the URL.

  • #comments already works as expected on a successful post
  • #comment_form will be added when the form has errors, jumping the page down to the anchor on the form so the user can fix the mistakes

This PR removes the hacky JS that got around having accurate URL hashes and updates the IDs.

cc @Shopify/themes-team @mac-adam-chaieb

FYI @Shopify/theme-support, this can be a reference for updating other themes. Ping me with any questions.

{% endcomment %}
<div class="form-vertical">
<div id="comment-form" class="form-vertical">

Choose a reason for hiding this comment

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

please remove this, as {% form 'new_comment', article %} will dynamically generate a form with id="comment_form"

cshold added a commit that referenced this pull request Nov 10, 2015
Update article comment form ids
@cshold cshold merged commit 68aa090 into master Nov 10, 2015
@cshold cshold deleted the comment-form branch November 10, 2015 20:42
@suture
Copy link

suture commented Nov 11, 2015

Just a small detail :)

It seems the hash that gets added is #comment_form not #comment-form

@suture
Copy link

suture commented Nov 11, 2015

Also in blog.liquid you need to update the Comments link (in the meta data) which has the old hash #Comments

@carolineschnapp
Copy link
Contributor

@suture

Also in blog.liquid you need to update the Comments link (in the meta data) which has the old hash #Comments

Good one, thanks so much! We'll fix that.

We fixed #comment-form to #comment_form in the above comment.

@cshold
Copy link
Contributor Author

cshold commented Nov 11, 2015

Good catch, thanks @suture

@suture
Copy link

suture commented Nov 11, 2015

Maybe another problem. If you delete this, we no longer get a success message.

{% if form.posted_successfully? %}
      {% assign newHash = 'Comments' %}
 {% endif %}

@cshold
Copy link
Contributor Author

cshold commented Nov 11, 2015

Will be adding that in another PR shortly

Edit: this may actually be a bug with the update in core, preventing comments.created_at from being sent to the page after a successful post. Digging in now.

@suture
Copy link

suture commented Nov 11, 2015

Many thanks for following that up.

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

Successfully merging this pull request may close these issues.

4 participants