Commit Graph

76 Commits

Author SHA1 Message Date
Dominik Schilling
7b24017cdb Customizer Theme Switcher: Don't re-render a theme control if it has already been rendered.
Move initialization of `$customizeSidebar` to `api.ThemesSection.initialize()` to prevent cases where the result can be undefined.

props westonruter, ocean90.
fixes #31793.
Built from https://develop.svn.wordpress.org/trunk@32119


git-svn-id: http://core.svn.wordpress.org/trunk@32098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-13 22:10:29 +00:00
Dominik Schilling
d43d1503f7 Customize Headers: Improve handling of the initial header model.
Headers are currently keyed by the basename of the image, see #31786. When two images have the same key only one image will be listed and the current image can be empty in the header control.
To prevent this we now fall back to the raw current header image if the image isn't in `_wpCustomizeHeader.uploads`.

props sirbrillig.
fixes #31742.
Built from https://develop.svn.wordpress.org/trunk@32091


git-svn-id: http://core.svn.wordpress.org/trunk@32070 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-08 22:28:27 +00:00
Dominik Schilling
755d44736a Customizer Theme Switcher: Lazy load theme screenshots.
props westonruter, ocean90.
fixes #31793.
Built from https://develop.svn.wordpress.org/trunk@32088


git-svn-id: http://core.svn.wordpress.org/trunk@32067 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-08 20:52:29 +00:00
Dominik Schilling
15f24a7730 Customizer Theme Switcher: Fix tabbing order if section is open.
see #31289.
Built from https://develop.svn.wordpress.org/trunk@32087


git-svn-id: http://core.svn.wordpress.org/trunk@32066 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-08 19:03:25 +00:00
Dominik Schilling
79eee23a29 Customizer Theme Switcher: Don't deactivate section on empty search results.
props westonruter.
fixes #31889.
Built from https://develop.svn.wordpress.org/trunk@32083


git-svn-id: http://core.svn.wordpress.org/trunk@32062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-08 17:53:28 +00:00
Dominik Schilling
6d2c70aa0d Customizer: Refresh nonces when a session expires and the user logs in again.
This was broken since 4.0 and the introduction of user session tokens. The nonces are now tied to session tokens as opposed to user IDs, and thus they change with each re-login.
Custom nonces can be added through the `customize_refresh_nonces` filter. On a successful refresh request the JavaScript API will trigger a `nonce-refresh` event. See widget's update nonce as an example.

props westonruter for initial patch.
fixes #31294.
Built from https://develop.svn.wordpress.org/trunk@32054


git-svn-id: http://core.svn.wordpress.org/trunk@32033 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-06 15:10:27 +00:00
Dominik Schilling
59c586e5ad Customizer Theme Switcher: Remove "Add New" reference from customize-controls.js.
see #31837.
Built from https://develop.svn.wordpress.org/trunk@32004


git-svn-id: http://core.svn.wordpress.org/trunk@31983 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-04 14:14:26 +00:00
Dominik Schilling
254b9e3264 Customizer Theme Switcher: Navigation streamlining.
* Detach Themes section from other controls
* Move to buttons to navigate back and forth
* Change titles based on current theme status, active/previewing
* Hide the active/previewing theme from the list of available themes

props folletto for the design concepts.
props designsimply, celloexpressions for initial patches.
props Team Gandalf.
see #31289.
Built from https://develop.svn.wordpress.org/trunk@31975


git-svn-id: http://core.svn.wordpress.org/trunk@31954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 22:51:27 +00:00
Dominik Schilling
8ab7c076d6 Customizer Theme Switcher: Switch the details/live preview buttons.
props celloexpressions, ocean90.
fixes #31791.
Built from https://develop.svn.wordpress.org/trunk@31954


git-svn-id: http://core.svn.wordpress.org/trunk@31933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-04-01 12:36:26 +00:00
Dominik Schilling
79a29b077e Customizer: Defer rendering theme controls until the section is displayed.
see #31793.
Built from https://develop.svn.wordpress.org/trunk@31944


git-svn-id: http://core.svn.wordpress.org/trunk@31923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-31 22:21:25 +00:00
Dominik Schilling
b07e3e2de7 Customizer: Fix calculation of panel positions when accessing via deep-links.
Make sure that the parent `li` is shown before attempting to calculate its position.
Improve also the logic for focusing on a panel to prevent focusing hidden elements.

props westonruter.
fixes #31014.
see #31794.
Built from https://develop.svn.wordpress.org/trunk@31920


git-svn-id: http://core.svn.wordpress.org/trunk@31899 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-29 11:17:28 +00:00
Dominik Schilling
96b88a391b Theme Switcher: Use the global panel back button instead of adding a new one.
This ensures the back button is visible on iOS devices. Same as in [29610].

see #31794.
Built from https://develop.svn.wordpress.org/trunk@31918


git-svn-id: http://core.svn.wordpress.org/trunk@31897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-28 22:09:26 +00:00
Dominik Schilling
80972b7ecd Customizer: Fix selector for container which includes the controls. Broken since [30102].
see #31794, #31014.
Built from https://develop.svn.wordpress.org/trunk@31916


git-svn-id: http://core.svn.wordpress.org/trunk@31895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-28 20:47:30 +00:00
Dominik Schilling
ee2829959a Theme Switcher: Opening themes details modal shouldn't require two clicks on touch devices.
Inspired by [26838].

see #31794.
Built from https://develop.svn.wordpress.org/trunk@31914


git-svn-id: http://core.svn.wordpress.org/trunk@31893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-27 22:54:29 +00:00
Dominik Schilling
de7ecc80d3 Customizer: [31885] actually hasn't fixed the SecurityErrors. This one does.
props mattwiebe.
fixes #31687.
Built from https://develop.svn.wordpress.org/trunk@31893


git-svn-id: http://core.svn.wordpress.org/trunk@31872 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-25 23:36:27 +00:00
Dominik Schilling
7925e4c912 Customizer: Avoid SecurityErrors when the Customizer is embedded in an origin other than wp-admin.
props mattwiebe.
fixes #31687.
Built from https://develop.svn.wordpress.org/trunk@31885


git-svn-id: http://core.svn.wordpress.org/trunk@31864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-25 17:26:26 +00:00
Dominik Schilling
9250d59e6a Customizer: Prevent a race condition when attempting to publish too soon after updating widget form fields with multiple edits.
props westonruter.
fixes #31501.
Built from https://develop.svn.wordpress.org/trunk@31706


git-svn-id: http://core.svn.wordpress.org/trunk@31687 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 22:45:27 +00:00
Dominik Schilling
b96a624cb9 Customizer: Fix previewing and applying widgets when previewing another theme.
* Unset `wp_get_sidebars_widgets()`' non-admin cache var `$_wp_sidebars_widgets` in Customize theme preview.
* Add `WP_Customize_Setting::$dirty` so that settings can be initially-dirty when the Customizer loads.
* Mark `old_sidebars_widgets_data` setting initially-dirty.
* Mark all `sidebars_widgets` settings as initially-dirty during theme switch.

props westonruter.
see #31484.
Built from https://develop.svn.wordpress.org/trunk@31705


git-svn-id: http://core.svn.wordpress.org/trunk@31686 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 22:39:28 +00:00
Dominik Schilling
2ae3dfa119 Customizer: Add title attributes to iframes.
props afercia.
fixes #31202.
Built from https://develop.svn.wordpress.org/trunk@31704


git-svn-id: http://core.svn.wordpress.org/trunk@31685 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 21:20:26 +00:00
Dominik Schilling
f9180e1b4b Customizer: Introduce WP_Customize_Media_Control.
`WP_Customize_Media_Control` is a new base class for all Customizer media controls. If used directly it supports the ID of an attachment instead of an URL like `WP_Customize_Upload_Control`.

props celloexpressions.
fixes #29215.
Built from https://develop.svn.wordpress.org/trunk@31698


git-svn-id: http://core.svn.wordpress.org/trunk@31679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 18:02:28 +00:00
Dominik Schilling
3349b7d25b Customizer: Add loading indicators for the Customizer preview.
props Fab1en, westonruter.
fixes #31196.
Built from https://develop.svn.wordpress.org/trunk@31697


git-svn-id: http://core.svn.wordpress.org/trunk@31678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-10 15:56:26 +00:00
Dominik Schilling
08f0376f91 Customizer: Add audio/video previews for upload controls.
props celloexpressions, Fab1en, wonderboymusic.
fixes #30850.
Built from https://develop.svn.wordpress.org/trunk@31661


git-svn-id: http://core.svn.wordpress.org/trunk@31642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-07 11:06:29 +00:00
Andrew Ozz
d84eda9f35 Grunt precommit cleanup. See [31533], [31535].
Built from https://develop.svn.wordpress.org/trunk@31538


git-svn-id: http://core.svn.wordpress.org/trunk@31519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-25 04:17:27 +00:00
Mark Jaquith
8b180b9a46 Add theme browsing and theme switching to the Customizer
* Brings into core the Customizer Theme Switcher feature plugin
* You can now browse, preview, and activate themes right from the Customizer

fixes #31303.
props celloexpressions, afercia, westonruter, folletto, designsimply
Built from https://develop.svn.wordpress.org/trunk@31533


git-svn-id: http://core.svn.wordpress.org/trunk@31514 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-24 20:31:24 +00:00
Dominik Schilling
941075c8ca Improve the Customize experience on mobile.
Before: https://make.wordpress.org/flow/2015/02/02/a-peek-at-the-customizer-on-an-iphone-6/
After: https://make.wordpress.org/flow/2015/02/03/vizrec-for-28784-improve-the-customize-experience-on-mobile-iphone-6-28784-diff-4-2-alpha-31325/

props celloexpressions.
see #28784.
Built from https://develop.svn.wordpress.org/trunk@31384


git-svn-id: http://core.svn.wordpress.org/trunk@31365 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-09 12:36:28 +00:00
Dominik Schilling
56981c7143 Customizer: Send JSON success for customize_save and allow response to be filtered.
props westonruter.
fixes #29098.
Built from https://develop.svn.wordpress.org/trunk@31062


git-svn-id: http://core.svn.wordpress.org/trunk@31043 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-06 21:47:23 +00:00
Dominik Schilling
93605deef5 Customizer: Improve IE 8 compatibility.
* Use square bracket notation for `default` keywords.
* Use Underscores `indexOf` for arrays.

props westonruter, ocean90.
fixes #30781 for trunk.
Built from https://develop.svn.wordpress.org/trunk@30991


git-svn-id: http://core.svn.wordpress.org/trunk@30973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-23 17:05:26 +00:00
Dominik Schilling
fcb00b75e2 Customizer: Add _wp_attachment_is_custom_background meta to uploaded background images.
Adds `$type` property to `WP_Customize_Background_Image_Control` (PHP) and introduces `wp.customize.BackgroundControl` (JS).

see #30707.
Built from https://develop.svn.wordpress.org/trunk@30885


git-svn-id: http://core.svn.wordpress.org/trunk@30873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-15 23:28:23 +00:00
Dominik Schilling
4652717828 Customizer: Remove date filter from the Header/Background Image upload frames.
Adds an option to `wp.media.view.AttachmentsBrowser` to hide the date filter added in [29813].

see #30689.
Built from https://develop.svn.wordpress.org/trunk@30872


git-svn-id: http://core.svn.wordpress.org/trunk@30862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-15 20:27:22 +00:00
Dominik Schilling
d5914fc1c8 Customizer: Import missing wp.customize.Control.prototype._toggleActive.
Check also if `completeCallback` is set before calling it.

props westonruter.
see #30701.
Built from https://develop.svn.wordpress.org/trunk@30871


git-svn-id: http://core.svn.wordpress.org/trunk@30861 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-15 19:54:21 +00:00
Dominik Schilling
858a51273a Customizer: Move private helper functions to wp.customize.utils so they can be unit tested.
Includes unit tests.

props ryankienstra, westonruter.
see #28709.
Built from https://develop.svn.wordpress.org/trunk@30716


git-svn-id: http://core.svn.wordpress.org/trunk@30706 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 22:56:45 +00:00
Dominik Schilling
3db8b08686 Customizer: Enhance Background Image/Upload controls.
* Adopt the Header Image layout to the Background Image/Upload control.
* Remove templates for interactive audio/video previews. They haven't worked yet.
* Don't show a "Remove" button when the default value is set.
* Avoid calculating of container/placeholder heights which are unrelated to custom headers.

see #21483.
Built from https://develop.svn.wordpress.org/trunk@30712


git-svn-id: http://core.svn.wordpress.org/trunk@30702 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-02 21:55:23 +00:00
Dominik Schilling
41197a7c31 Customizer: Improve ability to filter active state for widget area Customizer sections.
* Mark panels, sections, controls as active if preview explicitly indicates.
* Introduce `WP_Customize_Sidebar_Section` PHP class, and `SidebarSection` JS class.
* Move logic for determining whether a sidebar section is active from the `SidebarControl` to `SidebarSection`.

props westonruter.
fixes #30235.
Built from https://develop.svn.wordpress.org/trunk@30329


git-svn-id: http://core.svn.wordpress.org/trunk@30328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-13 12:19:23 +00:00
Dominik Schilling
6d83c8c29e Customizer: Add support for the media library in Background Image controls.
`WP_Customize_Upload_Control` (PHP) and `api.UploadControl` (JS) can now open the media modal.

props celloexpressions, and ericlewis for docs.
see #21483.
Built from https://develop.svn.wordpress.org/trunk@30309


git-svn-id: http://core.svn.wordpress.org/trunk@30308 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-11 23:52:22 +00:00
Dominik Schilling
d21799ee1f Customizer: Use jQuery.fn.toggle() instead of slideUp/slideDown if panel/section/control is not inserted into DOM yet.
jQuery does nothing when calling `slideUp` on elements that are not inserted into the DOM yet, which can now be the case now when first loading the Customizer as the panels, sections and controls get dynamically inserted, see #28709.

props westonruter.
fixes #30251.
Built from https://develop.svn.wordpress.org/trunk@30307


git-svn-id: http://core.svn.wordpress.org/trunk@30306 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-11 22:37:22 +00:00
Dominik Schilling
b250062311 Customizer: When navigating around the site within the Customizer preview, update the document title.
props westonruter.
fixes #28542.
Built from https://develop.svn.wordpress.org/trunk@30306


git-svn-id: http://core.svn.wordpress.org/trunk@30305 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-11 22:29:23 +00:00
Dominik Schilling
73b4f6f449 Customizer: Add stable sorting for panels, sections and controls in JS. Improve sorting in PHP.
props westonruter.
fixes #30225.
Built from https://develop.svn.wordpress.org/trunk@30214


git-svn-id: http://core.svn.wordpress.org/trunk@30214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 21:35:23 +00:00
Dominik Schilling
461507452a Customizer: Improve ColorControl's wpColorPicker to update UI based on setting changes.
Update Twenty Fifteen's `colorScheme` control to properly interact with the API, using `wp.customize.control()` instead of traversing DOM for other controls' container elements and stop manually updating color control UIs.

props westonruter.
fixes #30031.
Built from https://develop.svn.wordpress.org/trunk@30126


git-svn-id: http://core.svn.wordpress.org/trunk@30126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 20:45:22 +00:00
Dominik Schilling
3c962ee5d8 Improve/introduce Customizer JavaScript models for Controls, Sections, and Panels.
* Introduce models for panels and sections.
* Introduce API to expand and focus a control, section or panel.
* Allow deep-linking to panels, sections, and controls inside of the Customizer.
* Clean up `accordion.js`, removing all Customizer-specific logic.
* Add initial unit tests for `wp.customize.Class` in `customize-base.js`.

https://make.wordpress.org/core/2014/10/27/toward-a-complete-javascript-api-for-the-customizer/ provides an overview of how to use the JavaScript API.

props westonruter, celloexpressions, ryankienstra.
see #28032, #28579, #28580, #28650, #28709, #29758.
fixes #29529.


Built from https://develop.svn.wordpress.org/trunk@30102


git-svn-id: http://core.svn.wordpress.org/trunk@30102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-29 22:51:22 +00:00
Sergey Biryukov
ef00815a3a Fix JSHint errors introduced in [30014].
props adamsilverstein.
see #29572.
Built from https://develop.svn.wordpress.org/trunk@30024


git-svn-id: http://core.svn.wordpress.org/trunk@30024 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-26 12:06:19 +00:00
John Blackbourn
905b6a9d67 Add the ability for a customizer control to render its controls via a JavaScript template. Switches the default color picker control to a JavaScript template. See #29572. Props celloexpressions
Built from https://develop.svn.wordpress.org/trunk@30014


git-svn-id: http://core.svn.wordpress.org/trunk@30014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-24 16:32:18 +00:00
Dominik Schilling
4020eacd8b Customizer: Only POST dirty settings to preview to improve performance.
props westonruter.
fixes #29983.
Built from https://develop.svn.wordpress.org/trunk@29905


git-svn-id: http://core.svn.wordpress.org/trunk@29660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-15 17:50:18 +00:00
Sergey Biryukov
187e23b3d6 Customizer: Don't hide controls the preview frame has no information about.
props kovshenin.
see #27993.
Built from https://develop.svn.wordpress.org/trunk@29329


git-svn-id: http://core.svn.wordpress.org/trunk@29109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-30 16:24:18 +00:00
Sergey Biryukov
ad7bc20cb1 Customizer: Introduce WP_Customize_Control::active() method to determine whether the control is relevant to the current context (i.e. to the current URL being previewed).
Control can indicate its active state by a subclass overriding the 'active_callback' method, by supplying a callable 'active_callback' argument into the control's constructor, or by filtering 'customize_control_active'.

props westonruter.
see #27993.
Built from https://develop.svn.wordpress.org/trunk@29051


git-svn-id: http://core.svn.wordpress.org/trunk@28839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 23:58:16 +00:00
Sergey Biryukov
3b291f7057 Customizer: Export Previewer instance to wp.customize.previewer, and utilize for Widget Customizer.
props westonruter.
fixes #27666.
Built from https://develop.svn.wordpress.org/trunk@29048


git-svn-id: http://core.svn.wordpress.org/trunk@28836 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-09 20:58:15 +00:00
Helen Hou-Sandí
c2a3f4fab5 Customizer info section:
* Only show the theme info when doing a live preview of another theme.
* Replace with helper text about what you are customizing and what the Customizer is for.
* Fix focus styling.

props celloexpressions, westonruter. fixes #28550.

Built from https://develop.svn.wordpress.org/trunk@29034


git-svn-id: http://core.svn.wordpress.org/trunk@28822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-08 19:53:15 +00:00
Helen Hou-Sandí
b90b64bf9e More consistent icons in place of some buttons for the Customizer and theme install preview.
* Use a single close icon instead of a context-changing cancel/close button in the Customizer. In user testing, this small distinction in language was overlooked, and we use an AYS now instead. This also makes it consistent with the back arrow in Customizer panels.
* Use the same close icon as well as the previous/next arrows from the theme details browser in the theme install preview.

props celloexpressions. fixes #28655.

Built from https://develop.svn.wordpress.org/trunk@29031


git-svn-id: http://core.svn.wordpress.org/trunk@28819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-08 18:19:14 +00:00
Helen Hou-Sandí
b6d3c0841e Prompt the user before leaving the Customizer if they have unsaved changes. props westonruter. fixes #25439.
Built from https://develop.svn.wordpress.org/trunk@29025


git-svn-id: http://core.svn.wordpress.org/trunk@28813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-08 17:04:15 +00:00
Andrew Nacin
962e8113ab Customizer: Only tie header button action events to the header controls.
props danielbachhuber.
fixes #28046. see #27848.

Built from https://develop.svn.wordpress.org/trunk@28269


git-svn-id: http://core.svn.wordpress.org/trunk@28097 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 04:30:23 +00:00
Andrew Nacin
a2924c6be0 Custom header: Fix image ordering.
props ehg.
see #21785. fixes #27791.

Built from https://develop.svn.wordpress.org/trunk@28102


git-svn-id: http://core.svn.wordpress.org/trunk@27933 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-13 18:22:14 +00:00