INN / umbrella-ghn

Umbrella repository for Georgia Health News
GNU General Public License v2.0
0 stars 1 forks source link

Redo the post sharing buttons #14

Closed benlk closed 4 years ago

benlk commented 4 years ago

Changes

This pull request makes the following changes:

Screen Shot 2020-05-05 at 11 45 44

Why

For #9 and #GTN

Testing/Questions

Features that this PR affects:

Questions that need to be answered before merging:

Steps to test this PR:

  1. /wp-admin/admin.php?page=goliath-admin : uncheck "show share counter below post"; check "show share buttons above post image"
  2. view an article such as /2020/04/reusable-protective-gear-rescue/
  3. test the buttons:
    • Facebook button should open a Facebook share intent window
    • Tweet button should open a Twitter share intent window, with the "via" parameter of either 1) the author's twitter handle if that's set in the author profile or 2) the sitewide twitter handle that's used for the twitter button in the header
    • Email button should open your preferred email client with an excerpt and link included
  4. test the alternate case of the Tweet button by setting/unsetting the post author's twitter handle. For the post given above, the author is wp-admin/user-edit.php?user_id=140
joshdarby commented 4 years ago

@benlk Am I missing a setting? I checked Show share buttons above post image and unchecked Show share counter below post but still don't see the icons :/

Screen Shot 2020-05-05 at 12 55 00 PM

joshdarby commented 4 years ago

Jk, apparently I had the wrong checkboxes checked. This did it

Screen Shot 2020-05-05 at 12 57 46 PM

joshdarby commented 4 years ago

I'm seeing 2 new JS errors here coming from the child theme theme.js

theme.js?ver=1588628586:524 Uncaught ReferenceError: ajax_object is not defined
    at Object.initOverlays (theme.js?ver=1588628586:524)
    at Object.init (theme.js?ver=1588628586:34)
    at HTMLDocument.<anonymous> (theme.js?ver=1588628586:4)
    at i (jquery.js?ver=1.12.4-wp:2)
    at Object.fireWith [as resolveWith] (jquery.js?ver=1.12.4-wp:2)
    at Function.ready (jquery.js?ver=1.12.4-wp:2)
    at HTMLDocument.J (jquery.js?ver=1.12.4-wp:2)

coming from if(ajax_object.show_post_quick_view === 'on')

and

theme.js?ver=1588628586:766 Uncaught ReferenceError: ajax_object is not defined
    at Object.initAffixSidebar (theme.js?ver=1588628586:766)
    at theme.js?ver=1588628586:15
    at dispatch (jquery.js?ver=1.12.4-wp:3)
    at r.handle (jquery.js?ver=1.12.4-wp:3)

coming from if(ajax_object.enable_sidebar_affix === 'on')

joshdarby commented 4 years ago

Those are probably happening because we need to redo the localize function found here that pulls in that var

https://github.com/INN/umbrella-ghn/blob/d95b02bae93857f512072dc6a4ce994665091009/wp-content/themes/goliath/theme/theme-functions.php#L175-L200

benlk commented 4 years ago

It does make sense that dequeueing and deregistering the script would delocalize it as well.

58c586c65ed7c8840b55bc4b50f14d7fb26badb9 relocalizes it, as well as making sure that the child theme's JS is the one in use.