[wp-trac] [WordPress Trac] #38342: Quick Draft: Leverage REST API endpoints

WordPress Trac noreply at wordpress.org
Tue Nov 22 13:33:43 UTC 2016


#38342: Quick Draft: Leverage REST API endpoints
---------------------------------+-----------------------------------
 Reporter:  adamsilverstein      |       Owner:  joehoyle
     Type:  enhancement          |      Status:  assigned
 Priority:  normal               |   Milestone:  Future Release
Component:  Administration       |     Version:
 Severity:  normal               |  Resolution:
 Keywords:  has-patch 4.8-early  |     Focuses:  javascript, rest-api
---------------------------------+-----------------------------------

Comment (by aduth):

 Are the `'object' === typeof attributes.content` and `'object' === typeof
 attributes.title` checks necessary? These attributes should always be
 objects.

 These are normalized because the collection manages both posts from the
 server (where content is an object) and posts newly created in the client
 prior to have being saved (where content is a string).

   I'm not wild about the date formatting code.

 With good utilities, I could see this logic living in the template. The
 bulk of the current logic is converting to the site time on the client.
 What do you envision being the arguments and return value of the utility
 method you mentioned? I'm not familiar with what's involved in adding a
 library like Moment.js, but given the quirks and variations in parsing and
 formatting dates, I couldn't recommend it enough.

   Generally speaking, the JavaScript feel overly verbose

 Are there specific parts that could be simplified? Looking over it again,
 my observations are:

 - It would be nice if we could avoid `normalizeAttributes`
 - Perhaps we could simplify the prompt (i.e. placeholder) functions
 (currently 5 functions related to it)
 - Do we even need `setActiveEditor`? This was a holdover from previous
 logic
 - The display of errors in the Form view is perhaps indirect, though I
 think fits well with the Backbone view paradigm

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38342#comment:58>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list