Commit Graph

580 Commits

Author SHA1 Message Date
George Stephanis d5dd12a8f7 The name resetter should also be run after each render. 2015-08-07 15:47:26 -04:00
George Stephanis 6cd4ddb71b Wrap the rendering code inside a function that the data can be passed to. 2015-08-07 15:44:10 -04:00
George Stephanis d297a1ac62 Ernest the JS so none of it evaluates before dom ready. 2015-08-07 15:36:12 -04:00
George Stephanis 846dcb95c6 Inline documentation explaining some functionality. 2015-08-07 15:34:45 -04:00
George Stephanis 55e0bb6302 Add some code comments. 2015-08-07 15:30:12 -04:00
George Stephanis bad9e9d3bd Reposition when autocomplete is triggered.
Also, instead of searching through the whole dom, only search in the
tbody.
2015-08-07 15:29:56 -04:00
George Stephanis 56dc05d80e Whitespace tweaks 2015-08-07 15:24:49 -04:00
George Stephanis 94618db86a Optimization: Don't use $.size(), use native Object.length instead. 2015-08-07 15:24:35 -04:00
George Stephanis 516977bd01 JSHint fixes.
The other advantage of splitting js out of php files — jshint can run
on it! :) :) :)
2015-08-07 12:10:01 -04:00
George Stephanis 69b6936d4d Don't constantly rescan the dom for tbody
We have a cached version of $tbody a level up.
2015-08-07 12:01:40 -04:00
George Stephanis 9ae32254f2 Swap `jQuery` to `$`
It’s more readable, and safe to do as we’ve aliased it back in the
enclosure.
2015-08-07 12:00:22 -04:00
George Stephanis c4768e5274 Migrate current_class from php to js 2015-08-07 11:58:16 -04:00
George Stephanis b030927590 Extract 'No Rows Selected' string 2015-08-07 11:58:02 -04:00
George Stephanis 4221c7be24 Extract the autocomplete for states and countries data.
Localize it!
2015-08-07 11:57:38 -04:00
George Stephanis 65eb16fe8a Migrate csv columns to localize script. 2015-08-07 11:47:39 -04:00
George Stephanis 974b337fbb Move js in from php template file. 2015-08-07 11:42:49 -04:00
George Stephanis b0a485a5e6 Change variable name to consistent `$tbody` 2015-08-07 11:41:59 -04:00
George Stephanis 64f48f8706 Rename and tweak how js is registered.
Thanks @claudiosmweb for the suggestion to match existing conventions.
2015-08-07 11:36:38 -04:00
George Stephanis cca93cd09e Prefix template name with `wc-`
Good call, @mikejolley
2015-08-07 11:14:55 -04:00
George Stephanis 729e6c924c Big changeover to JS templating for the table.
Switching over to building the table with JS — wp.template.

We are now using the same JS template for existing rows and newly
generated rows on the fly — this should simplify things moving forward.

I’ve also started building stuff in an external JS file rather than
straight on the page.  Will continue migrating things to it and
localizing as needed.

Saved ( 2 * displayed tax rates - 1 ) db queries per page load by doing
the locations all in one query and then parceling them out in php.

More coming.
2015-08-07 11:04:55 -04:00
Claudio Sanches 054dfe0c7b Changed default Underscore's template for wp.template in API Keys 2015-08-05 15:02:55 -03:00
Brent Shepherd 501f0b752f Save product type before saving variations
WooCommerce prior to WC 2.4 saved the product type before any variations were saved because
WC_Meta_Box_Product_Data::save_variations() was called by WC_Meta_Box_Product_Data::save().
However, in WC 2.4 the variations are saved independently of other data about the containing
variable product, including product type. Because the product type hasn't been saved yet,
extensions that need to save their own variation level meta data can't know when saving
variations if the product is of the type they want to act on. They also can't check `$_POST`
to find out when saving variations, because 'product-type' isn't passed to that as it's
variable level meta data, not variation level meta data.

This patch passes the product type along with the variation level meta data when saving variations.
It then uses that to save the product type if the variable product has not yet been saved (and
therefore the product type has never been stored, which means calling get_product() would instantiate
a 'simple' product, as that is the default product type). This can lead to fatal errors if callbacks
expect the product type to be variable and attempt to call methods that only exist on those product
types, like variable_product_sync().

It will also update the product type if it was previously saved but has since changed. This prevents
fatal errors like that mentioned above but caused by switching from one product type, like a simple
product, to another, like a variable product.
2015-07-31 11:42:21 -07:00
Mike Jolley 82f50cedb0 Allow menu_order sorting like in 2.3
Also allow setting manually to allow sorting between pages.

Fixes #8690
2015-07-31 12:39:23 +01:00
Claudio Sanches b28c6db7f5 Added button to dismiss variation error notices 2015-07-29 19:56:33 -03:00
Claudio Sanches d0e34588aa Updated all .page-selector when change page, closes #8681 2015-07-29 19:25:17 -03:00
Mike Jolley ef5b2007f6 min 2015-07-27 19:03:17 +01:00
Mike Jolley 97bbdb63fa Merge pull request #8663 from roykho/gallery-images
gallery images where not saving
2015-07-27 18:27:00 +01:00
roykho 4203a2cf83 minified file 2015-07-27 10:21:58 -07:00
Claudio Sanches b0ce578541 Show errors for admin ajax variations 2015-07-27 14:16:52 -03:00
roykho 4a8712053f gallery images where not saving 2015-07-27 09:57:21 -07:00
Claudio Sanches 77e8c19330 Minify files for #8631 2015-07-21 20:36:46 -03:00
Brent Shepherd 23418214d0 Trigger do_variation_action + '_ajax_data'
To allow extensions which add their own variation bulk actions to pass
data back to WooCommerce core's handler so that only one ajax call
is necessary for updating the data.

Previously, a duplicate ajax call would be required as trigger() does
not capture the callbacks return value.
2015-07-21 15:41:13 -07:00
Claudio Sanches 791c20ae51 Added param for exclude posts from wc-product-search, closes #8613 2015-07-20 13:41:14 -03:00
Claudio Sanches 5e97a68e3d Fixed calendar when added new variation, closes #8533 2015-07-15 12:26:38 -03:00
Claudio Sanches 8b5fff38e4 Stop alerts when use delete all variations action 2015-07-14 14:08:59 -03:00
Mike Jolley c707f771ad serializeJSON to maintain POST data structure
@claudiosmweb
2015-07-14 13:49:45 +01:00
Claudio Sanches ee1263db9c Minify 2015-07-10 20:17:47 -03:00
Claudio Sanches b8a28bdab4 Admin variations - Cancel button reset the default form values
@mikejolley
2015-07-10 20:16:35 -03:00
Mike Jolley 3ec4003bbb Move add variation button and toolbars 2015-07-11 00:04:16 +01:00
Claudio Sanches 8b4711f655 Admin variations - Removed alert when add new variation 2015-07-10 19:30:14 -03:00
Claudio Sanches 441d3c44bb Admin variations - Go to previous page when delete the last variation in a page 2015-07-10 18:57:38 -03:00
Claudio Sanches 501742b07f Updated grunt dependencies 2015-07-10 18:48:04 -03:00
Claudio Sanches e0c1cc7784 Admin variations - Turn on save button when add new variation 2015-07-10 18:31:38 -03:00
Claudio Sanches e9fc799f97 Admin variations - Fix product add and save methods
Allow add new variations and stay at the same page
When save will set up the pagination again

@mikejolley
2015-07-10 18:22:05 -03:00
Claudio Sanches 62d879e86c Fixed all jshint errors #4680 2015-07-10 02:13:30 -03:00
Claudio Sanches 76b312b9e7 Use always min.js files on admin 2015-07-10 01:32:30 -03:00
Claudio Sanches 319bcd48e6 Updated accounting.js 2015-07-10 01:31:57 -03:00
Claudio Sanches 987a789367 Admin variations - Show link all variations bulk action 2015-07-10 00:49:52 -03:00
Claudio Sanches a64695b7f5 Admin variations - Added new triggers and removed data-product_id 2015-07-09 17:31:48 -03:00
Claudio Sanches 1ce7719c98 Save variable defaults via ajax 2015-07-08 22:50:32 -03:00