Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Add latest client js including minified version #1981

Merged
merged 1 commit into from
Jan 12, 2016

Conversation

adamsilverstein
Copy link

Full changeset: WP-API/client-js@22b1e42...477a49f

Props: @delphinus35, @adamsilverstein, @westonruter

Change highlights:

  • Api builds models and collections from Schema, no hard coded models or collections; any endpoint in the schema will be mapped; supports multiple schemas (apis); helper methods for post model: all helpers user _embed data if available, otherwise using ajax request.
  • new: Async load of api, apps can use the deferred to time startup
  • new: Ability to localize schema, falls back to making an ajax request & cached in session storage; develop branch of client js has code that only localizes data once per session
  • new Helper methods for Posts model: getCategories and setCategories
  • fix: cleanup TimeStampedMixin
  • new: models/collections get defaults and options from schema
  • fix: all code up to WordPress JavaScript coding standards
  • new: helper method to get post author user model getAuthorUser
  • new: helper method to get a featured image for a post: getFeaturedImage
  • new: models protect methods based on endpoint methods (eg. destory is blocked if an endpoint doesn't have a 'DELETE' method)
  • new: models contain a reference to the original route object
  • Ensure getters always return promise
  • Add remapping for names, see Enable a name remapping feature, remap plural models to singular client-js#75
  • additional helpers: add getMeta, getTags, getRevisions Continue creating unit testing structure #76
  • When SCRIPT_DEBUG off, use minified script; update localized data

@westonruter
Copy link
Member

I suggest amend-ing commit description in e079114 to replace master with the commit at 7573f8a (current state of master) so that the compare view will remain true after additional changes are pushed to the branch.

* Development happening at https://github.com/WP-API/client-js

Full changeset: WP-API/client-js@22b1e42...477a49f

Props: @delphinus35, @adamsilverstein, @westonruter

Change highlights:
* Api builds models and collections from Schema, no hard coded models or collections; any endpoint in the schema will be mapped; supports multiple schemas (apis); helper methods for post model: all helpers user _embed data if available, otherwise using ajax request.
* new: Async load of api, apps can use the deferred to time startup
* new: Ability to localize schema, falls back to making an ajax request & cached in session storage; develop branch of client js has code that only localizes data once per session
* new Helper methods for Posts model: getCategories and setCategories
* fix: cleanup TimeStampedMixin
* new: models/collections get defaults and options from schema
* fix: all code up to WordPress JavaScript coding standards
* new: helper method to get post author user model `getAuthorUser`
* new: helper method to get a featured image for a post: `getFeaturedImage`
* new: models protect methods based on endpoint methods (eg. destory is blocked if an endpoint doesn't have a 'DELETE' method)
* new: models contain a reference to the original route object
* Ensure getters always return promise
* Add remapping for names, see WP-API/client-js#75
* additional helpers: add getMeta, getTags, getRevisions #76
* When SCRIPT_DEBUG off, use minified script; update localized data
@adamsilverstein adamsilverstein force-pushed the features/merge-in-latest-client-js branch from e079114 to 6a77c40 Compare January 10, 2016 18:27
@adamsilverstein
Copy link
Author

@westonruter updated the comparison link in commit and pr, thanks for the tip. i'm doing the comparison link for HEAD in clientjs against where we started with last merge so you can review the full commit log.

@adamsilverstein
Copy link
Author

force pushing my amended commit message resulted in a new commit hash: 6a77c40

@westonruter
Copy link
Member

Perfect 👍

@danielbachhuber danielbachhuber added this to the 2.0 Beta 11 milestone Jan 11, 2016
@rachelbaker
Copy link
Member

@danielbachhuber are you keeping this open so it can be updated right before the Beta 11 release? Or can it be merged now?

@danielbachhuber
Copy link
Member

are you keeping this open so it can be updated right before the Beta 11 release? Or can it be merged now?

Heh. It didn't have the review label, so I forgot about it :(

danielbachhuber added a commit that referenced this pull request Jan 12, 2016
Add latest client js including minified version
@danielbachhuber danielbachhuber merged commit 5a3d39b into develop Jan 12, 2016
@danielbachhuber danielbachhuber deleted the features/merge-in-latest-client-js branch January 12, 2016 21:44
@rmccue
Copy link
Member

rmccue commented Jan 13, 2016

@adamsilverstein Looks like this didn't include the schema data that the JS plugin uses, so it causes a bunch of JS errors on the page.

@adamsilverstein
Copy link
Author

@rmccue yes, i left that out on purpose: i don't want to localize the data on each page. I have a branch in the works that attempts to localize the data once and only once per session: https://github.com/WP-API/client-js/commits/features/only-localize-schma-once

The JS should accommodate and make an ajax request for the schema data if its not localized. I thought I had checked this,assuming you cleared cache/opened a new window?

I will dig back in and make sure this is working properly. In the mean time, copy the localized data build over from the client repo.

@adamsilverstein
Copy link
Author

@rmccue testing with latest develop, client js plugin disabled. not getting js errors, setup from ajax callback works fine. might be related to model name changes? what are the specific errors you are getting?

@adamsilverstein
Copy link
Author

Actually: I am getting a JS error now: Uncaught TypeError: Cannot read property 'default' of null - I think this is coming from the session cached schema copy... digging.

@adamsilverstein
Copy link
Author

Thanks for pointing that out - removing the default post processing fixes the issue with session storage: fixed in WP-API/client-js@06987b6 : update PR incoming

@adamsilverstein
Copy link
Author

@rmccue fixed in #2022

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants