Skip to content

Commit 82c49e7

Browse files
authored
Merge pull request #57 from DevinWalker/fix/single-theme-button
2 parents 9621afe + 711522b commit 82c49e7

File tree

5 files changed

+23
-16
lines changed

5 files changed

+23
-16
lines changed

assets/css/wp-rollback.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
}
3030

3131
.wpr-versions-wrap {
32-
padding-left: 20px;
33-
margin-bottom:30px;
32+
margin: 0 0 30px;
33+
padding: 0 0 0 4px;
3434
}
3535

3636
.wpr-versions-wrap .wpr-error {
@@ -76,7 +76,7 @@
7676

7777
.wpr-version-li {
7878
clear: left;
79-
padding: 8px 0;
79+
padding: 8px;
8080
overflow: hidden;
8181
width: 800px;
8282
}

assets/js/themes-wp-rollback.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jQuery.noConflict();
1010
(function( $ ) {
1111

1212
/**
13-
* Content Change DOM Event Listenter
13+
* Content Change DOM Event Listener
1414
*
1515
* @see: http://stackoverflow.com/questions/3233991/jquery-watch-div/3234646#3234646
1616
* @param callback
@@ -31,7 +31,7 @@ jQuery.noConflict();
3131
setInterval( function() {
3232
if ( window.watchContentChange ) {
3333
for ( i in window.watchContentChange ) {
34-
if ( window.watchContentChange[ i ].element.data( 'lastContents' ) != window.watchContentChange[ i ].element.html() ) {
34+
if ( window.watchContentChange[ i ].element.data( 'lastContents' ) !== window.watchContentChange[ i ].element.html() ) {
3535
window.watchContentChange[ i ].callback.apply( window.watchContentChange[ i ].element );
3636
window.watchContentChange[ i ].element.data( 'lastContents', window.watchContentChange[ i ].element.html() );
3737
}
@@ -47,6 +47,12 @@ jQuery.noConflict();
4747
themes = wp.themes = wp.themes || {};
4848
themes.data = typeof _wpThemeSettings !== 'undefined' ? _wpThemeSettings : '';
4949

50+
// Is only one theme active?
51+
if( themes.data.themes.length === 1 ) {
52+
// Show the rollback button.
53+
wpr_theme_rollback(themes.data.themes[0].id);
54+
}
55+
5056
// On clicking a theme template
5157
$( '.theme-overlay' ).contentChange( function( e ) {
5258

@@ -81,7 +87,9 @@ jQuery.noConflict();
8187
/**
8288
* Is Theme WordPress.org?
8389
*
84-
* @description Rollback only supports WordPress.org themes
90+
* Rollback only supports WordPress.org themes.
91+
*
92+
* @param theme
8593
*/
8694
function wpr_theme_rollback( theme ) {
8795

@@ -163,9 +171,7 @@ jQuery.noConflict();
163171
* Send them over to rollback.
164172
*/
165173
$( 'body' ).on( 'click', '.wpr-theme-rollback', function( e ) {
166-
167174
window.location = $( this ).attr( 'href' );
168-
169175
} );
170176

171177
} );

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ We provide no (zero) assurances, guarantees, or warranties that the plugin, them
2626

2727
= Translation Ready =
2828

29-
Do you speak another language? Want to contribute in a meaninful way to WP Rollback? There's no better way than to help us translate the plugin. This plugin is translation ready. Simply use the wp-rollback.pot file and your favorite translation tool. Once finished, please reach out to us on the WordPress.org forums or better yet, submit a pull request on the [Github Repo](https://github.com/impress-org/wp-rollback/).
29+
Do you speak another language? Want to contribute in a meaningful way to WP Rollback? There's no better way than to help us translate the plugin. This plugin is translation ready. Simply header over to the WP Rollback [translation project](https://translate.wordpress.org/projects/wp-plugins/wp-rollback/) that's powered by WordPress.org volunteer translators. There you can contribute to the translation of the plugin into your language.
3030

3131
= Support and Documentation =
3232

3333
We answer all support requests [on the WordPress.org support forum](https://wordpress.org/support/plugin/wp-rollback).
3434

35-
WP Rollback was created to be as intuitive to the natural WordPress experience as possible. There are is no dedicated setting page or option panels. We believe that once you activate WP Rollback, you'll quickly discover exactly how it works without question.
35+
WP Rollback was created to be as intuitive to the natural WordPress experience as possible. There are is no dedicated settings page or options panel. We believe that once you activate WP Rollback, you'll quickly discover exactly how it works without question.
3636

3737
**BUT!!**
3838

@@ -108,8 +108,9 @@ This is the first version of this plugin. It is a tool for your convenience. Rol
108108
== Changelog ==
109109

110110
= 1.7.2 =
111-
* Fix: The Rollback button now appears as expected when only one theme is installed.
111+
* Fix: Ensure that the "Rollback" button displays properly when a WordPress site only has a single theme installed. Thanks [@eldertech](https://wordpress.org/support/users/eldertech/) for your help uncovering this bug.
112112
* Fix: Minor CSS fixes for the Rollback page.
113+
* Tweak: Update the WordPress.org readme.txt file to have better instructions for translating the plugin. We also fixed a few typos.
113114

114115
= 1.7.1 =
115116
* Fix: Prevent PHP notice when rolling back a plugin or theme on PHP 7.4.

wp-rollback.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ private function set_plugin_slug() {
570570
/**
571571
* Admin Menu
572572
*
573-
* @description: Adds a 'hidden' menu item that is activated when the user elects to rollback
573+
* Adds a 'hidden' menu item that is activated when the user elects to rollback
574574
*/
575575
public function admin_menu() {
576576

@@ -864,7 +864,7 @@ function wpr_prepare_themes_js( $prepared_themes ) {
864864
$rollbacks = array();
865865
$wp_themes = get_site_transient( 'rollback_themes' );
866866

867-
// Double check our transient is present.
867+
// Double-check our transient is present.
868868
if ( empty( $wp_themes ) || ! is_object( $wp_themes ) ) {
869869
$this->wpr_theme_updates_list();
870870
$wp_themes = get_site_transient( 'rollback_themes' );

0 commit comments

Comments
 (0)