Considerit / ConsiderIt

For deliberation and opinion visualization
GNU Affero General Public License v3.0
93 stars 14 forks source link

We need to design hyperlinks for statebus #35

Closed toomim closed 9 years ago

toomim commented 10 years ago
toomim commented 9 years ago

How might I learn how hyperlinks work now?

tkriplean commented 9 years ago

You could follow those referenced commits. Or browse browser_location.coffee.

Michael Toomim wrote:

How might I learn how hyperlinks work now?

— Reply to this email directly or view it on GitHub https://github.com/tkriplean/ConsiderIt/issues/35#issuecomment-104778617.

toomim commented 9 years ago

Ok thanks. I actually opened up the commits but it was over a thousand lines of diffs to understand. browser_location.coffee looks better. I'm most interested in how to use it as a developer who wants to make a hyperlink.

tkriplean commented 9 years ago

Cool, thanks for clarifying.

As a developer, you don't need to do anything special.

Internal link:

           A
              style: {color: '#888'}
              href: "/proposal/23432/edit"
              'Edit'

External link:

           A
              style: {color: '#888'}
              href: "http://google.com"
              'Google'

There are some esoteric options, but the basics almost always work.

One caveat is that internal links must be relative.

onClick handlers will work on your links.

Michael Toomim wrote:

Ok thanks. I actually opened up the commits but it was over a thousand lines of diffs to understand. browser_location.coffee looks better. I'm most interested in how to use it as a developer who wants to make a hyperlink.

— Reply to this email directly or view it on GitHub https://github.com/tkriplean/ConsiderIt/issues/35#issuecomment-104783567.

toomim commented 9 years ago

Ok so here's what I'm learning:

toomim commented 9 years ago

I'm guessing there might also be some sort of conventions for designing your react components to depend on the path... like seeing "/paper_43" and then extracting out the paper_43 part and knowing to load that page. But I bet for consider.it so far it's so simple that this is probably just done by hand somewhere in franklin.

toomim commented 9 years ago

Thank you. This is very cool.

tkriplean commented 9 years ago

The "router" / Page in considerit is now just a component that depends on the location key.

https://github.com/tkriplean/ConsiderIt/blob/master/%40client/franklin.coffee#L2977

Michael Toomim wrote:

I'm guessing there might also be some sort of conventions for designing your react components to depend on the path... like seeing "/paper_43" and then extracting out the paper_43 part and knowing to load that page. But I bet for consider.it so far it's so simple that this is probably just done by hand somewhere in franklin.

— Reply to this email directly or view it on GitHub https://github.com/tkriplean/ConsiderIt/issues/35#issuecomment-104785304.

tkriplean commented 9 years ago

Glad you like it. I imagine it can be improved upon. I only took it a certain distance and moved on.

Michael Toomim wrote:

Thank you. This is very cool.

— Reply to this email directly or view it on GitHub https://github.com/tkriplean/ConsiderIt/issues/35#issuecomment-104785576.

toomim commented 9 years ago

Ok cool. That explains the full loop. Thanks!