Fordham-lawlib-bento / fordham-law-search

A bento-style search UI for fordham law resources.
0 stars 0 forks source link

Embed search form #33

Closed jrochkind closed 7 years ago

jrochkind commented 7 years ago

This code perhaps could be cleaner or less confusing. @joshhepworth , would you like to review and see if you have any feedback or suggestions?

jrochkind commented 7 years ago

Closes #29 @tkaczorowski Embed code is now present. Instructions below copied from Readme.

Feel free to test it out and/or share it with your WP admin staff for any feedback.

Embed Search Form

A utility to embed the search form on a remote page is included. It uses javascript to do the embed, the javascript places an iframe on the host page.

There are two ways to trigger embedding:

1. Script tag

Anywhere on your page, place a script tag:

<script src="//fordham-law-search-demo.herokuapp.com/search-embed.js" async></script>

The search form will appear on the page where the script tag has been placed.

2. Specified insertion point with DOM id

Anywhere on your page, include an HTML element, perhaps an empty placeholder div, with a unique 'id' of your choice:

<div id="searchFormHere"></div>

Now include a javascript script tag wherever you'd like (such as <head> section), specifying that id:

 <script src="//fordham-law-search-demo.herokuapp.com/search-embed.js?hostDomId=searchFormHere" async></script>

The search form will be placed just before the element whose id is specified.

note url fordham-law-search-demo.herokuapp.com is the demo, final URL yet to be determined.

trigger focus and/or selection of search type

If the host page that includes the embed is accessed with special URL query params, it can trigger search form setup:

jrochkind commented 7 years ago

@tkaczorowski sorry, forgot to actually deploy, but it should be there now, i just tested it seemed to work.

tkaczorowski commented 7 years ago

Working for me too!

From: Jonathan Rochkind [mailto:notifications@github.com] Sent: Thursday, December 01, 2016 12:48 PM To: Fordham-lawlib-bento/fordham-law-search < fordham-law-search@noreply.github.com> Cc: tkaczorowski tkaczorowski@law.fordham.edu; Mention < mention@noreply.github.com> Subject: Re: [Fordham-lawlib-bento/fordham-law-search] Embed search form (#33)

@tkaczorowski https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_tkaczorowski&d=DgMCaQ&c=aqMfXOEvEJQh2iQMCb7Wy8l0sPnURkcqADc2guUW8IM&r=ufwSdmS5IZPSMZUMObqD9D-VUZ9gAg0GtO2ab7PNYjU&m=B4zzKQltuRsjRE8nP1kjwHiyo0pFfeTHXRpgkwfbvNg&s=kcwgy-roaaJb5grYrnPep3PmWAvj9OWz1DDkQv-oGu8&e= sorry, forgot to actually deploy, but it should be there now, i just tested it seemed to work.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_Fordham-2Dlawlib-2Dbento_fordham-2Dlaw-2Dsearch_pull_33-23issuecomment-2D264242587&d=DgMCaQ&c=aqMfXOEvEJQh2iQMCb7Wy8l0sPnURkcqADc2guUW8IM&r=ufwSdmS5IZPSMZUMObqD9D-VUZ9gAg0GtO2ab7PNYjU&m=B4zzKQltuRsjRE8nP1kjwHiyo0pFfeTHXRpgkwfbvNg&s=i2jmGwzH5lGFd5UFG0a4O3D-HOB3d82lHSw9vqRQ398&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AOW-2DfkiQY6mgOx5-2DxTAlZSpcbqvVS10Dks5rDwgzgaJpZM4LAqT6&d=DgMCaQ&c=aqMfXOEvEJQh2iQMCb7Wy8l0sPnURkcqADc2guUW8IM&r=ufwSdmS5IZPSMZUMObqD9D-VUZ9gAg0GtO2ab7PNYjU&m=B4zzKQltuRsjRE8nP1kjwHiyo0pFfeTHXRpgkwfbvNg&s=yhia4rrmQyDMBsmQWUT96OAZUU-RM8dBysJApHPMICE&e= .