WordPress.org

Make WordPress Core

Changeset 26652


Ignore:
Timestamp:
12/05/2013 12:15:59 AM (6 years ago)
Author:
nacin
Message:

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.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/wp-admin.css

    r26635 r26652  
    70537053    font-weight: 700;
    70547054}
     7055/**
     7056 * Single Theme Mode
     7057 * Displays detailed view inline when a user has no switch capabilities
     7058 */
     7059.single-theme .theme-overlay .theme-backdrop,
     7060.single-theme .theme-overlay .theme-header,
     7061.single-theme .theme {
     7062    display: none;
     7063}
     7064.single-theme .theme-overlay .theme-wrap {
     7065    clear: both;
     7066    position: static;
     7067}
     7068.single-theme .theme-overlay .theme-about {
     7069    padding: 30px;
     7070    position: static;
     7071}
     7072.single-theme .theme-overlay .theme-actions {
     7073    position: static;
     7074}
    70557075
    70567076/**
  • trunk/src/wp-admin/js/theme.js

    r26521 r26652  
    6262            self = this;
    6363
     64        // Don't render the search if there is only one theme
     65        if ( themes.data.themes.length === 1 ) {
     66            return;
     67        }
     68
    6469        view = new themes.view.Search({ collection: self.collection });
    6570
     
    408413        // Clear the DOM, please
    409414        this.$el.html( '' );
     415
     416        // If the user doesn't have switch capabilities
     417        // or there is only one theme in the collection
     418        // render the detailed view of the active theme
     419        if ( themes.data.themes.length === 1 ) {
     420
     421            // Constructs the view
     422            this.singleTheme = new themes.view.Details({
     423                model: this.collection.models[0]
     424            });
     425
     426            // Render and apply a 'single-theme' class to our container
     427            this.singleTheme.render();
     428            this.$el.addClass( 'single-theme' );
     429            this.$el.append( this.singleTheme.el );
     430        }
    410431
    411432        // Generate the themes
Note: See TracChangeset for help on using the changeset viewer.