Ticket #25948: 25948.diff
File 25948.diff, 24.1 KB (added by , 12 years ago) |
---|
-
wp-admin/css/theme.css
1 /** 2 * THX38 styles... 3 * 4 * Note: it expects mp6 plugin to be active as this is based on that design of the admin. 5 */ 6 #themes { 1 .theme-browser .themes { 7 2 clear: both; 8 3 padding: 0 0 100px; 9 4 } 10 #appearanceh2 {5 .themes-php .wrap h2 { 11 6 float: left; 12 7 margin-bottom: 15px; 13 8 } 14 #appearanceh2 .button {9 .themes-php .wrap h2 .button { 15 10 margin-left: 20px; 16 11 } 17 .theme -count {12 .themes-php .theme-count { 18 13 color: #fff; 19 14 border-radius: 30px; 20 15 background: #777; … … 27 22 top: -3px; 28 23 } 29 24 /* Position admin messages */ 30 #appearancediv.updated {25 .themes-php div.updated { 31 26 margin: 0 0 20px 0; 32 27 clear: both; 33 28 } 34 #appearancediv.updated a {29 .themes-php div.updated a { 35 30 text-decoration: underline; 36 31 } 37 /* Add new theme */38 .add-new-h2 {39 background: #e0e0e0;40 color: #555;41 margin-left: 20px;42 }43 .add-new-icon:hover {44 background: #2ea2cc;45 }46 /* Edit mode toggle */47 .themes-bulk-edit {48 color: #555;49 cursor: pointer;50 font-size: 14px;51 margin-left: 20px;52 padding: 4px 8px;53 border: 1px solid #ddd;54 display: none;55 }56 .themes-bulk-edit:before {57 content: '\f111';58 display: inline-block;59 font: normal 20px/1 'dashicons';60 margin: 0 6px 0 0;61 opacity: 0.8;62 position: relative;63 top: 4px;64 speak: none;65 -webkit-font-smoothing: antialiased;66 }67 .themes-bulk-edit:hover {68 border-color: #2ea2cc;69 color: #2ea2cc;70 }71 .edit-mode .themes-bulk-edit {72 background: #555;73 color: #fff;74 }75 .edit-mode .themes-bulk-edit .edit,76 .themes-bulk-edit .done {77 display: none;78 }79 .edit-mode .themes-bulk-edit .done,80 .themes-bulk-edit .edit {81 display: inline;82 }83 32 84 33 /** 85 34 * Main theme element … … 173 122 .theme .delete-theme:hover:before { 174 123 background: #d54e21; 175 124 } 176 body.edit-mode .theme .delete-theme {177 display: inline-block;178 }179 body.edit-mode .theme:hover .theme-screenshot img {180 opacity: 1;181 }182 body.edit-mode .theme:hover:after {183 opacity: 0;184 }185 body.edit-mode .theme:hover .theme-actions,186 body.edit-mode .theme.add-new {187 display: none;188 }189 125 190 191 126 /* 192 127 * Theme Screenshot 193 128 * … … 355 290 /* 356 291 * Add new theme 357 292 */ 358 . add-new{293 .theme-browser .add-new-theme { 359 294 border: none; 360 295 box-shadow: none; 361 296 } 362 . add-newa {297 .theme-browser .add-new-theme a { 363 298 color: #999; 364 299 text-decoration: none; 365 300 display: block; 366 301 position: relative; 367 302 } 368 .theme .add-new:after {303 .theme-browser .add-new-theme:after { 369 304 display: block; 370 305 content: ''; 371 306 opacity: 1; … … 381 316 border: 5px dashed rgba(0, 0, 0, 0.1); 382 317 box-sizing: border-box; 383 318 } 384 .theme .add-newspan:after {319 .theme-browser .add-new-theme span:after { 385 320 background: rgba(153, 153, 153, 0.1); 386 321 border-radius: 50%; 387 322 display: inline-block; … … 402 337 text-shadow: none; 403 338 z-index:4; 404 339 } 405 .theme .add-new:hover .theme-screenshot {340 .theme-browser .add-new-theme:hover .theme-screenshot { 406 341 background: none; 407 342 } 408 .theme .add-new:hover span:after {343 .theme-browser .add-new-theme:hover span:after { 409 344 background: #fff; 410 345 color: rgb(16, 116, 162); 411 346 box-shadow: 0 2px 1px rgba(0,0,0,0.3); 412 347 } 413 348 414 .theme .add-new:hover:after {349 .theme-browser .add-new-theme:hover:after { 415 350 border-color: transparent; 416 351 color: #fff; 417 352 background: rgb(16, 116, 162); 418 353 } 419 354 420 . add-new.theme-name {355 .theme-browser .add-new-theme .theme-name { 421 356 background: none; 422 357 text-align: center; 423 358 box-shadow: none; … … 425 360 position: relative; 426 361 top: -70px; 427 362 } 428 . add-new:hover .theme-name {363 .theme-browser .add-new-theme:hover .theme-name { 429 364 color: #fff; 430 365 z-index: 2; 431 366 } 432 367 433 434 368 /* 435 369 * The search form 436 370 */ 437 . search-form{371 .theme-browser .theme-search { 438 372 float: left; 439 373 position: relative; 440 374 top: 7px; 441 375 left: 10px; 442 }443 #theme-search {444 376 font-size: 16px; 445 377 font-weight: 300; 446 378 line-height: 1.5; 447 379 } 448 380 449 450 381 /* 451 382 * Theme Overlay 452 383 * Shown when clicking a theme 453 384 */ 454 #theme-overlay { 455 } 456 #theme-overlay .theme-backdrop { 385 .theme-overlay .theme-backdrop { 457 386 position: absolute; 458 387 left: -20px; 459 388 right: 0; … … 463 392 /* background: rgba(0,0,0,0.7); */ 464 393 z-index: 10; 465 394 } 466 body.theme-overlay {395 body.theme-overlay-open { 467 396 overflow: hidden; 468 397 } 469 398 470 #theme-overlay .theme-utility {399 .theme-overlay .theme-utility { 471 400 position: absolute; 472 401 top: 0; 473 402 left: 0; … … 474 403 right: 0; 475 404 border-bottom: 1px solid #eee; 476 405 } 477 #theme-overlay .back {406 .theme-overlay .back { 478 407 cursor: pointer; 479 408 height: 48px; 480 409 width: 50px; … … 482 411 float: right; 483 412 border-left: 1px solid #eee; 484 413 } 485 #theme-overlay .back:hover {414 .theme-overlay .back:hover { 486 415 background: #333; 487 416 } 488 #theme-overlay .back:hover:before {417 .theme-overlay .back:hover:before { 489 418 color: #fff; 490 419 } 491 #theme-overlay .back:before {420 .theme-overlay .back:before { 492 421 font: normal 30px/48px 'dashicons' !important; 493 422 color: #bbb; 494 423 display: inline-block; … … 496 425 font-weight: 300; 497 426 } 498 427 /* Left and right navigation */ 499 #theme-overlay .right,500 #theme-overlay .left {428 .theme-overlay .right, 429 .theme-overlay .left { 501 430 cursor: pointer; 502 431 -webkit-user-select: none; 503 432 -moz-user-select: none; … … 509 438 text-align: center; 510 439 border-right: 1px solid #eee; 511 440 } 512 #theme-overlay .right:hover,513 #theme-overlay .left:hover {441 .theme-overlay .right:hover, 442 .theme-overlay .left:hover { 514 443 background: #333; 515 444 } 516 #theme-overlay .right:hover:before,517 #theme-overlay .left:hover:before {445 .theme-overlay .right:hover:before, 446 .theme-overlay .left:hover:before { 518 447 color: #fff; 519 448 } 520 #theme-overlay .left:before {449 .theme-overlay .left:before { 521 450 content: '\f341'; 522 451 } 523 #theme-overlay .right:before {452 .theme-overlay .right:before { 524 453 content: '\f345'; 525 454 } 526 #theme-overlay .right:before,527 #theme-overlay .left:before {455 .theme-overlay .right:before, 456 .theme-overlay .left:before { 528 457 font: normal 16px/54px 'dashicons' !important; 529 458 display: inline; 530 459 font-weight: 300; 531 460 } 532 #theme-overlay .left:before {}461 .theme-overlay .left:before {} 533 462 534 #theme-overlay .theme-wrap {463 .theme-overlay .theme-wrap { 535 464 clear: both; 536 465 position: fixed; 537 466 top: 120px; … … 544 473 box-shadow: 0 1px 20px 5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0,0,0,0.1); 545 474 z-index: 20; 546 475 } 547 #theme-overlay .theme-wrap:after {476 .theme-overlay .theme-wrap:after { 548 477 content: "."; 549 478 display: block; 550 479 height: 0; … … 552 481 visibility: hidden; 553 482 } 554 483 555 #theme-overlay .theme-actions {484 .theme-overlay .theme-actions { 556 485 position: fixed; 557 486 text-align: center; 558 487 bottom: 80px; … … 563 492 border-top: 1px solid rgba(0,0,0,0.1); 564 493 z-index: 30; 565 494 } 566 #theme-overlay.active .theme-actions {495 .theme-overlay.active .theme-actions { 567 496 568 497 } 569 #theme-overlay .theme-actions a {498 .theme-overlay .theme-actions a { 570 499 margin-right: 5px; 571 500 margin-bottom: 0; 572 501 font-size: 16px; … … 574 503 height: 37px; 575 504 padding: 0 20px 1px 20px; 576 505 } 577 #theme-overlay .theme-actions .delete-theme {506 .theme-overlay .theme-actions .delete-theme { 578 507 border-radius: 2px; 579 508 color: #a00; 580 509 font-size: 14px; … … 584 513 bottom: 20px; 585 514 text-decoration: none; 586 515 } 587 #theme-overlay .theme-actions .delete-theme:hover {516 .theme-overlay .theme-actions .delete-theme:hover { 588 517 background: #d54e21; 589 518 color: #fff; 590 519 } 591 520 592 #theme-overlay .theme-actions .active-theme,593 #theme-overlay.active .theme-actions .inactive-theme {521 .theme-overlay .theme-actions .active-theme, 522 .theme-overlay.active .theme-actions .inactive-theme { 594 523 display: none; 595 524 } 596 #theme-overlay .theme-actions .inactive-theme,597 #theme-overlay.active .theme-actions .active-theme {525 .theme-overlay .theme-actions .inactive-theme, 526 .theme-overlay.active .theme-actions .active-theme { 598 527 display: block; 599 528 } 600 529 /* 601 530 * Theme Screenshots gallery 602 531 */ 603 #theme-overlay .theme-screenshots {532 .theme-overlay .theme-screenshots { 604 533 float: left; 605 534 margin: 0 30px 0 0; 606 535 width: 55%; … … 607 536 text-align: center; 608 537 } 609 538 /* First screenshot, shown big */ 610 #theme-overlay .screenshot {539 .theme-overlay .screenshot { 611 540 background: #000; 612 541 border: 1px solid #fff; 613 542 -moz-box-sizing: border-box; … … 617 546 position: relative; 618 547 box-shadow: 0 0 0 1px rgba(0,0,0,0.2); 619 548 } 620 #theme-overlay .screenshot:after {549 .theme-overlay .screenshot:after { 621 550 content: ''; 622 551 display: block; 623 552 padding-top: 66.66666%; /* using a 3/2 aspect ratio */ 624 553 } 625 #theme-overlay .screenshot img {554 .theme-overlay .screenshot img { 626 555 cursor: pointer; 627 556 height: auto; 628 557 position: absolute; … … 631 560 width: 100%; 632 561 } 633 562 /* Other screenshots, shown small and square */ 634 #theme-overlay .screenshot.thumb {563 .theme-overlay .screenshot.thumb { 635 564 background: #ccc; 636 565 border: 1px solid #eee; 637 566 float: none; … … 640 569 width: 140px; 641 570 height: 80px; 642 571 } 643 #theme-overlay .screenshot.thumb:after {572 .theme-overlay .screenshot.thumb:after { 644 573 content: ''; 645 574 display: block; 646 575 padding-top: 100%; /* using a 1/1 aspect ratio */ 647 576 } 648 #theme-overlay .screenshot.thumb img {577 .theme-overlay .screenshot.thumb img { 649 578 cursor: pointer; 650 579 height: auto; 651 580 position: absolute; … … 654 583 width: 100%; 655 584 height: auto; 656 585 } 657 #theme-overlay .screenshot.selected {586 .theme-overlay .screenshot.selected { 658 587 background: transparent; 659 588 border: 2px solid #2ea2cc; 660 589 } 661 #theme-overlay .screenshot.selected img {590 .theme-overlay .screenshot.selected img { 662 591 opacity: 0.8; 663 592 } 664 593 /* 665 594 * Theme heading information 666 595 */ 667 #theme-overlay .theme-info {596 .theme-overlay .theme-info { 668 597 width: 40%; 669 598 float: left; 670 599 } 671 #theme-overlay .current-label {600 .theme-overlay .current-label { 672 601 background: #333; 673 602 color: #fff; 674 603 font-size: 11px; … … 679 608 -webkit-user-select: none; 680 609 user-select: none; 681 610 } 682 #theme-overlay .theme-name {611 .theme-overlay .theme-name { 683 612 color: #222; 684 613 font-size: 32px; 685 614 font-weight: 100; … … 686 615 margin: 10px 0 0; 687 616 line-height: 1.3; 688 617 } 689 #theme-overlay .theme-version {618 .theme-overlay .theme-version { 690 619 color: #999; 691 620 font-size: 13px; 692 621 font-weight: 400; … … 696 625 -webkit-user-select: none; 697 626 user-select: none; 698 627 } 699 #theme-overlay .theme-author {628 .theme-overlay .theme-author { 700 629 color: #686868; 701 630 font-size: 16px; 702 631 font-weight: 400; 703 632 margin: 15px 0 25px; 704 633 } 705 #theme-overlay .theme-author a {634 .theme-overlay .theme-author a { 706 635 text-decoration: none; 707 636 } 708 #theme-overlay .theme-description {637 .theme-overlay .theme-description { 709 638 color: #555; 710 639 font-size: 15px; 711 640 font-weight: 400; … … 712 641 line-height: 1.5; 713 642 margin: 30px 0 0 0; 714 643 } 715 #theme-overlay .theme-tags {644 .theme-overlay .theme-tags { 716 645 border-top: 3px solid #eee; 717 646 color: #888; 718 647 font-size: 13px; … … 721 650 padding-top: 20px; 722 651 text-transform: capitalize; 723 652 } 724 #theme-overlay .theme-tags span {653 .theme-overlay .theme-tags span { 725 654 color: #444; 726 655 font-weight: bold; 727 656 margin-right: 5px; 728 657 } 729 #theme-overlay .theme-actions {658 .theme-overlay .theme-actions { 730 659 } 731 660 /* Theme Updates info */ 732 #theme-overlay .theme-update-message {661 .theme-overlay .theme-update-message { 733 662 background: #fefaf7; 734 663 border: 1px solid #eee; 735 664 border-left: 4px solid #d54e21; … … 736 665 border-radius: 3px; 737 666 padding: 5px 20px 10px; 738 667 } 739 #theme-overlay .theme-update {668 .theme-overlay .theme-update { 740 669 color: #222; 741 670 font-size: 18px; 742 671 display: inline-block; … … 743 672 line-height: 40px; 744 673 margin: 0; 745 674 } 746 #theme-overlay .parent-theme {675 .theme-overlay .parent-theme { 747 676 background: #f7fcfe; 748 677 border: 1px solid #eee; 749 678 border-left: 4px solid #2ea2cc; … … 752 681 margin-top: 30px; 753 682 padding: 10px 10px 10px 20px; 754 683 } 755 #theme-overlay .parent-theme strong {684 .theme-overlay .parent-theme strong { 756 685 font-weight: 700; 757 686 } 758 687 … … 833 762 .theme.add-new:after { 834 763 font-size: 23vw; 835 764 } 836 #theme-overlay .theme-wrap,837 #theme-overlay .theme-actions {765 .theme-overlay .theme-wrap, 766 .theme-overlay .theme-actions { 838 767 right: 15%; 839 768 left: 22%; 840 769 } … … 856 785 } 857 786 /* Mini-sidebar in MP6 */ 858 787 @media ( max-width: 900px ) { 859 #theme-overlay .theme-wrap,860 #theme-overlay .theme-actions {788 .theme-overlay .theme-wrap, 789 .theme-overlay .theme-actions { 861 790 left: 76px; 862 791 } 863 792 } … … 866 795 margin-top: 6px; 867 796 margin-right: -3px 868 797 } 869 #theme-overlay .theme-wrap {798 .theme-overlay .theme-wrap { 870 799 top: 45px; 871 800 right: 0px; 872 801 bottom: 0px; … … 873 802 left: 0px; 874 803 padding: 70px 20px 100px; 875 804 } 876 #theme-overlay .theme-actions {805 .theme-overlay .theme-actions { 877 806 right: 0px; 878 807 bottom: 0px; 879 808 left: 0px; … … 880 809 text-align: left; 881 810 padding: 10px; 882 811 } 883 #theme-overlay .theme-screenshots {812 .theme-overlay .theme-screenshots { 884 813 width: 40%; 885 814 } 886 #theme-overlay .theme-info {815 .theme-overlay .theme-info { 887 816 width: 50%; 888 817 } 889 #theme-overlay .theme-actions .delete-theme {818 .theme-overlay .theme-actions .delete-theme { 890 819 bottom: 10px; 891 820 } 892 . search-form{821 .theme-browser .theme-search { 893 822 top: 3px; 894 823 } 895 824 } … … 908 837 .theme.add-new:after { 909 838 font-size: 53vw; 910 839 } 911 #theme-overlay .theme-update,912 #theme-overlay .theme-description {840 .theme-overlay .theme-update, 841 .theme-overlay .theme-description { 913 842 margin-left: 0; 914 843 } 915 #theme-overlay.active .theme-actions .active-theme .button:nth-child(3n) {844 .theme-overlay.active .theme-actions .active-theme .button:nth-child(3n) { 916 845 display: none; 917 846 } 918 847 .theme.active .theme-actions .button { … … 919 848 margin-top: 6px; 920 849 margin-right: 0; 921 850 } 922 #theme-overlay .theme-screenshots {851 .theme-overlay .theme-screenshots { 923 852 width: 100%; 924 853 float: none; 925 854 } 926 #theme-overlay .theme-info {855 .theme-overlay .theme-info { 927 856 width: 100%; 928 857 } 929 #theme-overlay .theme-author {858 .theme-overlay .theme-author { 930 859 margin: 5px 0 15px 0; 931 860 } 932 #theme-overlay .theme-version {861 .theme-overlay .theme-version { 933 862 margin-left: 0; 934 863 position: absolute; 935 864 top: 18px; 936 865 left: 130px; 937 866 } 938 #theme-overlay .current-label {867 .theme-overlay .current-label { 939 868 margin-top: 10px; 940 869 font-size: 13px; 941 870 } … … 942 871 /* 943 872 * Search form 944 873 */ 945 . search-form{874 .theme-browser .theme-search { 946 875 float: none; 947 876 clear: both; 948 877 left: 0; 949 }950 #theme-search {951 878 margin: 10px 0; 952 879 width: 100%; 953 880 } -
wp-admin/css/wp-admin.css
6534 6534 color: #cfcfcf; 6535 6535 } 6536 6536 6537 #broken-themes { 6537 .broken-themes { 6538 clear: both; 6539 } 6540 6541 .broken-themes table { 6538 6542 text-align: left; 6539 6543 width: 50%; 6540 6544 border-spacing: 3px; -
wp-admin/js/theme.js
4 4 ( function($) { 5 5 6 6 // Set up our namespace... 7 var themes = wp.themes = wp.themes || {}; 7 var themes, l10n; 8 themes = wp.themes = wp.themes || {}; 8 9 9 10 // Store the theme data and settings for organized and quick access 10 11 // themes.data.settings, themes.data.themes, themes.data.i18n 11 12 themes.data = _wpThemeSettings; 13 l10n = themes.data.l10n; 12 14 13 15 // Setup app structure 14 16 _.extend( themes, { model: {}, view: {}, routes: {}, router: {}, template: wp.template }); … … 17 19 18 20 // Main view controller for themes.php 19 21 // Unifies and renders all available views 20 //21 // Hooks to #appearance and organizes the views to be rendered22 22 themes.view.Appearance = wp.Backbone.View.extend({ 23 23 24 // Set DOM container 25 // {#appearance} by default 26 el: themes.data.settings.container, 24 el: '#wpbody-content .wrap .theme-browser', 27 25 28 26 window: $( window ), 29 27 // Pagination instance … … 30 28 page: 0, 31 29 32 30 events: { 33 'click .themes-bulk-edit': 'editMode',34 31 'click .theme .delete-theme': 'deleteTheme' 35 32 }, 36 33 … … 61 58 collection: this.collection, 62 59 parent: this 63 60 }); 61 62 // Render search form. 63 this.search(); 64 64 65 // Render and append 65 66 this.view.render(); 66 67 this.$el.append( this.view.el ); 67 68 // Search form69 this.search();70 68 }, 71 69 72 70 // Search input and view … … 79 77 80 78 // Render and append after screen title 81 79 view.render(); 82 self.$el. find( '> h2' ).after( view.el );80 self.$el.append( view.el ); 83 81 }, 84 82 85 83 // Checks when the user gets close to the bottom … … 97 95 } 98 96 }, 99 97 100 // Enters edit mode that allows easy access to deleting themes101 editMode: function() {102 $( 'body' ).toggleClass( 'edit-mode' );103 this.$el.find( '.themes-bulk-edit' ).toggleClass( 'mp6-text-highlight' );104 },105 106 98 deleteTheme: function() { 107 99 return confirm( themes.data.settings.confirmDelete ); 108 100 } … … 219 211 if ( this.model.get( 'active' ) ) { 220 212 this.$el.addClass( 'active' ); 221 213 this.$el.find( '.theme-name' ).addClass( 'mp6-primary' ); 222 $( ' #theme-overlay' ).addClass( 'active' );214 $( '.theme-overlay' ).addClass( 'active' ); 223 215 } 224 216 }, 225 217 … … 245 237 themes.view.Details = wp.Backbone.View.extend({ 246 238 247 239 // Wrap theme data on a div.theme element 248 id: 'theme-overlay',240 className: 'theme-overlay', 249 241 250 242 events: { 251 243 'click': 'collapse', … … 259 251 260 252 render: function() { 261 253 var data = this.model.toJSON(); 262 263 254 this.$el.html( this.html( data ) ); 264 255 // Renders active theme styles 265 256 this.activeTheme(); … … 271 262 // and to the overlay in detailed view mode 272 263 activeTheme: function() { 273 264 // Check the model has the active property 274 if ( this.model.get( 'active' ) ) { 275 this.$el.addClass( 'active' ); 276 } else { 277 $( '#theme-overlay' ).removeClass( 'active' ); 278 } 265 this.$el.toggleClass( 'active', this.model.get( 'active' ) ); 279 266 }, 280 267 281 268 // Single theme overlay screen … … 297 284 // With a quick fade out animation 298 285 this.$el.fadeOut( 130, function() { 299 286 // Clicking outside the modal box closes the overlay 300 $( 'body' ).removeClass( 'theme-overlay closing-overlay' );287 $( 'body' ).removeClass( 'theme-overlay-open closing-overlay' ); 301 288 // Handle event cleanup 302 289 self.closeOverlay(); 303 290 … … 380 367 } 381 368 }); 382 369 383 // Controls the rendering of div #themes,370 // Controls the rendering of div.themes, 384 371 // a wrapper that will hold all the theme elements 385 372 themes.view.Themes = wp.Backbone.View.extend({ 386 373 387 id: 'themes',374 className: 'themes', 388 375 389 376 // Number to keep track of scroll position 390 377 // while in theme-overlay mode … … 391 378 index: 0, 392 379 393 380 // The theme count element 394 count: $( ' #theme-count' ),381 count: $( '.theme-count' ), 395 382 396 383 initialize: function( options ) { 397 384 var self = this; … … 445 432 446 433 // Make sure the add-new stays at the end 447 434 if ( page >= 1 ) { 448 $( ' #add-new' ).remove();435 $( '.add-new-theme' ).remove(); 449 436 } 450 437 451 438 // Loop through the themes and setup each theme view … … 456 443 457 444 // Render the views... 458 445 self.theme.render(); 459 // and append them to div #themes446 // and append them to div.themes 460 447 self.$el.append( self.theme.el ); 461 448 462 449 // Binds to theme:expand to show the modal box … … 465 452 }); 466 453 467 454 // 'Add new theme' element shown at the end of the grid 468 this.$el.append( '<div id="add-new" class="theme add-new"><a href="' + themes.data.settings.install_uri + '"><div class="theme-screenshot"><span></span></div><h3 class="theme-name">' + themes.data.i18n.add_new + '</h3></a></div>' );455 this.$el.append( '<div class="theme add-new-theme"><a href="' + themes.data.settings.install_uri + '"><div class="theme-screenshot"><span></span></div><h3 class="theme-name">' + l10n.add_new + '</h3></a></div>' ); 469 456 470 457 this.parent.page++; 471 458 }, … … 502 489 503 490 // Sets this.view to 'detail' 504 491 this.setView( 'detail' ); 505 $( 'body' ).addClass( 'theme-overlay ' );492 $( 'body' ).addClass( 'theme-overlay-open' ); 506 493 507 494 // Set up the theme details view 508 495 this.overlay = new themes.view.Details({ 509 model: self.model, 510 className: 'theme-' + self.model.id 496 model: self.model 511 497 }); 512 498 513 499 this.overlay.render(); … … 564 550 565 551 // Create the view 566 552 this.nextTheme = new themes.view.Details({ 567 model: nextModel, 568 className: 'theme-' + nextModel.id 553 model: nextModel 569 554 }); 570 555 571 556 // Trigger a route update for the current model … … 600 585 601 586 // Create the view 602 587 this.previousTheme = new themes.view.Details({ 603 model: previousModel, 604 className: 'theme-' + previousModel.id 588 model: previousModel 605 589 }); 606 590 607 591 // Trigger a route update for the current model … … 618 602 } 619 603 }); 620 604 621 // Search input view controller 622 // renders #search-form 605 // Search input view controller. 623 606 themes.view.Search = wp.Backbone.View.extend({ 624 607 625 className: 'search-form', 608 tagName: 'input', 609 className: 'theme-search', 626 610 627 // 'keyup' triggers search 628 events: { 629 'keyup #theme-search': 'search' 611 attributes: { 612 placeholder: l10n.search 630 613 }, 631 614 632 // Grabs template file 633 html: themes.template( 'theme-search' ), 634 635 // Render the search form 636 render: function() { 637 var self = this; 638 self.$el.html( self.html ); 615 events: { 616 'input': 'search', 617 'keyup': 'search', 618 'change': 'search', 619 'search': 'search' 639 620 }, 640 621 641 // Runs a search on the theme collection 642 // bind on 'keyup' event 643 search: function() { 644 this.collection.doSearch( $( '#theme-search' ).val() ); 622 // Runs a search on the theme collection. 623 search: function( event ) { 624 // Clear on escape. 625 if ( event.type === 'keyup' && event.which === 27 ) { 626 event.target.value = ''; 627 } 628 this.collection.doSearch( event.target.value ); 645 629 } 646 630 }); 647 631 … … 656 640 657 641 // Set the search input value based on url 658 642 search: function( query ) { 659 $( ' #theme-search' ).val( query );643 $( '.theme-search' ).val( query ); 660 644 } 661 645 }); 662 646 -
wp-admin/themes.php
95 95 'customizeURI' => ( current_user_can( 'edit_theme_options' ) ) ? wp_customize_url() : null, 96 96 'confirmDelete' => __( "Are you sure you want to delete this theme?\n\nClick 'Cancel' to go back, 'OK' to confirm the delete." ), 97 97 'root' => '/wp-admin/themes.php', 98 'container' => '#appearance',99 98 'extraRoutes' => '', 100 99 ), 101 'i18n' => array( 102 'add_new' => __( 'Add New Theme' ), 100 'l10n' => array( 101 'add_new' => __( 'Add New Theme' ), 102 'search' => __( 'Search...' ), 103 103 ), 104 104 ) ); 105 105 … … 110 110 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 111 111 ?> 112 112 113 <div id="appearance"class="wrap">113 <div class="wrap"> 114 114 <h2><?php esc_html_e( 'Themes' ); ?> 115 <span id="theme-count"class="theme-count"></span>115 <span class="theme-count"></span> 116 116 <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> 117 117 <a href="<?php echo admin_url( 'theme-install.php' ); ?>" class="add-new-h2"><?php echo esc_html( _x( 'Add New', 'Add new theme' ) ); ?></a> 118 118 <?php endif; ?> 119 119 </h2> 120 120 121 <div class="theme-browser"></div> 122 121 123 <?php 122 124 if ( ! validate_current_theme() || isset( $_GET['broken'] ) ) : ?> 123 125 <div id="message1" class="updated"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div> … … 181 183 if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { 182 184 ?> 183 185 186 <div class="broken-themes"> 184 187 <h3><?php _e('Broken Themes'); ?></h3> 185 188 <p><?php _e('The following themes are installed but incomplete. Themes must have a stylesheet and a template.'); ?></p> 186 189 187 <table id="broken-themes">190 <table> 188 191 <tr> 189 192 <th><?php _ex('Name', 'theme name'); ?></th> 190 193 <th><?php _e('Description'); ?></th> … … 193 196 foreach ( $broken_themes as $broken_theme ) { 194 197 echo " 195 198 <tr> 196 <td>" . $broken_theme->get('Name') ."</td>199 <td>" . ( $broken_theme->get( 'Name' ) ? $broken_theme->get( 'Name' ) : $broken_theme->get_stylesheet() ) . "</td> 197 200 <td>" . $broken_theme->errors()->get_error_message() . "</td> 198 201 </tr>"; 199 202 } 200 203 ?> 201 204 </table> 205 </div> 206 202 207 <?php 203 208 } 204 209 ?> … … 233 238 <# } #> 234 239 </script> 235 240 236 <script id="tmpl-theme-search" type="text/template">237 <input type="text" name="theme-search" id="theme-search" placeholder="<?php esc_attr_e( 'Search...' ); ?>" />238 </script>239 240 241 <script id="tmpl-theme-single" type="text/template"> 241 242 <div class="theme-backdrop"></div> 242 243 <div class="theme-wrap"> … … 246 247 <div alt="<?php _e( 'Show next theme' ); ?>" class="right dashicons dashicons-no"></div> 247 248 </div> 248 249 249 <div class="theme-screenshots" id="theme-screenshots">250 <div class="theme-screenshots"> 250 251 <div class="screenshot first"><img src="{{ data.screenshot[0] }}" alt="" /></div> 251 252 <# 252 253 if ( _.size( data.screenshot ) > 1 ) {