<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[29376] trunk/src/wp-includes: Media modal/grid: remove thumbnail resizing from JS, only keep setting number of columns.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/29376">29376</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2014-08-05 05:19:09 +0000 (Tue, 05 Aug 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Media modal/grid: remove thumbnail resizing from JS, only keep setting number of columns. Props avryl, see <a href="http://core.trac.wordpress.org/ticket/27423">#27423</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludescssmediaviewscss">trunk/src/wp-includes/css/media-views.css</a></li>
<li><a href="#trunksrcwpincludesjsmediaviewsjs">trunk/src/wp-includes/js/media-views.js</a></li>
<li><a href="#trunksrcwpincludesmediatemplatephp">trunk/src/wp-includes/media-template.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludescssmediaviewscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/css/media-views.css (29375 => 29376)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/css/media-views.css 2014-08-05 01:30:03 UTC (rev 29375)
+++ trunk/src/wp-includes/css/media-views.css 2014-08-05 05:19:09 UTC (rev 29376)
</span><span class="lines">@@ -700,7 +700,7 @@
</span><span class="cx"> */
</span><span class="cx"> .attachments {
</span><span class="cx"> margin: 0;
</span><del>- padding-right: 16px;
</del><ins>+ padding: 8px;
</ins><span class="cx"> -webkit-overflow-scrolling: touch;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -710,101 +710,74 @@
</span><span class="cx"> .attachment {
</span><span class="cx"> position: relative;
</span><span class="cx"> float: left;
</span><del>- padding: 0;
- margin: 0 10px 20px;
</del><ins>+ padding: 8px;
+ margin: 0;
</ins><span class="cx"> color: #464646;
</span><ins>+ cursor: pointer;
</ins><span class="cx"> list-style: none;
</span><span class="cx"> text-align: center;
</span><span class="cx"> -webkit-user-select: none;
</span><span class="cx"> -moz-user-select: none;
</span><span class="cx"> -ms-user-select: none;
</span><span class="cx"> user-select: none;
</span><ins>+ width: 20%;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .attachment:focus {
</span><span class="cx"> -webkit-box-shadow:
</span><del>- 0 0 0 1px #5b9dd9,
- 0 0 2px 2px #5b9dd9;
</del><ins>+ inset 0 0 0 5px #fff,
+ inset 0 0 1px 7px #5b9dd9;
</ins><span class="cx"> box-shadow:
</span><del>- 0 0 0 1px #5b9dd9,
- 0 0 2px 2px #5b9dd9;
</del><ins>+ inset 0 0 0 5px #fff,
+ inset 0 0 1px 7px #5b9dd9;
</ins><span class="cx"> outline: none;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .selected.attachment {
</span><span class="cx"> -webkit-box-shadow:
</span><del>- 0 0 0 1px #fff,
- 0 0 0 3px #ccc;
</del><ins>+ inset 0 0 0 5px #fff,
+ inset 0 0 0 7px #ccc;
</ins><span class="cx"> box-shadow:
</span><del>- 0 0 0 1px #fff,
- 0 0 0 3px #ccc;
</del><ins>+ inset 0 0 0 5px #fff,
+ inset 0 0 0 7px #ccc;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-.selected.attachment:focus {
- -webkit-box-shadow:
- 0 0 0 1px #fff,
- 0 0 0 5px #1e8cbe;
- box-shadow:
- 0 0 0 1px #fff,
- 0 0 0 5px #1e8cbe;
-}
-
</del><span class="cx"> .attachment-preview {
</span><span class="cx"> position: relative;
</span><del>- width: 199px;
- height: 199px;
- -webkit-box-shadow:
- inset 0 0 15px rgba( 0, 0, 0, 0.1 ),
- inset 0 0 0 1px rgba( 0, 0, 0, 0.05 );
- box-shadow:
- inset 0 0 15px rgba( 0, 0, 0, 0.1 ),
- inset 0 0 0 1px rgba( 0, 0, 0, 0.05 );
- background: #eee;
- cursor: pointer;
</del><span class="cx"> }
</span><span class="cx">
</span><ins>+.attachment-preview:before {
+ content: '';
+ display: block;
+ padding-top: 100%;
+}
+
</ins><span class="cx"> .attachment .icon {
</span><span class="cx"> margin: 0 auto;
</span><span class="cx"> overflow: hidden;
</span><del>- padding-top: 20%;
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .attachment .thumbnail {
</span><del>- display: block;
</del><ins>+ overflow: hidden;
</ins><span class="cx"> position: absolute;
</span><span class="cx"> top: 0;
</span><ins>+ right: 0;
+ bottom: 0;
</ins><span class="cx"> left: 0;
</span><del>- margin: 0 auto;
- overflow: hidden;
- max-width: 100%;
- max-height: 100%;
</del><span class="cx"> }
</span><span class="cx">
</span><del>-.attachment-preview.type-audio .thumbnail,
-.attachment-preview.type-video .thumbnail {
- z-index: 1;
- margin: 1%;
- max-width: 98%;
- max-height: 98%;
</del><ins>+.attachment .portrait img {
+ max-width: 100%;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-.media-frame-content .attachment-preview.type-audio .icon,
-.media-frame-content .attachment-preview.type-video .icon {
- z-index: 2;
- background: #f1f1f1;
- position: relative;
- padding: 0;
- top: 15%;
- left: auto;
- right: auto;
</del><ins>+.attachment .landscape img {
+ max-height: 100%;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-.attachment-preview.type-audio .filename,
-.attachment-preview.type-video .filename {
- z-index: 3;
-}
-
-.attachment-preview .thumbnail:after {
</del><ins>+.attachment .thumbnail:after {
</ins><span class="cx"> content: '';
</span><span class="cx"> display: block;
</span><span class="cx"> position: absolute;
</span><span class="lines">@@ -831,13 +804,13 @@
</span><span class="cx"> width: 100%;
</span><span class="cx"> height: 100%;
</span><span class="cx"> -webkit-transform: translate( 50%, 50% );
</span><del>- -ms-transform: translate( 50%, 50% );
</del><ins>+ -ms-transform: translate(50%,50%); /* Fails with spaces?? Weird! */
</ins><span class="cx"> transform: translate( 50%, 50% );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .attachment .thumbnail .centered img {
</span><span class="cx"> -webkit-transform: translate( -50%, -50% );
</span><del>- -ms-transform: translate( -50%, -50% );
</del><ins>+ -ms-transform: translate(-50%,-50%);
</ins><span class="cx"> transform: translate( -50%, -50% );
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -848,7 +821,6 @@
</span><span class="cx"> bottom: 0;
</span><span class="cx"> overflow: hidden;
</span><span class="cx"> max-height: 100%;
</span><del>-
</del><span class="cx"> word-wrap: break-word;
</span><span class="cx"> text-align: center;
</span><span class="cx"> font-weight: bold;
</span><span class="lines">@@ -861,11 +833,6 @@
</span><span class="cx"> padding: 5px 10px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.attachment-preview .thumbnail {
- width: 199px;
- height: 199px;
-}
-
</del><span class="cx"> .attachment .thumbnail img {
</span><span class="cx"> position: absolute;
</span><span class="cx"> }
</span><span class="lines">@@ -907,8 +874,8 @@
</span><span class="cx"> width: 24px;
</span><span class="cx"> position: absolute;
</span><span class="cx"> z-index: 10;
</span><del>- top: -6px;
- right: -6px;
</del><ins>+ top: 0;
+ right: 0;
</ins><span class="cx"> outline: none;
</span><span class="cx"> background: #eee;
</span><span class="cx"> -webkit-box-shadow: 0 0 0 1px #fff, 0 0 0 2px rgba( 0, 0, 0, 0.15 );
</span><span class="lines">@@ -930,22 +897,27 @@
</span><span class="cx"> display: block;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.selected.attachment:focus,
</ins><span class="cx"> .attachment.details,
</span><span class="cx"> .media-frame.mode-grid .selected.attachment {
</span><del>- -webkit-box-shadow: 0 0 0 1px #fff,
- 0 0 0 5px #1e8cbe;
- box-shadow: 0 0 0 1px #fff,
- 0 0 0 5px #1e8cbe;
</del><ins>+ -webkit-box-shadow:
+ inset 0 0 0 3px #fff,
+ inset 0 0 0 7px #1e8cbe;
+ box-shadow:
+ inset 0 0 0 3px #fff,
+ inset 0 0 0 7px #1e8cbe;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .attachment.details .check,
</span><span class="cx"> .attachment.selected .check:focus,
</span><span class="cx"> .media-frame.mode-grid .attachment.selected .check {
</span><span class="cx"> background-color: #1e8cbe;
</span><del>- -webkit-box-shadow: 0 0 0 1px #fff,
- 0 0 0 2px #1e8cbe;
- box-shadow: 0 0 0 1px #fff,
- 0 0 0 2px #1e8cbe;
</del><ins>+ -webkit-box-shadow:
+ 0 0 0 1px #fff,
+ 0 0 0 2px #1e8cbe;
+ box-shadow:
+ 0 0 0 1px #fff,
+ 0 0 0 2px #1e8cbe;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> .media-frame.mode-grid .attachment .check {
</span><span class="lines">@@ -971,7 +943,7 @@
</span><span class="cx"> position: relative;
</span><span class="cx"> display: block;
</span><span class="cx"> width: 100%;
</span><del>- margin: -1px 0 0;
</del><ins>+ margin: 0;
</ins><span class="cx"> padding: 8px;
</span><span class="cx"> font-size: 12px;
</span><span class="cx"> -webkit-border-radius: 0;
</span><span class="lines">@@ -1218,7 +1190,7 @@
</span><span class="cx"> left: 0;
</span><span class="cx"> right: 0;
</span><span class="cx"> -webkit-transform: translateY( -50% );
</span><del>- -ms-transform: translateY( -50% );
</del><ins>+ -ms-transform: translateY(-50%);
</ins><span class="cx"> transform: translateY( -50% );
</span><span class="cx"> font-size: 40px;
</span><span class="cx"> color: #fff;
</span><span class="lines">@@ -1381,16 +1353,32 @@
</span><span class="cx"> .media-selection .attachments {
</span><span class="cx"> display: inline-block;
</span><span class="cx"> height: 48px;
</span><del>- margin-top: 5px;
</del><ins>+ margin: 6px;
+ padding: 0;
</ins><span class="cx"> overflow: hidden;
</span><span class="cx"> vertical-align: top;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+.media-selection .attachment {
+ width: 48px;
+ padding: 0;
+ margin: 0;
+ -webkit-box-shadow: none;
+ box-shadow: none;
+}
+
+.media-selection .attachment .thumbnail {
+ top: 4px;
+ right: 4px;
+ bottom: 4px;
+ left: 4px;
+}
+
</ins><span class="cx"> .media-selection .attachment .icon {
</span><span class="cx"> width: 50%;
</span><span class="cx"> }
</span><del>-
-.attachment.selection.selected {
</del><ins>+/*
+.attachment.selection.selected .thumbnail {
</ins><span class="cx"> -webkit-box-shadow: none;
</span><span class="cx"> box-shadow: none;
</span><span class="cx"> }
</span><span class="lines">@@ -1413,8 +1401,8 @@
</span><span class="cx"> 0 0 0 1px #fff,
</span><span class="cx"> 0 0 0 4px #1e8cbe;
</span><span class="cx"> }
</span><del>-
-.media-selection .attachment.selection.details {
</del><ins>+*/
+.media-selection .attachment.selection.details .thumbnail {
</ins><span class="cx"> -webkit-box-shadow:
</span><span class="cx"> 0 0 0 1px #fff,
</span><span class="cx"> 0 0 0 3px #1e8cbe;
</span><span class="lines">@@ -2056,7 +2044,7 @@
</span><span class="cx"> left: 0;
</span><span class="cx"> right: 0;
</span><span class="cx"> -webkit-transform: translateY( -50% );
</span><del>- -ms-transform: translateY( -50% );
</del><ins>+ -ms-transform: translateY(-50%);
</ins><span class="cx"> transform: translateY( -50% );
</span><span class="cx"> font-size: 3em;
</span><span class="cx"> line-height: 1.3;
</span><span class="lines">@@ -2914,3 +2902,51 @@
</span><span class="cx"> max-width: none !important;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+.attachments[data-columns="1"] .attachment {
+ width: 100%;
+}
+
+.attachments[data-columns="2"] .attachment {
+ width: 50%;
+}
+
+.attachments[data-columns="3"] .attachment {
+ width: 33.3%;
+}
+
+.attachments[data-columns="4"] .attachment {
+ width: 25%;
+}
+
+.attachments[data-columns="5"] .attachment {
+ width: 20%;
+}
+
+.attachments[data-columns="6"] .attachment {
+ width: 16.6%;
+}
+
+.attachments[data-columns="7"] .attachment {
+ width: 14.2%;
+}
+
+.attachments[data-columns="8"] .attachment {
+ width: 12.5%;
+}
+
+.attachments[data-columns="9"] .attachment {
+ width: 11.1%;
+}
+
+.attachments[data-columns="10"] .attachment {
+ width: 10%;
+}
+
+.attachments[data-columns="11"] .attachment {
+ width: 9%;
+}
+
+.attachments[data-columns="12"] .attachment {
+ width: 8.3%;
+}
</ins></span></pre></div>
<a id="trunksrcwpincludesjsmediaviewsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-views.js (29375 => 29376)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-views.js 2014-08-05 01:30:03 UTC (rev 29375)
+++ trunk/src/wp-includes/js/media-views.js 2014-08-05 05:19:09 UTC (rev 29376)
</span><span class="lines">@@ -630,14 +630,6 @@
</span><span class="cx"> }) );
</span><span class="cx"> }
</span><span class="cx">
</span><del>- if ( ! this.get('edge') ) {
- this.set( 'edge', 150 );
- }
-
- if ( ! this.get('gutter') ) {
- this.set( 'gutter', 8 );
- }
-
</del><span class="cx"> this.resetDisplays();
</span><span class="cx"> },
</span><span class="cx">
</span><span class="lines">@@ -835,12 +827,12 @@
</span><span class="cx"> content: 'browse',
</span><span class="cx"> toolbar: 'gallery-edit',
</span><span class="cx">
</span><del>- describe: true,
- displaySettings: true,
- dragInfo: true,
- edge: 199,
- editing: false,
- priority: 60,
</del><ins>+ describe: true,
+ displaySettings: true,
+ dragInfo: true,
+ idealColumnWidth: 170,
+ editing: false,
+ priority: 60,
</ins><span class="cx">
</span><span class="cx"> // Don't sync the selection, as the Edit Gallery library
</span><span class="cx"> // *is* the selection.
</span><span class="lines">@@ -989,12 +981,12 @@
</span><span class="cx"> // Region mode defaults.
</span><span class="cx"> content: 'browse',
</span><span class="cx">
</span><del>- describe: true,
- dragInfo: true,
- edge: 199,
- editing: false,
- priority: 60,
- SettingsView: false,
</del><ins>+ describe: true,
+ dragInfo: true,
+ idealColumnWidth: 170,
+ editing: false,
+ priority: 60,
+ SettingsView: false,
</ins><span class="cx">
</span><span class="cx"> // Don't sync the selection, as the Edit {Collection} library
</span><span class="cx"> // *is* the selection.
</span><span class="lines">@@ -2178,8 +2170,9 @@
</span><span class="cx"> display: state.has('display') ? state.get('display') : state.get('displaySettings'),
</span><span class="cx"> dragInfo: state.get('dragInfo'),
</span><span class="cx">
</span><del>- suggestedWidth: state.get('suggestedWidth'),
- suggestedHeight: state.get('suggestedHeight'),
</del><ins>+ idealColumnWidth: state.get('idealColumnWidth'),
+ suggestedWidth: state.get('suggestedWidth'),
+ suggestedHeight: state.get('suggestedHeight'),
</ins><span class="cx">
</span><span class="cx"> AttachmentView: state.get('AttachmentView')
</span><span class="cx"> });
</span><span class="lines">@@ -4805,8 +4798,8 @@
</span><span class="cx"> arrowEvent: function( event ) {
</span><span class="cx"> var attachment = $('.attachments-browser .attachment'),
</span><span class="cx"> attachmentsWidth = $('.attachments-browser .attachments').width(),
</span><del>- thumbnailWidth = attachment.first().innerWidth() + 16,
- thumbnailsPerRow = Math.floor(attachmentsWidth/thumbnailWidth),
</del><ins>+ thumbnailWidth = attachment.first().width(),
+ thumbnailsPerRow = Math.round( attachmentsWidth / thumbnailWidth ),
</ins><span class="cx"> totalThumnails = attachment.length,
</span><span class="cx"> totalRows = Math.ceil(totalThumnails/thumbnailsPerRow),
</span><span class="cx"> thisIndex = attachment.filter( ':focus' ).index(),
</span><span class="lines">@@ -5218,8 +5211,6 @@
</span><span class="cx"> tabIndex: -1
</span><span class="cx"> },
</span><span class="cx">
</span><del>- cssTemplate: media.template('attachments-css'),
-
</del><span class="cx"> initialize: function() {
</span><span class="cx"> this.el.id = _.uniqueId('__attachments-view-');
</span><span class="cx">
</span><span class="lines">@@ -5228,7 +5219,8 @@
</span><span class="cx"> refreshThreshold: 3,
</span><span class="cx"> AttachmentView: media.view.Attachment,
</span><span class="cx"> sortable: false,
</span><del>- resize: true
</del><ins>+ resize: true,
+ idealColumnWidth: 150
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> this._viewsByCid = {};
</span><span class="lines">@@ -5258,56 +5250,35 @@
</span><span class="cx">
</span><span class="cx"> this.initSortable();
</span><span class="cx">
</span><del>- _.bindAll( this, 'css' );
- this.model.on( 'change:edge change:gutter', this.css, this );
- this._resizeCss = _.debounce( _.bind( this.css, this ), this.refreshSensitivity );
</del><ins>+ _.bindAll( this, 'setColumns' );
+
</ins><span class="cx"> if ( this.options.resize ) {
</span><del>- $(window).on( 'resize.attachments', this._resizeCss );
</del><ins>+ $( window ).on( 'resize.attachments', this.setColumns );
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- // Call this.css() after this view has been rendered in the DOM so
</del><ins>+ // Call this.setColumns() after this view has been rendered in the DOM so
</ins><span class="cx"> // attachments get proper width applied.
</span><del>- _.defer( this.css, this );
</del><ins>+ _.defer( this.setColumns, this );
</ins><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> dispose: function() {
</span><span class="cx"> this.collection.props.off( null, null, this );
</span><del>- $(window).off( 'resize.attachments', this._resizeCss );
</del><ins>+ $( window ).off( 'resize.attachments', this.setColumns );
+
</ins><span class="cx"> /**
</span><span class="cx"> * call 'dispose' directly on the parent class
</span><span class="cx"> */
</span><span class="cx"> media.View.prototype.dispose.apply( this, arguments );
</span><span class="cx"> },
</span><span class="cx">
</span><del>- css: function() {
- var $css = $( '#' + this.el.id + '-css' );
</del><ins>+ setColumns: function() {
+ var prev = this.columns;
</ins><span class="cx">
</span><del>- if ( $css.length ) {
- $css.remove();
- }
</del><ins>+ this.columns = Math.round( this.$el.width() / this.options.idealColumnWidth );
</ins><span class="cx">
</span><del>- media.view.Attachments.$head().append( this.cssTemplate({
- id: this.el.id,
- edge: this.edge(),
- gutter: this.model.get('gutter')
- }) );
- },
- /**
- * @returns {Number}
- */
- edge: function() {
- var edge = this.model.get('edge'),
- gutter, width, columns;
-
- if ( ! this.$el.is(':visible') ) {
- return edge;
</del><ins>+ if ( prev !== this.columns ) {
+ this.$el.attr( 'data-columns', this.columns );
</ins><span class="cx"> }
</span><del>-
- gutter = this.model.get('gutter') * 2;
- width = this.$el.width() - gutter;
- columns = Math.ceil( width / ( edge + gutter ) );
- edge = Math.floor( ( width - ( columns * gutter ) ) / columns );
- return edge;
</del><span class="cx"> },
</span><span class="cx">
</span><span class="cx"> initSortable: function() {
</span><span class="lines">@@ -5453,13 +5424,6 @@
</span><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- }, {
- $head: (function() {
- var $head;
- return function() {
- return $head = $head || $('head');
- };
- }())
</del><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> /**
</span><span class="lines">@@ -5895,6 +5859,7 @@
</span><span class="cx"> model: this.model,
</span><span class="cx"> sortable: this.options.sortable,
</span><span class="cx"> scrollElement: this.options.scrollElement,
</span><ins>+ idealColumnWidth: this.options.idealColumnWidth,
</ins><span class="cx">
</span><span class="cx"> // The single `Attachment` view to be used in the `Attachments` view.
</span><span class="cx"> AttachmentView: this.options.AttachmentView
</span><span class="lines">@@ -6003,10 +5968,7 @@
</span><span class="cx"> controller: this.controller,
</span><span class="cx"> collection: this.collection,
</span><span class="cx"> selection: this.collection,
</span><del>- model: new Backbone.Model({
- edge: 40,
- gutter: 5
- })
</del><ins>+ model: new Backbone.Model()
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> this.views.set( '.selection-view', this.attachments );
</span></span></pre></div>
<a id="trunksrcwpincludesmediatemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media-template.php (29375 => 29376)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media-template.php 2014-08-05 01:30:03 UTC (rev 29375)
+++ trunk/src/wp-includes/media-template.php 2014-08-05 05:19:09 UTC (rev 29376)
</span><span class="lines">@@ -414,24 +414,26 @@
</span><span class="cx">
</span><span class="cx"> <script type="text/html" id="tmpl-attachment">
</span><span class="cx"> <div class="attachment-preview js--select-attachment type-{{ data.type }} subtype-{{ data.subtype }} {{ data.orientation }}">
</span><del>- <# if ( data.uploading ) { #>
- <div class="media-progress-bar"><div></div></div>
- <# } else if ( 'image' === data.type ) { #>
- <div class="thumbnail">
</del><ins>+ <div class="thumbnail">
+ <# if ( data.uploading ) { #>
+ <div class="media-progress-bar"><div>
+ <# } else if ( 'image' === data.type ) { #>
</ins><span class="cx"> <div class="centered">
</span><span class="cx"> <img src="{{ data.size.url }}" draggable="false" alt="" />
</span><span class="cx"> </div>
</span><del>- </div>
- <# } else {
- if ( data.thumb && data.thumb.src && data.thumb.src !== data.icon ) {
- #><img src="{{ data.thumb.src }}" class="thumbnail" draggable="false" /><#
- } else {
- #><img src="{{ data.icon }}" class="icon" draggable="false" /><#
- } #>
- <div class="filename">
- <div>{{ data.filename }}</div>
- </div>
- <# } #>
</del><ins>+ <# } else { #>
+ <div class="centered">
+ <# if ( data.thumb && data.thumb.src && data.thumb.src !== data.icon ) { #>
+ <img src="{{ data.thumb.src }}" class="thumbnail" draggable="false" />
+ <# } else { #>
+ <img src="{{ data.icon }}" class="icon" draggable="false" />
+ <# } #>
+ </div>
+ <div class="filename">
+ <div>{{ data.filename }}</div>
+ </div>
+ <# } #>
+ </div>
</ins><span class="cx"> <# if ( data.buttons.close ) { #>
</span><span class="cx"> <a class="close media-modal-icon" href="#" title="<?php esc_attr_e('Remove'); ?>"></a>
</span><span class="cx"> <# } #>
</span><span class="lines">@@ -822,35 +824,6 @@
</span><span class="cx"> </div>
</span><span class="cx"> </script>
</span><span class="cx">
</span><del>- <script type="text/html" id="tmpl-attachments-css">
- <style type="text/css" id="{{ data.id }}-css">
- #{{ data.id }} {
- padding: 0 {{ data.gutter }}px;
- }
-
- #{{ data.id }} .attachment {
- margin: {{ data.gutter }}px;
- width: {{ data.edge }}px;
- }
-
- #{{ data.id }} .attachment-preview,
- #{{ data.id }} .attachment-preview .thumbnail {
- width: {{ data.edge }}px;
- height: {{ data.edge }}px;
- }
-
- #{{ data.id }} .portrait .thumbnail img {
- max-width: {{ data.edge }}px;
- height: auto;
- }
-
- #{{ data.id }} .landscape .thumbnail img {
- width: auto;
- max-height: {{ data.edge }}px;
- }
- </style>
- </script>
-
</del><span class="cx"> <script type="text/html" id="tmpl-image-details">
</span><span class="cx"> <div class="media-embed">
</span><span class="cx"> <div class="embed-media-settings">
</span></span></pre>
</div>
</div>
</body>
</html>