Commit Graph

1780 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 5e91d27b66 Minify 2015-08-05 16:52:54 -03: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 67788f971d Merge pull request #8696 from franticpsyx/animate-variations-changes
[2.4] Animate variations script DOM modifications
2015-07-31 12:44:18 +01: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
Manos Psychogyiopoulos f5691fd82a animate variations script markup changes 2015-07-31 14:04:55 +03: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
Claudio Sanches 8780f2c1ef Fixed chmod to jquery-serializejson 2015-07-29 19:16:27 -03:00
Claudio Sanches be3dcf5ddf Fixed cursor for variations, removed move and changed to pointer 2015-07-29 11:52:12 -03:00
Mike Jolley e3ff9d6e24 Minify 2015-07-28 16:22:00 +01:00
Manos Psychogyiopoulos dae10a962c allow product variations data refresh 2015-07-28 15:34:04 +03:00
Mike Jolley 890bcff302 Fix cart ajax endpoint
@claudiosmweb @BFTrick
2015-07-27 20:02:40 +01: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
Mike Jolley d0c2c10c47 Made the linter happy 2015-07-27 17:55:37 +01:00
Mike Jolley 0ab151562a Fix issues with trailing slashes on permalinks
Closes #8658
2015-07-27 11:56:07 +01:00
Claudio Sanches f8dfc64db7 Fixed postcode/zip reset in address i18n script, closes #8646 2015-07-24 18:24:33 -03: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
Mike Jolley 44b91e5b66 Revert triggerHandlers back to trigger() for BW compat
Closes #8569
2015-07-14 10:28:49 +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