Skip to content
Ember web client for gothamist.com
JavaScript HTML Shell Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Fix typo Aug 29, 2019
config Remove wagtail specific build stuff Aug 27, 2019
exportist small tweaks to get it to run all the way through without errors Aug 26, 2019
fastboot/initializers more init Feb 20, 2019
lib/pattern-lab-styles remove google custom search engine Aug 26, 2019
mirage provide value for gallery's default image Aug 27, 2019
nginx do not intercept errors from cdn origin Aug 28, 2019
public add default og image Jun 27, 2019
scripts update ancillary Gothamist RSS feeds Aug 27, 2019
tests test assertion message typo Aug 27, 2019
vendor Initial Commit from Ember CLI v3.7.1 Feb 20, 2019
.dockerignore adds tests for nginx & executes in CircleCI Apr 12, 2019
.editorconfig Initial Commit from Ember CLI v3.7.1 Feb 20, 2019
.ember-cli Initial Commit from Ember CLI v3.7.1 Feb 20, 2019
.env.deploy.sample more init Feb 20, 2019
.env.sample adds champ endpoint to config Aug 26, 2019
.eslintignore Initial Commit from Ember CLI v3.7.1 Feb 20, 2019
.eslintrc.js remove google custom search engine Aug 26, 2019
.gitignore update ember-cli Apr 9, 2019
.template-lintrc.js Update template space-filler syntax and linter rules Jun 18, 2019
.travis.yml Initial Commit from Ember CLI v3.7.1 Feb 20, 2019
.watchmanconfig Initial Commit from Ember CLI v3.7.1 Feb 20, 2019
Dockerfile adds tests for nginx & executes in CircleCI Apr 12, 2019
README.md inculde readme notes on pattern lab in repo addon Jun 5, 2019
circle.yml Remove wagtail specific build stuff Aug 27, 2019
ember-cli-build.js Update sourcemap config Aug 12, 2019
fastboot.js don't use UA strings for health checks anymore May 30, 2019
package.json Bump design system version Aug 26, 2019
testem.js this annoying error Apr 9, 2019
yarn.lock Bump design system version Aug 26, 2019

README.md

gothamist-web-client

This is the ember web client for gothamist.com. Most of the components and styles are provided by the nypr-design-system.

Prerequisites

You will need the following things properly installed on your computer.

Installation

  • git clone git@github.com:nypubliradio/gothamist-web-client.git this repository
  • cd gothamist-web-client
  • yarn install

Running / Development

ember-cli-mirage is disabled by default, but you run a local dev server with the following:

$ MIRAGE=1 ember serve

It can be MIRAGE=<any truthy value> to start enable mirage with that local server instance.

Running Tests

  • ember test
  • ember test --server

Linting

  • yarn lint:hbs
  • yarn lint:js
  • yarn lint:js --fix

Building

  • ember build (development)
  • ember build --environment production (production)

Deploying

Deployments are handled by ember-cli-deploy and associated plugins. Commits are pushed to our CircleCI account, where tests are run every time. CircleCI will also run deployments.

Commits to master (and merged pull requests) will deploy to https://gothamist-client.demo.nypr.digital.

Branches that follow the pattern /[A-Za-z-_]+\/[A-Za-z-_\d]+/ will deploy a QA build. You can read more on QA builds here.

Manual Static Deploys

The ember app can be deployed locally by running ember deploy [deploy target], where [deploy target] is one of:

  • demo
  • prod

It will build with any values specified in your .env file, so make sure it's got the correct values for your target environment.

Further Reading / Useful Links

Nginx

The production/demo fastboot clients sit behind an Nginx reverse proxy. Nginx runs alongside the fastboot application within the same container. Both processes are managed by supervisord. The supervisord config is nginx/supervisord.conf.

Nginx handles a series of legacy re-redirects ported from the pre-NYPR frontend Apache config. These can be found in nginx/nginx.conf.

Nginx also provides a 1s cache to rate-limit requests to the fastboot app, this should help relieve the 'thundering herd' effect caused by cache invalidation.

A set of tests for Nginx rules is available in scripts/test_nginx.sh. To run the tests: build the Docker image and run the script from a container.

docker build -t gothamist-web-client .
docker run gothamist-web-client ./scripts/test_nginx.sh

Notes

store.queryRecord('article') throws a 404

Use queryRecord to retrieve a piece of primary content, such as for an article detail view. The presumption in this case is that browser URL contains a piece of uniquely identifying information, like a slug or an id.

Under these circumstances, the semantics dictate that the adapter should throw a DS.NotFoundError if the the network request returns a response perceived as empty, and the application will render a 404 page.

If you want to make a request that can return empty without rendering a 404 page, use the query method on the store. The API is exactly the same, except the returned value will always be a list.

Newsletter Signups

Use the opt-in service to subscribe people to mailchimp newsletters. The subscribe end point is described here.

link-to params

link-to components that are nested within the design system have been built to accept a params array instead of the conventional positional params, e.g.

{{#link-to 'article' 'my-article-identifier'}}`
  My Article
{{/link-to}}

link-to components accept a params argument that is an array of values identical to the positional params, so most link-to invocations look like this: {{link-to params=@params}}, where @params is usually passed in like so:

<MyDesignSystemComponent
  @routeParams={{array 'article' 'my-article-identifier'}}
/>

This syntax also accepts query params, but with slightly more plumbing involved:

<MyDesignSystemComponent
  @routeParams={{array 'article' 'my-article-identifier' (hash isQueryParams=true values=(hash to='comments'))}}
/>

The link-to component looks for isQueyParams on the final value in the @params array, and then uses whatever is at the values key to construct query params for the link. It's weird, but it works!

twitter embeds

The twitter embed script is included on the index page. It seems to allow for better async handling of rendering embedded tweets.

pattern lab

Pattern lab styles are built by the pattern lab repo at [https://github.com/nypublicradio/pattern-lab]. When a new release is cut, the CSS is compiled and shipped to prod infra for the gothamist web client.

The pattern-lab-styles in repo addon controls the path to the styles included in the index file.

  • When deploying, the path is root-relative
  • When in development, the path is absolute to SouthLeft's staging server
  • When LOCAL_STYLES is set in .env, the path is to a local pattern lab server, set to point to localhost:8020
You can’t perform that action at this time.