From f846003ea7c2a6ab1e8a312e23e23b8237e576c9 Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Mon, 20 Apr 2015 19:48:08 +0000 Subject: [PATCH] Media: Date filtering does not need to be on for all contexts. Affected areas include customizer upload controls and video playlist editing. props ocean90. fixes #32004. git-svn-id: https://develop.svn.wordpress.org/trunk@32228 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/media-views.js | 27 +++++++++++-------- .../js/media/controllers/collection-edit.js | 2 ++ .../js/media/controllers/gallery-edit.js | 2 ++ .../js/media/views/attachments/browser.js | 22 +++++++-------- .../js/media/views/frame/select.js | 1 + 5 files changed, 32 insertions(+), 22 deletions(-) diff --git a/src/wp-includes/js/media-views.js b/src/wp-includes/js/media-views.js index 47611b69b7..184a0aefff 100644 --- a/src/wp-includes/js/media-views.js +++ b/src/wp-includes/js/media-views.js @@ -124,6 +124,7 @@ module.exports = CollectionAdd; * @param {string} attributes.menu Initial mode for the menu region. @todo this needs a better explanation. * @param {boolean} [attributes.searchable=false] Whether the library is searchable. * @param {boolean} [attributes.sortable=true] Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection. + * @param {boolean} [attributes.date=true] Whether to show the date filter in the browser's toolbar. * @param {boolean} [attributes.describe=true] Whether to offer UI to describe the attachments - e.g. captioning images in a gallery. * @param {boolean} [attributes.dragInfo=true] Whether to show instructional text about the attachments being sortable. * @param {boolean} [attributes.dragInfoText] Instructional text about the attachments being sortable. @@ -147,6 +148,7 @@ CollectionEdit = Library.extend({ defaults: { multiple: false, sortable: true, + date: false, searchable: false, content: 'browse', describe: true, @@ -835,6 +837,7 @@ module.exports = GalleryAdd; * @param {boolean} [attributes.multiple=false] Whether multi-select is enabled. * @param {boolean} [attributes.searchable=false] Whether the library is searchable. * @param {boolean} [attributes.sortable=true] Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection. + * @param {boolean} [attributes.date=true] Whether to show the date filter in the browser's toolbar. * @param {string|false} [attributes.content=browse] Initial mode for the content region. * @param {string|false} [attributes.toolbar=image-details] Initial mode for the toolbar region. * @param {boolean} [attributes.describe=true] Whether to offer UI to describe attachments - e.g. captioning images in a gallery. @@ -859,6 +862,7 @@ GalleryEdit = Library.extend({ multiple: false, searchable: false, sortable: true, + date: false, display: false, content: 'browse', toolbar: 'gallery-edit', @@ -3680,17 +3684,17 @@ module.exports = Attachments; * @augments wp.Backbone.View * @augments Backbone.View * - * @param {object} options - * @param {object} [options.filters=false] Which filters to show in the browser's toolbar. - * Accepts 'uploaded' and 'all'. - * @param {object} [options.search=true] Whether to show the search interface in the - * browser's toolbar. - * @param {object} [options.date=true] Whether to show the date filter in the - * browser's toolbar. - * @param {object} [options.display=false] Whether to show the attachments display settings - * view in the sidebar. - * @param {bool|string} [options.sidebar=true] Whether to create a sidebar for the browser. - * Accepts true, false, and 'errors'. + * @param {object} [options] The options hash passed to the view. + * @param {boolean|string} [options.filters=false] Which filters to show in the browser's toolbar. + * Accepts 'uploaded' and 'all'. + * @param {boolean} [options.search=true] Whether to show the search interface in the + * browser's toolbar. + * @param {boolean} [options.date=true] Whether to show the date filter in the + * browser's toolbar. + * @param {boolean} [options.display=false] Whether to show the attachments display settings + * view in the sidebar. + * @param {boolean|string} [options.sidebar=true] Whether to create a sidebar for the browser. + * Accepts true, false, and 'errors'. */ var View = wp.media.View, mediaTrash = wp.media.view.settings.mediaTrash, @@ -5956,6 +5960,7 @@ Select = MediaFrame.extend({ sortable: state.get('sortable'), search: state.get('searchable'), filters: state.get('filterable'), + date: state.get('date'), display: state.has('display') ? state.get('display') : state.get('displaySettings'), dragInfo: state.get('dragInfo'), diff --git a/src/wp-includes/js/media/controllers/collection-edit.js b/src/wp-includes/js/media/controllers/collection-edit.js index a715faf70f..29b259cbf2 100644 --- a/src/wp-includes/js/media/controllers/collection-edit.js +++ b/src/wp-includes/js/media/controllers/collection-edit.js @@ -20,6 +20,7 @@ * @param {string} attributes.menu Initial mode for the menu region. @todo this needs a better explanation. * @param {boolean} [attributes.searchable=false] Whether the library is searchable. * @param {boolean} [attributes.sortable=true] Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection. + * @param {boolean} [attributes.date=true] Whether to show the date filter in the browser's toolbar. * @param {boolean} [attributes.describe=true] Whether to offer UI to describe the attachments - e.g. captioning images in a gallery. * @param {boolean} [attributes.dragInfo=true] Whether to show instructional text about the attachments being sortable. * @param {boolean} [attributes.dragInfoText] Instructional text about the attachments being sortable. @@ -43,6 +44,7 @@ CollectionEdit = Library.extend({ defaults: { multiple: false, sortable: true, + date: false, searchable: false, content: 'browse', describe: true, diff --git a/src/wp-includes/js/media/controllers/gallery-edit.js b/src/wp-includes/js/media/controllers/gallery-edit.js index da9b2e1708..3535479780 100644 --- a/src/wp-includes/js/media/controllers/gallery-edit.js +++ b/src/wp-includes/js/media/controllers/gallery-edit.js @@ -18,6 +18,7 @@ * @param {boolean} [attributes.multiple=false] Whether multi-select is enabled. * @param {boolean} [attributes.searchable=false] Whether the library is searchable. * @param {boolean} [attributes.sortable=true] Whether the Attachments should be sortable. Depends on the orderby property being set to menuOrder on the attachments collection. + * @param {boolean} [attributes.date=true] Whether to show the date filter in the browser's toolbar. * @param {string|false} [attributes.content=browse] Initial mode for the content region. * @param {string|false} [attributes.toolbar=image-details] Initial mode for the toolbar region. * @param {boolean} [attributes.describe=true] Whether to offer UI to describe attachments - e.g. captioning images in a gallery. @@ -42,6 +43,7 @@ GalleryEdit = Library.extend({ multiple: false, searchable: false, sortable: true, + date: false, display: false, content: 'browse', toolbar: 'gallery-edit', diff --git a/src/wp-includes/js/media/views/attachments/browser.js b/src/wp-includes/js/media/views/attachments/browser.js index aff6bf84a8..6172497538 100644 --- a/src/wp-includes/js/media/views/attachments/browser.js +++ b/src/wp-includes/js/media/views/attachments/browser.js @@ -8,17 +8,17 @@ * @augments wp.Backbone.View * @augments Backbone.View * - * @param {object} options - * @param {object} [options.filters=false] Which filters to show in the browser's toolbar. - * Accepts 'uploaded' and 'all'. - * @param {object} [options.search=true] Whether to show the search interface in the - * browser's toolbar. - * @param {object} [options.date=true] Whether to show the date filter in the - * browser's toolbar. - * @param {object} [options.display=false] Whether to show the attachments display settings - * view in the sidebar. - * @param {bool|string} [options.sidebar=true] Whether to create a sidebar for the browser. - * Accepts true, false, and 'errors'. + * @param {object} [options] The options hash passed to the view. + * @param {boolean|string} [options.filters=false] Which filters to show in the browser's toolbar. + * Accepts 'uploaded' and 'all'. + * @param {boolean} [options.search=true] Whether to show the search interface in the + * browser's toolbar. + * @param {boolean} [options.date=true] Whether to show the date filter in the + * browser's toolbar. + * @param {boolean} [options.display=false] Whether to show the attachments display settings + * view in the sidebar. + * @param {boolean|string} [options.sidebar=true] Whether to create a sidebar for the browser. + * Accepts true, false, and 'errors'. */ var View = wp.media.View, mediaTrash = wp.media.view.settings.mediaTrash, diff --git a/src/wp-includes/js/media/views/frame/select.js b/src/wp-includes/js/media/views/frame/select.js index 0b14432ab1..b5142833f4 100644 --- a/src/wp-includes/js/media/views/frame/select.js +++ b/src/wp-includes/js/media/views/frame/select.js @@ -131,6 +131,7 @@ Select = MediaFrame.extend({ sortable: state.get('sortable'), search: state.get('searchable'), filters: state.get('filterable'), + date: state.get('date'), display: state.has('display') ? state.get('display') : state.get('displaySettings'), dragInfo: state.get('dragInfo'),