[wp-trac] [WordPress Trac] #24695: Disabling the Save and Publish buttons when heartbeat connection is in error state

WordPress Trac noreply at wordpress.org
Thu Jul 18 15:22:18 UTC 2013


#24695: Disabling the Save and Publish buttons when heartbeat connection is in
error state
------------------------------------------+-------------------------
 Reporter:  azaozz                        |       Owner:  carldanley
     Type:  defect (bug)                  |      Status:  reviewing
 Priority:  normal                        |   Milestone:  3.6
Component:  Administration                |     Version:  trunk
 Severity:  normal                        |  Resolution:
 Keywords:  has-patch commit 2nd-opinion  |
------------------------------------------+-------------------------

Comment (by carldanley):

 Replying to [comment:12 nacin]:
 > [attachment:24695.diff] (some stuff as carldanley's patch, just pared
 down a bit to match existing dev patterns) is tested and works.

 I'm ok with the code being pared down to what you think makes more sense.
 However, for what it's worth, please consider the following:

 I'm following the brace coding styles from jQuery
 (http://contribute.jquery.org/style-guide/js/#spacing) which happen to be
 found in WP as well (http://make.wordpress.org/core/handbook/coding-
 standards/javascript/#ifelse). Douglas Crockford also specifies this
 requirement here:
 http://javascript.crockford.com/code.html#compound%20statements. Also,
 http://net.tutsplus.com/tutorials/javascript-ajax/24-javascript-best-
 practices-for-beginners/. It's important to use braces in JS so things
 aren't left up to the compiler to decide where it's placed and results in
 more secure code.

 Also,  function declarations are much faster than named function
 expressions (see http://jsperf.com/function-declaration-vs-function-
 expression). That being said, my advice is to make sure that we move the
 anonymous function out of `.success()` and back into it's own function.

 > Two things:
 >  1. I feel like a "Try again" link is still going to be useful for
 people who want immediate gratification. A spinner could be used — and in
 fact, it may not be a bad idea for a spinner to always be spinning here,
 since we want them to know we're actively trying to regain connection.

 I agree with this. Not sure where the placement of said loader would be.

 >  2. We should consider telling them (assuming window.sessionStorage)
 that we're trying to log their data to the browser, in case there's an
 issue.

 Not a bad idea. We need to flesh these details out I think.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24695#comment:14>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list