Commit graph

53 commits

Author SHA1 Message Date
Ray Schamp
b89d644573 Fix JSON response parsing in IE
Fixes #654

IE does not honor responseType: 'json', and will not parse responses as JSON unless json data is present in the request. For some reason this issue can also be solved by including a `json` attribute on the xhr request, but if that's present, url encoded form data is overwritten with the contents of the json.  So just try to parse the response ourselves if it looks like it wasn't parsed.

See https://github.com/Raynos/xhr/issues/123
2016-07-03 15:54:58 -04:00
Matthew Taylor
04aa7e01ef check for the null value in get
thanks @rschamp!
2016-06-30 11:40:05 -04:00
Matthew Taylor
794c3e2cba Set null contents to null instead of error throw
Before, if a cookie didn't exist, it would throw an error, not causing permissions/tokens to change to empty values. This fixes that (and #626) by setting the value to undefined instead.
2016-06-30 11:27:46 -04:00
Matthew Taylor
7bb52c25fe move permissions checks to mirror session more
thanks @rschamp!
2016-06-28 14:25:11 -04:00
Matthew Taylor
9d6fb63d18 Merge branch 'feature/teacher-registration-flow' of https://github.com/rschamp/scratch-www into feature/teacher-registration-flow
* 'feature/teacher-registration-flow' of https://github.com/rschamp/scratch-www: (46 commits)
  Add serverside email validation
  Clean up
  Move registration step to main component
  Submit the rest of the fields when registering
  This help text is redundant now
  Fix organization "other" field enablement
  Get the form creating regular accounts
  Add method to api for submitting forms
  Update language chooser for formsy
  Add missing string
  Add progress indicators
  Style pass
  Remove unused label component
  Remove unused mixin factory
  Fixup api refactor
  Add serverside username validation
  L10n pass
  Explain the GeneralError component
  Add help text when a field is not required
  L10n WIP
  ...

# Conflicts:
#	src/l10n.json
#	src/views/splash/splash.jsx
2016-06-17 15:32:49 -04:00
Ray Schamp
8646bd84b3 Submit the rest of the fields when registering 2016-06-17 11:01:34 -04:00
Ray Schamp
26e1ee553b Add method to api for submitting forms
Some of our legacy endpoints expect this style rather than json.

Also clean up the way useCsrf works — don't always set json attribute to an empty object.
2016-06-16 17:24:31 -04:00
Matthew Taylor
626b3f008e Merge branch 'develop' of https://github.com/LLK/scratch-www into issue/gh-543-teacher-banner
* 'develop' of https://github.com/LLK/scratch-www: (29 commits)
  Add explore redirects
  Allow access to 2014 and 2015 pages
  use route aliases for generalizable route patterns
  remove `/components` from `routes.json`
  Remove Make it Fly banner
  Fix issues in FAQ of /developers page.
  move shuffle to utility module
  fix error with shuffleArray function
  add shuffleArray function, shuffle most loved and most remixed
  use `image` to get studio thumbnail
  quick formatting fix for box header on search
  Fix merge issue
  Add localizations, minor style changes
  Removed rows from grid, changed explore tabs
  Removed extraneous image file
  Whitespace added
  Small fix
  Support for studios
  Refactoring, new grid component
  Style changes
  ...

# Conflicts:
#	src/views/splash/splash.jsx
#	src/views/splash/splash.scss
2016-06-15 09:45:05 -04:00
Ray Schamp
cfa85427b1 Add address validation 2016-06-14 17:29:30 -04:00
Ray Schamp
f8037f6767 Lint 2016-06-14 17:29:30 -04:00
Ray Schamp
d7df1e980f Move api mixin to lib, remove mixin
The mixin doesn't gain us anything except complexity
2016-06-14 17:29:30 -04:00
Ray Schamp
56e16bc0dc Actually provide every state in world choice 2016-06-14 17:29:30 -04:00
Ray Schamp
f126a71336 Use iso-31660-2 package for country data 2016-06-14 17:29:29 -04:00
Matthew Taylor
5b73c4192d change name to getUnsignedValue
thanks @rschamp!
2016-06-13 10:06:43 -04:00
Connor Hudson
fde193ca06 move shuffle to utility module 2016-06-13 09:40:32 -04:00
Matthew Taylor
ac17850491 Add teacher banner to splash page
This only shows if the logged in user is a teacher, and persists for teachers.
2016-06-08 13:47:11 -04:00
Matthew Taylor
a860b27941 Some updates to the redux structure
1. split `auth.js` up so it's 1 reducer per file
2. consolidate the conference schedule reducers
3. make conference reducer names more descriptive
4. add error handling for `body === 'undefined'`

Thanks @rschamp for all the help!
2016-05-19 16:55:25 -04:00
Matthew Taylor
d69de477a1 Merge branch 'develop' of https://github.com/LLK/scratch-www into feature/conference-schedule
* 'develop' of https://github.com/LLK/scratch-www: (32 commits)
  Lint
  Bundle all locale data
  Don't bundle polyfills
  Set up Raven within init.js
  Prefix privacyPolicy message string
  Exclude minified javascript from linting
  One space more
  Changes "interfacesto" to "interfaces to"
  Remove tag target
  Filter before mapping to avoid returning undefined
  Fix Pass condition for "static" routes
  Spacing2
  Mangling is the default
  Spacing
  Update for typography fixes
  Cherry pick PR #476 into master
  Add invisible spacer to anchored sections
  For Developers
  Lint JSON, expand and simplify lint step
  Fix banned user redirect
  ...

# Conflicts:
#	src/redux/actions.js
#	src/redux/reducer.js
2016-05-19 13:25:36 -04:00
Matthew Taylor
b969c4e2ed Split reducers into separate files
Use a model of reducer/action files for each component that has them, and make `reducer.js` be the one that imports and configures all of them. This modeling is based on a few examples I've seen which seemed to work for our current case, but I'm totally fine with splitting actions and reducers into separate directories if we'd like too.
2016-05-19 11:34:28 -04:00
Ray Schamp
f9bb5592d4 Lint
Remove min context, we don't use it anymore.
2016-05-17 21:09:18 -04:00
Ray Schamp
650b98c009 Bundle all locale data
The npm installed version of react-intl does not include all locales, they must be added manually
2016-05-17 21:02:36 -04:00
Ray Schamp
8f2697b7f1 Move externals, polyfill and init to common chunk
This should allow us to define and update our dependencies more easily (via npm) as well as reducing the number of requests.

Additionally, when we add common packages this will avoid the issue after deploys where a user may get a cached HTML page, but new Javascript, leading to the dreaded blank page because the browser didn't download all dependencies.

Using mangle with UglifyJS also made the total file size for the common chunk bundle smaller than the current total for all of our external/polyfill scripts (1.18MB vs 1.55MB).
2016-05-16 12:59:58 -04:00
Matthew Taylor
e1cebe46db Ergonomics – get rid of typography file
1. Merge typography into main
2. Get rid of use of `#view` in scss
3. Make `render` work with conference pages
2016-05-12 18:05:26 -04:00
Ray Schamp
339c23a64e Add some sources to the unsign method 2016-03-23 10:02:20 -04:00
Ray Schamp
21dffa73f0 Fix indentation 2016-03-23 09:50:41 -04:00
Ray Schamp
96bc1b1ab1 Add method for reading session cookie
Assumes the session cookie is stored as JSON which may or may not have been compressed via zlib (indicated by a leading `.`), which is then base64-encoded, and made URL-safe by replacing all `+` and `/` characters with `-` and `_` respectively.
2016-03-22 09:11:09 -04:00
Ray Schamp
9cd5c98004 Make Jar formatting consistent with everything else 2016-03-22 09:09:42 -04:00
Ray Schamp
a5e336a175 Use redux for session handling 2016-03-18 11:51:22 -04:00
Ray Schamp
faabc63e65 Move component structure to one tree
Instead of inserting `Navigation` and `Footer` into every `render`ed component, just compose them in the views with a new `Page` component.
2016-03-18 10:54:26 -04:00
Matthew Taylor
2e79a5aa6b Merge pull request #323 from mewtaylor/bugfix/readme-update
Added some more documentation
2016-01-19 16:11:49 -05:00
Matthew Taylor
7303b7963b import main.scss in render.jsx
Fallout from #305, fixes #324
2016-01-14 14:55:24 -05:00
Matthew Taylor
112cad14e3 Added some more documentation 2016-01-14 10:25:03 -05:00
Matthew Taylor
98d0f0de6e Updates based on feedback
1. changes intl filenames to `[view].intl.js`
2. Move nav/footer rendering to `render.jsx`
3. Set locale cookie before submitting language change form

Thanks @thisandagain !
2016-01-14 08:32:43 -05:00
Matthew Taylor
ceec694b2a Revert "Migrate to using a loader method"
This reverts commit 214430b0c4.
2016-01-08 13:50:58 -05:00
Matthew Taylor
214430b0c4 Migrate to using a loader method
This moves all locale/translation building to a dependency, `scratch-www-intl-loader`, as well as tests associated with it. Also gets rid of the `make translations` step.
2016-01-07 17:01:57 -05:00
Matthew Taylor
8ae98d703f Make localizations view-based
1. Load locale strings into `window._messages` in a separate file added to `template.html`, which contains view-specific and general strings
2. Update build-locales to compile separate files
2016-01-06 14:09:32 -05:00
Matthew Taylor
f52ac1f17f Move intl loading into separate, overridden file
ht @rschamp, thanks!
2015-12-16 12:00:42 -05:00
Matthew Taylor
8c374e096d Move custom loader to main.jsx
So that it's only done once.
2015-12-16 10:43:37 -05:00
Matthew Taylor
6ff652e788 Revert "Move custom-locales.js to static/js/lib"
This reverts commit 4f541b8831.
2015-12-16 10:09:15 -05:00
Matthew Taylor
4f541b8831 Move custom-locales.js to static/js/lib
So it can be loaded ahead of time and cached. Also remove the json since it's being loaded outside of react now, and put it into the js file directly.
2015-12-16 08:32:25 -05:00
Matthew Taylor
b495beaeba Also add Latin, Aragonés 2015-12-15 18:06:03 -05:00
Matthew Taylor
08a91f8521 Add custom languages explicitly 2015-12-15 17:55:44 -05:00
Andrew Sliwinski
06de644ae6 Remove ./src/environment from Webpack config and bind environment to window. Resolves GH-199. 2015-11-03 10:49:32 -05:00
Andrew Sliwinski
44f3101069 Fix call to jar.get. Resolves GH-120 2015-10-25 18:21:07 -04:00
Matthew Taylor
7b704e878f Give name to the exported module 2015-10-16 15:10:17 -04:00
Matthew Taylor
d307b21d3d Add cookie setter to jar 2015-10-16 10:59:55 -04:00
Matthew Taylor
0577860f3a Rename renderer to render
and make it a method that returns a component, rather than an object with a render method
2015-10-15 23:11:09 -04:00
Matthew Taylor
b8972d545c refactor cookieMixinFactory
isolate cookie business logic from react mixin logic so that they are more modular. And use the cookie business logic to set translation objects on the window
2015-10-15 23:09:35 -04:00
Matthew Taylor
c3b62c8f05 Update core react dependencies 2015-10-14 22:59:38 -04:00
Andrew Sliwinski
f3d6a273fb Resolve merge conflict 2015-10-13 15:57:55 -04:00