Themes: When only one theme is available, show just the details view.

Only one theme may be available when no other themes are allowed (multisite), no other themes are installed, or when the user is denied the switch_themes capability but still has edit_theme_options.

props matveb, markjaquith.
see #25962.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26542 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-12-05 00:16:10 +00:00
parent b0a9fb217a
commit a56aa77d67
6 changed files with 64 additions and 3 deletions

View File

@ -7052,6 +7052,26 @@ body.folded .theme-overlay .theme-wrap {
.theme-overlay .parent-theme strong { .theme-overlay .parent-theme strong {
font-weight: 700; font-weight: 700;
} }
/**
* Single Theme Mode
* Displays detailed view inline when a user has no switch capabilities
*/
.single-theme .theme-overlay .theme-backdrop,
.single-theme .theme-overlay .theme-header,
.single-theme .theme {
display: none;
}
.single-theme .theme-overlay .theme-wrap {
clear: both;
position: static;
}
.single-theme .theme-overlay .theme-about {
padding: 30px;
position: static;
}
.single-theme .theme-overlay .theme-actions {
position: static;
}
/** /**
* Basic Responsive structure... * Basic Responsive structure...

File diff suppressed because one or more lines are too long

View File

@ -7052,6 +7052,26 @@ body.folded .theme-overlay .theme-wrap {
.theme-overlay .parent-theme strong { .theme-overlay .parent-theme strong {
font-weight: 700; font-weight: 700;
} }
/**
* Single Theme Mode
* Displays detailed view inline when a user has no switch capabilities
*/
.single-theme .theme-overlay .theme-backdrop,
.single-theme .theme-overlay .theme-header,
.single-theme .theme {
display: none;
}
.single-theme .theme-overlay .theme-wrap {
clear: both;
position: static;
}
.single-theme .theme-overlay .theme-about {
padding: 30px;
position: static;
}
.single-theme .theme-overlay .theme-actions {
position: static;
}
/** /**
* Basic Responsive structure... * Basic Responsive structure...

File diff suppressed because one or more lines are too long

View File

@ -61,6 +61,11 @@ themes.view.Appearance = wp.Backbone.View.extend({
var view, var view,
self = this; self = this;
// Don't render the search if there is only one theme
if ( themes.data.themes.length === 1 ) {
return;
}
view = new themes.view.Search({ collection: self.collection }); view = new themes.view.Search({ collection: self.collection });
// Render and append after screen title // Render and append after screen title
@ -408,6 +413,22 @@ themes.view.Themes = wp.Backbone.View.extend({
// Clear the DOM, please // Clear the DOM, please
this.$el.html( '' ); this.$el.html( '' );
// If the user doesn't have switch capabilities
// or there is only one theme in the collection
// render the detailed view of the active theme
if ( themes.data.themes.length === 1 ) {
// Constructs the view
this.singleTheme = new themes.view.Details({
model: this.collection.models[0]
});
// Render and apply a 'single-theme' class to our container
this.singleTheme.render();
this.$el.addClass( 'single-theme' );
this.$el.append( this.singleTheme.el );
}
// Generate the themes // Generate the themes
// Using page instance // Using page instance
this.renderThemes( this.parent.page ); this.renderThemes( this.parent.page );

File diff suppressed because one or more lines are too long