Skip to content

Conversation

@mickmcgrath13
Copy link
Contributor

@mickmcgrath13 mickmcgrath13 commented Nov 11, 2016

@mickmcgrath13
Copy link
Contributor Author

mickmcgrath13 commented Nov 11, 2016

Possible things still to do (needs discussion)

  • Responsive (do we want it to show up on mobile?
  • WebWorkers (it isn't immediately obvious to me how to set this up - i've never done it before)
  • fall-through-cache style caching with localStorage (compatible with web workers?)
  • general review of the code (it feels a bit nasty to me for some reason)
  • Move to its own module (separate from bit-docs-html-canjs)?
  • design tweaks (if any)?

discussion here: #123

@mickmcgrath13 mickmcgrath13 mentioned this pull request Nov 11, 2016
2 tasks
@mickmcgrath13
Copy link
Contributor Author

@justinbmeyer There is still one issue with this.

The search result links are currently using a pathPrefix which is set, via pathToDest here.

That pathToDest helper is in bit-docs-generate-html.

When index.html or a page at the root of the output directory temp is loaded, all the links point to the correct place.

The problem is that when a page is loaded from a "sub-directory" from the output directory (for example, /temp/can-connect/base/base.algebra.html). The pathToDest helper returns something like "../..".

One way to resolve this, potentially, would be to simply store the outputDirectory (maybe named differently), in this case temp/, on the window.

I'm not able to focus on this at the moment, but if you have a quick fix, I'd be happy to implement it within this PR. Otherwise, I'd say let's merge this PR and create an issue for the url issue in the search.

@justinbmeyer
Copy link
Contributor

Unless I'm missing something, we shouldn't merge this if its not going to work on any nested page.

The fix is to use steal.joinURI or I think can-until has something similar

Sent from my iPhone

On Nov 15, 2016, at 8:47 AM, Mick McGrath [email protected] wrote:

@justinbmeyer There is still one issue with this.

The search result links are currently using a pathPrefix which is set, via pathToDest here.

That pathToDest helper is in bit-docs-generate-html.

When index.html or a page at the root of the output directory temp is loaded, all the links point to the correct place.

The problem is that when a page is loaded from a "sub-directory" from the output directory (for example, /temp/can-connect/base/base.algebra.html). The pathToDest helper returns something like "../..".

One way to resolve this, potentially, would be to simply store the outputDirectory (maybe named differently), in this case temp/, on the window.

I'm not able to focus on this at the moment, but if you have a quick fix, I'd be happy to implement it within this PR. Otherwise, I'd say let's merge this PR and create an issue for the url issue in the search.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@justinbmeyer
Copy link
Contributor

justinbmeyer commented Nov 15, 2016

We should remove pathToDest <script> hack.

pathToRoot is already available on the docObject like:

cursor_and_canjs_-_joinuris

Can't we use http://v3.canjs.com/doc/can-util/js/join-uris/join-uris.html

window.location.href //-> http://localhost/apps/canjs/doc/can-util/js/join-uris/join-uris.html

currentDocObject.htmlPath //-> "can-util/js/join-uris/join-uris.html"
docObject.pathToRoot //-> "../../../.."
docObject.docConfig.dest //-> "./docs"
searchResult.htmlPath //-> "can-connect/something.html"

var root = joinURIs(window.location.href, docObject.pathToRoot);
root //-> "http://localhost/apps/canjs/"

var dest = joinURIs(root, docObject.docConfig.dest );
dest //-> "http://localhost/apps/canjs/docs"


var newURL = joinURIs(  dest, searchResult.dest || searchResult.htmlPath )

newURL //-> "http://localhost/apps/canjs/can-connect/something.html"
window.location.href //-> http://localhost/bit-docs-html-canjs/temp/can-util/js/join-uris/join-uris.html

currentDocObject.htmlPath //-> "can-util/js/join-uris/join-uris.html"
docObject.pathToRoot //-> "../../../.."
docObject.docConfig.dest //-> "./temp"
searchResult.htmlPath //-> "can-connect/something.html"

var root = joinURIs(window.location.href, docObject.pathToRoot);
root //-> "http://localhost/bit-docs-html-canjs"

var dest = joinURIs(root, docObject.docConfig.dest );
dest //-> "http://localhost/bit-docs-html-canjs/temp"


var newURL = joinURIs(  dest, searchResult.dest || searchResult.htmlPath )

newURL //-> "http://localhost/bit-docs-html-canjs/temp/can-connect/something.html"

@matthewp
Copy link
Contributor

Looks like this has been updated. Can you rebase with master?

@mickmcgrath13 mickmcgrath13 force-pushed the 123-search branch 2 times, most recently from 5ea069b to 7cf849a Compare May 16, 2017 20:00
…torage | some organizational refactors | minor ux tweaks
@matthewp
Copy link
Contributor

LGTM

@mickmcgrath13 mickmcgrath13 merged commit e73e5d9 into master May 17, 2017
@mickmcgrath13 mickmcgrath13 deleted the 123-search branch May 17, 2017 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants