coralproject / ask

A better way for journalists to manage forms, submissions, and galleries. Because journalism needs everyone.
https://coralproject.net/products/ask.html
Other
42 stars 8 forks source link

Make published forms and galleries directly targetable #20

Closed jde closed 8 years ago

jde commented 8 years ago

We are publishing static galleries and forms. The links that we use to target them, however, proxy through elkhorn.

pablocubico commented 8 years ago

As of now we are building a single JS bundle per Form as: [someid].js

This file is used in the embed code option:

<div id="ask-form"></div><script src="http://localhost:4444/widgets/57a20634c29ca00006dfa8f2.js"></script>

To serve a standalone file we could: a) create an HTML file with the iframe code and the JS bundle b) create an HTML file with the iframe code referencing the JS bundle

That said, you still need some web server to host these files and make them accesible.

On the funny side of things, looks like Amazon forces download of HTML files: https://s3.amazonaws.com/nyt-stage/57a20634c29ca00006dfa8f2.html

pablocubico commented 8 years ago

Pinging @impronunciable too for opinions.

impronunciable commented 8 years ago

@pablocubico

1 - I'll go for a) that will make the form render FAST (also we can add a SW and make it work offline (?))

2 - The download force can be mitigated setting the content type as text/html

pablocubico commented 8 years ago

So, this is mostly working except that we need to store at least the base URL somewhere, as we are doing some hardcodish duct-taping to show the URLs.

Related PRs: https://github.com/coralproject/elkhorn/pull/79 https://github.com/coralproject/cay/pull/587

jde commented 8 years ago

Please never hardcode urls, even if it is to see something working. They have caused much pain so far.

I believe the idea is that:

So Elkhorn knows where the files go based on configuration. Cay knows where the files are for that form.

pablocubico commented 8 years ago

So, should we create an issue to make Pillar store the address?

kgardnr commented 8 years ago

I'm removing the "blocked" tag since @pablocubico is going to do the pillar work.

cc @jde

impronunciable commented 8 years ago

@pablocubico is this for review now?

pablocubico commented 8 years ago

not yet! working on it

jde commented 8 years ago

Concerning where to save the location(s) of published file(s), the settings parameter is of type interface{} meaning that it will capture and return any data structures that you throw at it. You can add the published locations with no updates to Pillar like so:

  form.settings.publishedUrl
pablocubico commented 8 years ago

This is now ready for review, we are storing the baseUrl for a form in:

form.settings.baseUrl

and the one for a gallery in

gallery.config.baseUrl

Which is also of interface{} type on PIllar.

What to test

Create a form and check all the embed codes, they should reflect your Elkhorn config (S3 or filesystem). Publish a gallery and do the same check.