jenkins-bot has submitted this change and it was merged.

Change subject: Put the annotations in a container, not body
......................................................................


Put the annotations in a container, not body

Kind of wonky when the container is a thumbnail, but that's probably fine
for now.

Bug: T145453
Change-Id: Iefc514eb5d9ea70b28a738018a89a4c29fb24ec2
---
M resources/src/fileannotations.js
1 file changed, 22 insertions(+), 10 deletions(-)

Approvals:
  Bartosz Dziewoński: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/resources/src/fileannotations.js b/resources/src/fileannotations.js
index 1fb0ec4..a8ae9c4 100644
--- a/resources/src/fileannotations.js
+++ b/resources/src/fileannotations.js
@@ -15,12 +15,12 @@
         * @cfg {boolean} [editing] Whether to enable editing annotations.
         */
        function FileAnnotator( config ) {
-               var offset, $annotationInfo, createButton,
+               var $annotationInfo, createButton,
                        annotator = this;
 
                this.api = new mw.Api();
 
-               this.$fileLink = config.$container;
+               this.$fileLink = config.$infoContainer;
                this.fileTitle = config.title;
                this.$img = this.$fileLink.find( 'img' );
                this.editing = !!config.editing;
@@ -33,16 +33,18 @@
                this.$container = $( '<div>' )
                        .addClass( 'annotation-wrapper' );
 
-               offset = this.$img.offset();
-
                this.$container.css( {
-                       top: offset.top,
-                       left: offset.left,
+                       top: 0,
+                       left: 0,
                        width: this.$img.width(),
                        height: this.$img.height()
                } );
 
-               $( 'body' ).append( this.$container );
+               config.$container.css( {
+                       position: 'relative'
+               } );
+
+               config.$container.append( this.$container );
 
                this.annotationsTitle = mw.Title.newFromText( 
'File_Annotations:' + this.fileTitle.getMain() );
 
@@ -538,7 +540,8 @@
                // This is a file page, so just dump the main image into the
                // annotator class, with editing and a notification below the 
image.
                pageAnnotator = new FileAnnotator( {
-                       $container: $fileLink,
+                       $container: $( '#file' ),
+                       $infoContainer: $fileLink,
                        title: pageTitle,
                        editing: true
                } );
@@ -550,10 +553,19 @@
                        $div.find( 'a.image' ).each( function () {
                                var thumbAnnotator,
                                        $link = $( this ),
-                                       $img = $link.find( 'img' );
+                                       $img = $link.find( 'img' ),
+                                       $container = $( '<div>' )
+                                               .addClass( 
'fileannotations-standin-container' )
+                                               .css( {
+                                                       display: 'inline-block'
+                                               } );
+
+                               $link.after( $container );
+                               $container.append( $link );
 
                                thumbAnnotator = new FileAnnotator( {
-                                       $container: $link,
+                                       $container: $container,
+                                       $infoContainer: $link,
                                        title: mw.Title.newFromImg( $img ),
                                        editing: false
                                } );

-- 
To view, visit https://gerrit.wikimedia.org/r/310881
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iefc514eb5d9ea70b28a738018a89a4c29fb24ec2
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/FileAnnotations
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <mholmqu...@wikimedia.org>
Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to