From 62d21f0d6783e8bf2b976c097ea6c550e32003f3 Mon Sep 17 00:00:00 2001 From: Mark Holmquist Date: Thu, 13 Nov 2014 11:48:14 -0600 Subject: [PATCH] Toggle the panel when "view more" is clicked Better for reading the license information. Change-Id: I9299d62baafdcc797e66fe3c17fe9c3712570105 Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/988 --- resources/mmv/ui/mmv.ui.metadataPanel.js | 2 +- resources/mmv/ui/mmv.ui.permission.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/mmv/ui/mmv.ui.metadataPanel.js b/resources/mmv/ui/mmv.ui.metadataPanel.js index 61c012f8c..82c5ab315 100644 --- a/resources/mmv/ui/mmv.ui.metadataPanel.js +++ b/resources/mmv/ui/mmv.ui.metadataPanel.js @@ -196,7 +196,7 @@ this.initializeCredit(); this.description = new mw.mmv.ui.Description( this.$imageMetadataLeft ); - this.permission = new mw.mmv.ui.Permission( this.$imageMetadataLeft ); + this.permission = new mw.mmv.ui.Permission( this.$imageMetadataLeft, this.scroller ); this.initializeImageLinks(); }; diff --git a/resources/mmv/ui/mmv.ui.permission.js b/resources/mmv/ui/mmv.ui.permission.js index 4e103a84f..74919af4e 100644 --- a/resources/mmv/ui/mmv.ui.permission.js +++ b/resources/mmv/ui/mmv.ui.permission.js @@ -27,8 +27,9 @@ * @extends mw.mmv.ui.Element * @constructor * @param {jQuery} $container + * @param {mw.mmv.ui.MetadataPanelScroller} scroller */ - function Permission( $container ) { + function Permission( $container, scroller ) { var permission = this; mw.mmv.ui.Element.call( this, $container ); @@ -64,6 +65,7 @@ .on( 'click', '.mw-mmv-permission-text-viewmore', function( e ) { e.preventDefault(); permission.grow(); + permission.scroller.toggle( 'up' ); } ) ; @@ -99,6 +101,12 @@ permission.shrink(); } ) .appendTo( this.$box ); + + /** + * Panel scroller from the metadata panel object. + * @property {mw.mmv.ui.MetadataPanelScroller} + */ + this.scroller = scroller; } oo.inheritClass( Permission, mw.mmv.ui.Element ); P = Permission.prototype;