Make WordPress Core

Opened 9 years ago

Closed 8 years ago

Last modified 8 years ago

#31530 closed task (blessed) (fixed)

Shiny Updates: Installing themes

Reported by: pento's profile pento Owned by: obenland's profile obenland
Milestone: 4.6 Priority: normal
Severity: normal Version:
Component: Upgrade/Install Keywords: shiny-updates
Focuses: ui, javascript, administration Cc:

Description

Branched from #29820.

This ticket is for tracking the creation of shiny updates theme installing, on theme-install.php.

Attachments (5)

31530-01-add-theme-id.diff (1.3 KB) - added by stephdau 9 years ago.
Adds an id attribute to the div used to display themes in appearance.
31530-01-add-theme-id.2.diff (2.0 KB) - added by stephdau 9 years ago.
Same as 31530-01-add-theme-id.diff but also adds the standard theme-install class on the Install button for themes, as is done .further down in tmpl-theme-preview and in trunk/src/wp-admin/includes/class-wp-theme-install-list-table.php. Helps with JS targeting of install button.
31530-theme-install-workinprogress.diff (7.2 KB) - added by stephdau 9 years ago.
Work in progress for AJAX theme install, to show where I'm going with this, and discuss. Screenshots: https://cloudup.com/cYjd7oIeDp7
31530-theme-install-and-update-workinprogress.diff (14.0 KB) - added by stephdau 9 years ago.
Continuation of 31530-theme-install-workinprogress.diff, starting to add update functionality. Not as easy as install, see upcoming comment.
shiny.diff (192.4 KB) - added by obenland 8 years ago.

Download all attachments as: .zip

Change History (18)

#1 @stephdau
9 years ago

I've started looking into this and #31529. I started with the AJAX actions.

wp_ajax_install_plugin() (src) can easily either be ported to a theme-specific version, or be refactored into one function to handle both plugins and themes. I'd venture a theme-specific instance is a better way to go, in case either diverges, and since it's what's done in a lot of plugins/themes related code in WP.

The only process in wp_ajax_install_plugin() that currently can't be ported by simply changing 'plugin' for 'theme' in that function is the call to install_plugin_install_status(), which we'll need an equivalent of. The closest in themes, currently, is get_theme_update_available() (also uses get_site_transient('update_themes'), as install_plugin_install_status() uses get_site_transient('update_plugins')).

Other small difference: the themes_api() definition is in theme.php, not theme-install.php and unlike plugins_api(), which lives in plugin-install.php.

I haven't looked into the details of the wp_ajax_update_plugin() (aka #31529), but since it also uses code that has a theme equivalent (updates transient, Plugin_Upgrader vs Theme_Upgrader), the same is quite likely.

Any thoughts on:

  • theme vs plublic specific AJAX action vs one hat handles install for both plugin/theme, same for updates?
  • creating a install_theme_install_status() function in theme-install.php based on install_plugin_install_status()?

Once we have functional AJAX actions for the themes, the rest is mainly UX, right? Swapping install buttons for updates, having both use the AJAX actions instead of going to up the updates page, etc.

Last edited 9 years ago by stephdau (previous) (diff)

#2 @stephdau
9 years ago

For the record: happened to be in a live Hangout with @pento, so we chatted, and confirmed the above. We're going with separate plugin/theme specific AJAX actions, to keep with the existing standard and allow for discrete flexibilities. Will keep the same theme with other functions/methods we need to add in other places, like install_theme_install_status().

I'm off for the next 3 days, but I'll tackle that over the 3 next ones, if no one else has grabbed the ball and ran with it by then (feel free to). :)

@stephdau
9 years ago

Adds an id attribute to the div used to display themes in appearance.

#3 @stephdau
9 years ago

31530-01-add-theme-id.diff adds a descriptive id to the div used to encapsulate all of a single theme's data in the Appearance screen. Covers PHP and JS/Backbone.

This will allow us to target a card, to easily find its activate or update button(s), as is done for the plugins and their cards in trunk/src/wp-admin/js/updates.js?rev=31594#L199.

Labeled the patch as -01-, as it'd need to be applied 1st.

@stephdau
9 years ago

Same as 31530-01-add-theme-id.diff but also adds the standard theme-install class on the Install button for themes, as is done .further down in tmpl-theme-preview and in trunk/src/wp-admin/includes/class-wp-theme-install-list-table.php. Helps with JS targeting of install button.

#4 @stephdau
9 years ago

31530-01-add-theme-id.2.diff is the same as its previous equivalent, but also adds a distinctive (and standard) class to help targeting the install button in a theme's "card". We otherwise only had button-primary, but it's also sometimes used for other actions, so not unique/contextual.

@stephdau
9 years ago

Work in progress for AJAX theme install, to show where I'm going with this, and discuss. Screenshots: https://cloudup.com/cYjd7oIeDp7

#5 @stephdau
9 years ago

31530-theme-install-workinprogress.diff shows where I'm at and going with AJAX theme install, so we can discuss. This code will currently install a theme "via AJAX" when clicking on the install button on a theme, in theme search results.

Screenshots: https://cloudup.com/cYjd7oIeDp7

The is-installed class is added to the theme's card upon success, which makes the "Install[ing|ed!]" button disappear (existing behavior). Backbone currently sets a "Already installed" banner for installed themes, which we'll need to trigger upon successful install (ideally the Backbone code would do that automatically upon adding the is-installed class to the card).

Note that since it's to show progress, 31530-theme-install-workinprogress.diff includes 31530-01-add-theme-id.2.diff

Last edited 9 years ago by stephdau (previous) (diff)

@stephdau
9 years ago

Continuation of 31530-theme-install-workinprogress.diff, starting to add update functionality. Not as easy as install, see upcoming comment.

#6 @stephdau
9 years ago

31530-theme-install-and-update-workinprogress.diff is the continuation of 31530-theme-install-workinprogress.diff, starting to add update functionality, where I have to stop today.

Not as easy to integrate as install was, because we'll need to add a button ("Update Now"), rather than hijack one ("Install"). This will need extra styling, Backbone handling (since it renders post document.ready), etc.

Again, a work in progress to be reviewed and discussed. Target is MVP of theme install/update for Beta 1 (Wednesday). :)

This ticket was mentioned in Slack in #core by pento. View the logs.


9 years ago

#10 @jorbin
9 years ago

At the 11 March Dev chat, it was decided to scale back shiny updates to just focus on plugins for 4.2 with themes getting the updates in a future release. There is already a solid base to work off of here and we are well positioned for 4.3.

#11 @jorbin
9 years ago

  • Milestone changed from 4.2 to Future Release

This ticket was mentioned in Slack in #core by georgestephanis. View the logs.


9 years ago

#13 @celloexpressions
8 years ago

Once we finally circle back to adding theme installation to the Customizer, we'll need the theme-install process to be "shiny"; I'll see if I can run with the work that was started here if that ends up happening for 4.5.

In the Customizer, UI is expected to be "Install & Preview" as primary and "Install" as secondary, with installed themes being a tab of the theme browser. Both would trigger an ajax theme installation.

@obenland
8 years ago

#14 @obenland
8 years ago

  • Owner set to obenland
  • Resolution set to fixed
  • Status changed from new to closed

In 37714:

Update/Install: Shiny Updates v2.

Gone are the days of isolation and feelings of "meh", brought on by The Bleak Screen of Sadness. For a shiny knight has arrived to usher our plugins and themes along their arduous journey of installation, updates, and the inevitable fate of ultimate deletion.

Props swissspidy, adamsilverstein, mapk, afragen, ocean90, ryelle, j-falk, michael-arestad, melchoyce, DrewAPicture, AdamSoucie, ethitter, pento, dd32, kraftbj, Ipstenu, jorbin, afercia, stephdau, paulwilde, jipmoors, khag7, svovaf, jipmoors, obenland.
Fixes #22029, #25828, #31002, #31529, #31530, #31773, #33637, #35032.

#15 @obenland
8 years ago

  • Milestone changed from Future Release to 4.6
Note: See TracTickets for help on using tickets.