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

Change subject: Moved edit functionality to fingerprintgroupview
......................................................................


Moved edit functionality to fingerprintgroupview

Removed edittoolbar definition from fingerprintview and added definition for
fingerprintgroupview. Necessary edit functionality has been implemented
in fingerprintlistview and fingerprintgroupview.

Change-Id: I19c1bbda6a06b8b2147c266540b63a7f6de195d1
---
M lib/resources/jquery.wikibase/jquery.wikibase.entityview.js
M lib/resources/jquery.wikibase/jquery.wikibase.fingerprintgroupview.js
M lib/resources/jquery.wikibase/jquery.wikibase.fingerprintlistview.js
M lib/resources/jquery.wikibase/jquery.wikibase.fingerprintview.js
M lib/resources/jquery.wikibase/resources.php
M 
lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintgroupview.css
M lib/resources/templates.php
M lib/resources/wikibase.css
M lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintgroupview.tests.js
M lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintlistview.tests.js
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/View/TermBoxView.php
M repo/resources/wikibase.ui.entityViewInit.js
M repo/tests/phpunit/includes/View/TermBoxViewTest.php
15 files changed, 517 insertions(+), 107 deletions(-)

Approvals:
  Tobias Gritschacher: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.entityview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.entityview.js
index 1769bba..9a429cd 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.entityview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.entityview.js
@@ -200,14 +200,15 @@
                                language: this.options.languages[i],
                                label: this.options.value.getLabel( 
this.options.languages[i] ) || null,
                                description: this.options.value.getDescription( 
this.options.languages[i] ) || null,
-                               aliases: this.options.value.getAliases( 
this.options.languages[i] ) || null
+                               aliases: this.options.value.getAliases( 
this.options.languages[i] ) || []
                        } );
                }
 
                this.$fingerprints.fingerprintgroupview( {
                        value: value,
                        entityId: this.options.value.getId(),
-                       api: this.options.api
+                       api: this.options.api,
+                       helpMessage: mw.msg( 
'wikibase-fingerprintgroupview-input-help-message' )
                } );
        },
 
diff --git 
a/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintgroupview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintgroupview.js
index 100948d..4580ed6 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintgroupview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintgroupview.js
@@ -21,6 +21,28 @@
  * @options {string} entityId
  *
  * @option {wikibase.RepoApi} api
+ *
+ * @option {string} [helpMessage]
+ *                  Default: 'Edit label, description and aliases per 
language.'
+ *
+ * @event change
+ *        - {jQuery.Event}
+ *
+ * @event afterstartediting
+ *       - [jQuery.Event}
+ *
+ * @event stopediting
+ *        - {jQuery.Event}
+ *        - {boolean} Whether to drop the value.
+ *        - {Function} Callback function.
+ *
+ * @event afterstopediting
+ *        - {jQuery.Event}
+ *        - {boolean} Whether to drop the value.
+ *
+ * @event toggleerror
+ *        - {jQuery.Event}
+ *        - {Error|null}
  */
 $.widget( 'wikibase.fingerprintgroupview', PARENT, {
        options: {
@@ -29,15 +51,22 @@
                        function() {
                                return mw.msg( 'wikibase-terms' );
                        },
-                       '' // fingerprintlistview
+                       '', // fingerprintlistview
+                       '' // edit section
                ],
                templateShortCuts: {
                        $h: 'h2'
                },
                value: [],
                entityId: null,
-               api: null
+               api: null,
+               helpMessage: 'Edit label, description and aliases per language.'
        },
+
+       /**
+        * @type {boolean}
+        */
+       _isInEditMode: false,
 
        /**
         * @type {jQuery}
@@ -89,11 +118,121 @@
         * Creates and initializes the fingerprintlistview widget.
         */
        _createFingerprintlistview: function() {
-               this.$fingerprintlistview.fingerprintlistview( {
+               var self = this,
+                       prefix = 
$.wikibase.fingerprintlistview.prototype.widgetEventPrefix;
+
+               this.$fingerprintlistview
+               .fingerprintlistview( {
                        value: this.options.value,
                        entityId: this.options.entityId,
                        api: this.options.api
-               } );
+               } )
+               .on( prefix + 'change', function( event ) {
+                       event.stopPropagation();
+                       self._trigger( 'change' );
+               } )
+               .on( prefix + 'toggleerror.' + self.widgetName, function( 
event, error ) {
+                       event.stopPropagation();
+                       self.setError( error );
+               } )
+               .on(
+                       [
+                               prefix + 'create.' + self.widgetName,
+                               prefix + 'afterstartediting.' + self.widgetName,
+                               prefix + 'stopediting.' + self.widgetName,
+                               prefix + 'afterstopediting.' + self.widgetName,
+                               prefix + 'disable.' + self.widgetName
+                       ].join( ' ' ),
+                       function( event ) {
+                               event.stopPropagation();
+                       }
+               );
+       },
+
+       /**
+        * @return {boolean}
+        */
+       isValid: function() {
+               return this.$fingerprintlistview.data( 'fingerprintlistview' 
).isValid();
+       },
+
+       /**
+        * @return {boolean}
+        */
+       isInitialValue: function() {
+               return this.$fingerprintlistview.data( 'fingerprintlistview' 
).isInitialValue();
+       },
+
+       startEditing: function() {
+               if( this._isInEditMode ) {
+                       return;
+               }
+
+               this._isInEditMode = true;
+               this.element.addClass( 'wb-edit' );
+
+               this.$fingerprintlistview.data( 'fingerprintlistview' 
).startEditing();
+
+               this._trigger( 'afterstartediting' );
+       },
+
+       /**
+        * @param {boolean} [dropValue]
+        */
+       stopEditing: function( dropValue ) {
+               var self = this;
+
+               if( !this._isInEditMode || ( !this.isValid() || 
this.isInitialValue() ) && !dropValue ) {
+                       return;
+               }
+
+               dropValue = !!dropValue;
+
+               this._trigger( 'stopediting', null, [dropValue] );
+
+               this.disable();
+
+               this.$fingerprintlistview.one(
+                       'fingerprintlistviewafterstopediting',
+                       function( dropValue ) {
+                               self._afterStopEditing( dropValue );
+                       }
+               );
+
+               this.$fingerprintlistview.data( 'fingerprintlistview' 
).stopEditing( dropValue );
+       },
+
+       /**
+        * @param {boolean} dropValue
+        */
+       _afterStopEditing: function( dropValue ) {
+               this._isInEditMode = false;
+               this.enable();
+               this.element.removeClass( 'wb-edit' );
+               this._trigger( 'afterstopediting', null, [dropValue] );
+       },
+
+       cancelEditing: function() {
+               this.stopEditing( true );
+       },
+
+       focus: function() {
+               this.$fingerprintlistview.data( 'fingerprintlistview' ).focus();
+       },
+
+       /**
+        * Applies/Removes error state.
+        *
+        * @param {Error} [error]
+        */
+       setError: function( error ) {
+               if( error ) {
+                       this.element.addClass( 'wb-error' );
+                       this._trigger( 'toggleerror', null, [error] );
+               } else {
+                       this.element.removeClass( 'wb-error' );
+                       this._trigger( 'toggleerror' );
+               }
        },
 
        /**
@@ -110,4 +249,67 @@
        }
 } );
 
+$.wikibase.toolbarcontroller.definition( 'edittoolbar', {
+       id: 'fingerprintgroupview',
+       selector: ':' + $.wikibase.fingerprintgroupview.prototype.namespace
+               + '-' + $.wikibase.fingerprintgroupview.prototype.widgetName,
+       events: {
+               fingerprintgroupviewcreate: function( event, toolbarcontroller 
) {
+                       var $fingerprintgroupview = $( event.target ),
+                               fingerprintgroupview = 
$fingerprintgroupview.data( 'fingerprintgroupview' );
+
+                       $fingerprintgroupview.edittoolbar( {
+                               $container: $( '<div/>' )
+                                       .appendTo( $fingerprintgroupview.find(
+                                               
'.wikibase-fingerprintgroupview-heading-container'
+                                       ) ),
+                               interactionWidgetName: 
$.wikibase.fingerprintgroupview.prototype.widgetName,
+                               enableRemove: false
+                       } );
+
+                       $fingerprintgroupview.on( 'keyup', function( event ) {
+                               if( fingerprintgroupview.option( 'disabled' ) ) 
{
+                                       return;
+                               }
+                               if( event.keyCode === $.ui.keyCode.ESCAPE ) {
+                                       fingerprintgroupview.stopEditing( true 
);
+                               } else if( event.keyCode === $.ui.keyCode.ENTER 
) {
+                                       fingerprintgroupview.stopEditing( false 
);
+                               }
+                       } );
+               },
+               'fingerprintgroupviewchange 
fingerprintgroupviewafterstartediting': function( event ) {
+                       var $fingerprintgroupview = $( event.target ),
+                               fingerprintgroupview = 
$fingerprintgroupview.data( 'fingerprintgroupview' ),
+                               toolbar = $fingerprintgroupview.data( 
'edittoolbar' ).toolbar,
+                               $btnSave = toolbar.editGroup.getButton( 'save' 
),
+                               btnSave = $btnSave.data( 'toolbarbutton' ),
+                               enable = fingerprintgroupview.isValid() && 
!fingerprintgroupview.isInitialValue();
+
+                       btnSave[enable ? 'enable' : 'disable']();
+               },
+               fingerprintgroupviewdisable: function( event ) {
+                       var $fingerprintgroupview = $( event.target ),
+                               fingerprintgroupview = 
$fingerprintgroupview.data( 'fingerprintgroupview' ),
+                               toolbar = $fingerprintgroupview.data( 
'edittoolbar' ).toolbar,
+                               $btnSave = toolbar.editGroup.getButton( 'save' 
),
+                               btnSave = $btnSave.data( 'toolbarbutton' ),
+                               enable = fingerprintgroupview.isValid() && 
!fingerprintgroupview.isInitialValue();
+
+                       btnSave[enable ? 'enable' : 'disable']();
+               },
+               toolbareditgroupedit: function( event, toolbarcontroller ) {
+                       var $fingerprintgroupview = $( event.target ).closest( 
':wikibase-edittoolbar' ),
+                               fingerprintgroupview = 
$fingerprintgroupview.data( 'fingerprintgroupview' );
+
+                       if( !fingerprintgroupview ) {
+                               return;
+                       }
+
+                       fingerprintgroupview.focus();
+               }
+       }
+} );
+
+
 }( mediaWiki, jQuery ) );
diff --git 
a/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintlistview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintlistview.js
index bd33e34..450cb45 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintlistview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintlistview.js
@@ -21,6 +21,25 @@
  * @options {string} entityId
  *
  * @option {wikibase.RepoApi} api
+ *
+ * @event change
+ *        - {jQuery.Event}
+ *
+ * @event afterstartediting
+ *       - [jQuery.Event}
+ *
+ * @event stopediting
+ *        - {jQuery.Event}
+ *        - {boolean} Whether to drop the value.
+ *        - {Function} Callback function.
+ *
+ * @event afterstopediting
+ *        - {jQuery.Event}
+ *        - {boolean} Whether to drop the value.
+ *
+ * @event toggleerror
+ *        - {jQuery.Event}
+ *        - {Error|null}
  */
 $.widget( 'wikibase.fingerprintlistview', PARENT, {
        options: {
@@ -33,6 +52,11 @@
                entityId: null,
                api: null
        },
+
+       /**
+        * @type {boolean}
+        */
+       _isInEditMode: false,
 
        /**
         * @see jQuery.ui.TemplatedWidget._create
@@ -68,12 +92,37 @@
         * Creates the listview widget managing the fingerprintview widgets
         */
        _createListView: function() {
-               var self = this;
+               var self = this,
+                       listItemWidget = $.wikibase.fingerprintview,
+                       prefix = listItemWidget.prototype.widgetEventPrefix;
+
+               // Fully encapsulate child widgets by suppressing their events:
+               this.element
+               .on( prefix + 'change', function( event ) {
+                       event.stopPropagation();
+                       self._trigger( 'change' );
+               } )
+               .on( prefix + 'toggleerror.' + self.widgetName, function( 
event, error ) {
+                       event.stopPropagation();
+                       self.setError( error );
+               } )
+               .on(
+                       [
+                               prefix + 'create.' + self.widgetName,
+                               prefix + 'afterstartediting.' + self.widgetName,
+                               prefix + 'stopediting.' + self.widgetName,
+                               prefix + 'afterstopediting.' + self.widgetName,
+                               prefix + 'disable.' + self.widgetName
+                       ].join( ' ' ),
+                       function( event ) {
+                               event.stopPropagation();
+                       }
+               );
 
                this.element
                .listview( {
                        listItemAdapter: new 
$.wikibase.listview.ListItemAdapter( {
-                               listItemWidget: $.wikibase.fingerprintview,
+                               listItemWidget: listItemWidget,
                                listItemWidgetValueAccessor: 'value',
                                newItemOptionsFn: function( value ) {
                                        return {
@@ -93,6 +142,157 @@
        },
 
        /**
+        * @return {boolean}
+        */
+       isValid: function() {
+               var listview = this.element.data( 'listview' ),
+                       lia = listview.listItemAdapter(),
+                       isValid = true;
+
+               listview.items().each( function() {
+                       var fingerprintview = lia.liInstance( $( this ) );
+                       if( !fingerprintview.isValid() ) {
+                               isValid = false;
+                               return false;
+                       }
+               } );
+
+               return isValid;
+       },
+
+       /**
+        * @return {boolean}
+        */
+       isInitialValue: function() {
+               var listview = this.element.data( 'listview' ),
+                       lia = listview.listItemAdapter(),
+                       currentValue = [];
+
+               listview.items().each( function() {
+                       var fingerprintview = lia.liInstance( $( this ) );
+                       currentValue.push( fingerprintview.value() );
+               } );
+
+               if( currentValue.length !== this.options.value.length ) {
+                       return false;
+               }
+
+               // TODO: Implement and use Fingerprint in DataModelJavaScript 
component
+               for( var i = 0; i < currentValue.length; i++ ) {
+                       if(
+                               currentValue[i].language !== 
this.options.value[i].language
+                               || currentValue[i].label !== 
this.options.value[i].label
+                               || currentValue[i].description !== 
this.options.value[i].description
+                               || currentValue[i].aliases.length !== 
this.options.value[i].aliases.length
+                       ) {
+                               return false;
+                       }
+
+                       var currentAliases = currentValue[i].aliases;
+
+                       for( var j = 0; j < currentAliases.length; j++ ) {
+                               if( $.inArray( currentAliases[j], 
this.options.value[i].aliases ) === -1 ) {
+                                       return false;
+                               }
+                       }
+               }
+
+               return true;
+       },
+
+       startEditing: function() {
+               if( this._isInEditMode ) {
+                       return;
+               }
+
+               this._isInEditMode = true;
+               this.element.addClass( 'wb-edit' );
+
+               var listview = this.element.data( 'listview' ),
+                       lia = listview.listItemAdapter();
+
+               listview.items().each( function() {
+                       var fingerprintview = lia.liInstance( $( this ) );
+                       fingerprintview.startEditing();
+               } );
+
+               this._trigger( 'afterstartediting' );
+       },
+
+       /**
+        * @param {boolean} [dropValue]
+        */
+       stopEditing: function( dropValue ) {
+               var self = this;
+
+               if( !this._isInEditMode || ( !this.isValid() || 
this.isInitialValue() ) && !dropValue ) {
+                       return;
+               }
+
+               dropValue = !!dropValue;
+
+               this._trigger( 'stopediting', null, [dropValue] );
+
+               this.disable();
+
+               var listview = this.element.data( 'listview' ),
+                       lia = listview.listItemAdapter(),
+                       expectedEvents = listview.items().length;
+
+               this.element
+               .on( 'fingerprintviewafterstopediting.fingerprintlistview', 
function() {
+                       if( --expectedEvents === 0 ) {
+                               self.element.off( 
'fingerprintviewafterstopediting.fingerprintlistview' );
+                               self._afterStopEditing( dropValue );
+                       }
+               } );
+
+               listview.items().each( function() {
+                       var fingerprintview = lia.liInstance( $( this ) );
+                       fingerprintview.stopEditing( dropValue || 
fingerprintview.isInitialValue() );
+               } );
+       },
+
+       /**
+        * @param {boolean} dropValue
+        */
+       _afterStopEditing: function( dropValue ) {
+               this._isInEditMode = false;
+               this.enable();
+               this.element.removeClass( 'wb-edit' );
+               this._trigger( 'afterstopediting', null, [dropValue] );
+       },
+
+       cancelEditing: function() {
+               this.stopEditing( true );
+       },
+
+       focus: function() {
+               var listview = this.element.data( 'listview' ),
+                       lia = listview.listItemAdapter(),
+                       $items = listview.items();
+
+               if( $items.length ) {
+                       lia.liInstance( $items.first() ).focus();
+               }
+       },
+
+       /**
+        * Applies/Removes error state.
+        *
+        * @param {Error} [error]
+        */
+       setError: function( error ) {
+               if( error ) {
+                       this.element.addClass( 'wb-error' );
+                       this._trigger( 'toggleerror', null, [error] );
+               } else {
+                       this.element.removeClass( 'wb-error' );
+                       this._trigger( 'toggleerror' );
+               }
+       },
+
+       /**
         * @see jQuery.ui.TemplatedWidget._setOption
         */
        _setOption: function( key, value ) {
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintview.js 
b/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintview.js
index c3a1be8..44aa347 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.fingerprintview.js
@@ -65,11 +65,8 @@
                                return wb.getLanguageNameByCode( 
this.options.value.language );
                        },
                        '', // label
-                       '', // label toolbar
                        '', // description
-                       '', // description toolbar
-                       '', // aliases
-                       '' // aliases toolbar
+                       '' // aliases
                ],
                templateShortCuts: {
                        $language: '.wikibase-fingerprintview-language',
@@ -414,56 +411,6 @@
                }
        }
 
-} );
-
-$.wikibase.toolbarcontroller.definition( 'edittoolbar', {
-       id: 'fingerprintview',
-       selector: ':' + $.wikibase.fingerprintview.prototype.namespace
-               + '-' + $.wikibase.fingerprintview.prototype.widgetName,
-       events: {
-               fingerprintviewcreate: function( event, toolbarcontroller ) {
-                       var $fingerprintview = $( event.target ),
-                               fingerprintview = $fingerprintview.data( 
'fingerprintview' );
-
-                       $fingerprintview.edittoolbar( {
-                               $container: $( '<td rowspan="3" />' )
-                                       .appendTo( $fingerprintview.children( 
'tr' ).first() ),
-                               interactionWidgetName: 
$.wikibase.fingerprintview.prototype.widgetName,
-                               enableRemove: false
-                       } );
-
-                       $fingerprintview.on( 'keyup', function( event ) {
-                               if( fingerprintview.option( 'disabled' ) ) {
-                                       return;
-                               }
-                               if( event.keyCode === $.ui.keyCode.ESCAPE ) {
-                                       fingerprintview.stopEditing( true );
-                               } else if( event.keyCode === $.ui.keyCode.ENTER 
) {
-                                       fingerprintview.stopEditing( false );
-                               }
-                       } );
-               },
-               'fingerprintviewchange fingerprintviewafterstartediting': 
function( event ) {
-                       var $fingerprintview = $( event.target ),
-                               fingerprintview = $fingerprintview.data( 
'fingerprintview' ),
-                               toolbar = $fingerprintview.data( 'edittoolbar' 
).toolbar,
-                               $btnSave = toolbar.editGroup.getButton( 'save' 
),
-                               btnSave = $btnSave.data( 'toolbarbutton' ),
-                               enable = fingerprintview.isValid() && 
!fingerprintview.isInitialValue();
-
-                       btnSave[enable ? 'enable' : 'disable']();
-               },
-               toolbareditgroupedit: function( event, toolbarcontroller ) {
-                       var $fingerprintview = $( event.target ).closest( 
':wikibase-edittoolbar' ),
-                               fingerprintview = $fingerprintview.data( 
'fingerprintview' );
-
-                       if( !fingerprintview ) {
-                               return;
-                       }
-
-                       fingerprintview.focus();
-               }
-       }
 } );
 
 }( mediaWiki, wikibase, jQuery ) );
diff --git a/lib/resources/jquery.wikibase/resources.php 
b/lib/resources/jquery.wikibase/resources.php
index 82195f8..2e99f38 100644
--- a/lib/resources/jquery.wikibase/resources.php
+++ b/lib/resources/jquery.wikibase/resources.php
@@ -164,6 +164,7 @@
                                'wikibase.templates',
                        ),
                        'messages' => array(
+                               
'wikibase-fingerprintgroupview-input-help-message',
                                'wikibase-terms',
                        ),
                ),
diff --git 
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintgroupview.css
 
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintgroupview.css
index 1da23c8..7c748d3 100644
--- 
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintgroupview.css
+++ 
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.fingerprintgroupview.css
@@ -4,11 +4,18 @@
  */
 .wikibase-fingerprintgroupview {
        float: left;
+       width: 100%;
 }
 
 .wikibase-fingerprintgroupview h2 {
-       margin-top: 0.6em;
-       margin-bottom: 0.2em;
-       padding-left: 10px;
-       border-bottom: none;
+       width: auto;
+}
+
+.wikibase-fingerprintgroupview 
.wikibase-fingerprintgroupview-heading-container {
+       position: relative;
+}
+
+.wikibase-fingerprintgroupview 
.wikibase-fingerprintgroupview-heading-container .wb-editsection {
+       float: right;
+       margin-top: 1.9em;
 }
diff --git a/lib/resources/templates.php b/lib/resources/templates.php
index cd68dcd..20b3707 100644
--- a/lib/resources/templates.php
+++ b/lib/resources/templates.php
@@ -244,7 +244,10 @@
        $templates['wikibase-fingerprintgroupview'] =
 <<<HTML
 <div class="wikibase-fingerprintgroupview">
-       <h2 id="wb-terms" class="wb-section-heading 
wikibase-fingerprintgroupview-heading">$1</h2>
+       <div class="wikibase-fingerprintgroupview-heading-container">
+               <h2 id="wb-terms" class="wb-section-heading 
wikibase-fingerprintgroupview-heading">$1</h2>
+               <!-- wb-editsection -->$3
+       </div>
        <!-- wikibase-fingerprintlistview -->$2
 </div>
 HTML;
@@ -255,7 +258,6 @@
        <colgroup>
                <col class="wikibase-fingerprintlistview-language" />
                <col class="wikibase-fingerprintlistview-label 
wikibase-fingerprintlistview-description wikibase-fingerprintlistview-aliases" 
/>
-               <col class="wb-editsection" />
        </colgroup>
        <!-- [0,*] wikibase-fingerprintview -->$1
 </table>
@@ -267,15 +269,12 @@
        <tr>
                <td class="wikibase-fingerprintview-language" rowspan="3"><a 
href="$2">$3</a></td>
                <td class="wikibase-fingerprintview-label">$4</td>
-               <!-- wb-edisection -->$5
        </tr>
        <tr>
-               <td class="wikibase-fingerprintview-description">$6</td>
-               <!-- wb-editsection -->$7
+               <td class="wikibase-fingerprintview-description">$5</td>
        </tr>
        <tr>
-               <td class="wikibase-fingerprintview-aliases">$8</td>
-               <!-- wb-editsection -->$9
+               <td class="wikibase-fingerprintview-aliases">$6</td>
        </tr>
 </tbody>
 HTML;
diff --git a/lib/resources/wikibase.css b/lib/resources/wikibase.css
index 98a191b..0ebadbf 100644
--- a/lib/resources/wikibase.css
+++ b/lib/resources/wikibase.css
@@ -57,8 +57,8 @@
        position: relative;
        float: left;
        width: 100%;
-       padding-top: 2em;
        margin-bottom: 0.2em;
+       margin-top: 1em;
        padding-left: 10px;
        border-bottom: none;
 }
diff --git 
a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintgroupview.tests.js 
b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintgroupview.tests.js
index 86ffe90..8c23677 100644
--- 
a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintgroupview.tests.js
+++ 
b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintgroupview.tests.js
@@ -71,4 +71,19 @@
        );
 } );
 
+QUnit.test( 'setError()', function( assert ) {
+       var $fingerprintgroupview = createFingerprintgroupview(),
+               fingerprintgroupview = $fingerprintgroupview.data( 
'fingerprintgroupview' );
+
+       $fingerprintgroupview
+       .on( 'fingerprintgroupviewtoggleerror', function( event, error ) {
+               assert.ok(
+                       true,
+                       'Triggered "toggleerror" event.'
+               );
+       } );
+
+       fingerprintgroupview.setError();
+} );
+
 }( jQuery, QUnit ) );
diff --git 
a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintlistview.tests.js 
b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintlistview.tests.js
index 28fd6c8..2b3c718 100644
--- 
a/lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintlistview.tests.js
+++ 
b/lib/tests/qunit/jquery.wikibase/jquery.wikibase.fingerprintlistview.tests.js
@@ -17,11 +17,13 @@
                        {
                                language: 'de',
                                label: 'de-label',
-                               description: 'de-description'
+                               description: 'de-description',
+                               aliases: []
                        }, {
                                language: 'en',
                                label: 'en-label',
-                               description: 'en-description'
+                               description: 'en-description',
+                               aliases: []
                        }
                ]
        }, options || {} );
@@ -71,4 +73,56 @@
        );
 } );
 
+QUnit.test( 'isInitialValue()', function( assert ) {
+       var $fingerprintlistview = createFingerprintlistview(),
+               fingerprintlistview = $fingerprintlistview.data( 
'fingerprintlistview' );
+
+       fingerprintlistview.startEditing();
+
+       assert.ok(
+               fingerprintlistview.isInitialValue(),
+               'Verified isInitialValue() returning true.'
+       );
+
+       var $item = $fingerprintlistview.data( 'listview' ).addItem( {
+               language: 'fa',
+               label: 'fa-label',
+               description: 'fa-description',
+               aliases: []
+       } );
+
+       assert.ok(
+               !fingerprintlistview.isInitialValue(),
+               'Verified isInitialValue() returning false after changing 
value.'
+       );
+
+       $fingerprintlistview.data( 'listview' ).removeItem( $item );
+
+       assert.ok(
+               fingerprintlistview.isInitialValue(),
+               'Verified isInitialValue() returning true after resetting to 
initial value.'
+       );
+} );
+
+// TODO: Add test which is kind of pointless without having a method to save a 
whole fingerprint
+// which could be overwritten by the test mechanism. Instead, the "save" 
functions of labelview,
+// descriptionview and aliasesview for each single fingerprintview would need 
to be overwritten
+// (see fingerprintview tests).
+// QUnit.test( 'startEditing() & stopEditing()', function( assert ) {} );
+
+QUnit.test( 'setError()', function( assert ) {
+       var $fingerprintlistview = createFingerprintlistview(),
+               fingerprintlistview = $fingerprintlistview.data( 
'fingerprintlistview' );
+
+       $fingerprintlistview
+       .on( 'fingerprintlistviewtoggleerror', function( event, error ) {
+               assert.ok(
+                       true,
+                       'Triggered "toggleerror" event.'
+               );
+       } );
+
+       fingerprintlistview.setError();
+} );
+
 }( jQuery, QUnit ) );
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index d809faa..652b5c9 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -33,7 +33,8 @@
        "wikibase-alias-edit-placeholder": "enter an alias",
        "wikibase-label-input-help-message": "Enter the label of this entity in 
$1.",
        "wikibase-description-input-help-message": "Enter a short description 
for this entity in $1.",
-       "wikibase-fingerprintview-input-help-message": "Enter the label of this 
entity and a short description in $1.",
+       "wikibase-fingerprintgroupview-input-help-message": "Enter a label of 
this entity, a short description and aliases per language.",
+       "wikibase-fingerprintview-input-help-message": "Enter the label of this 
entity, a short description and aliases in $1.",
        "wikibase-claims": "Claims",
        "wikibase-statements": "Statements",
        "wikibase-attributes": "Attributes",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index a0df14f..113e248 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -56,9 +56,10 @@
        "wikibase-sitelink-site-edit-placeholder": "[[File:Screenshot 
WikidataRepo 2012-05-13 E.png|right|0x150px]]\nThis is a generic text used as a 
placeholder while defining the site for a new sitelink. See also Wikidatas 
glossary on [[d:Wikidata:Glossary#sitelink|sitelink]].\n{{Identical|Site}}",
        "wikibase-sitelink-page-edit-placeholder": "[[File:Screenshot 
WikidataRepo 2012-05-13 E.png|right|0x150px]]\nThis is a generic text used as a 
placeholder while defining the page for a possibly new sitelink. See also 
Wikidatas glossary on 
[[d:Wikidata:Glossary#sitelink|sitelink]].\n{{Identical|Page}}",
        "wikibase-alias-edit-placeholder": "This is a generic placeholder 
message used while editing the list of aliases of an item. It is displayed in 
an empty input box which can be used to define a new alias.",
-       "wikibase-label-input-help-message": "[[File:Screenshot WikidataRepo 
2012-05-13 I.png|right|0x150px]]\nBubble help message for entering the label of 
the data set used for a specific item. Takes on additional argument ($1) that 
is the language name, i.e. \"English\" in nominative singular form. See also 
Wikidatas glossary for [[d:Wikidata:Glossary#Label|label]] and 
[[d:Wikidata:Glossary#Item|item]].\n\nParameters:\n* $1 - language 
name\n{{Related|Wikibase-input-help-message}}",
-       "wikibase-description-input-help-message": "[[File:Screenshot 
WikidataRepo 2012-05-13 H.png|right|0x150px]]\nBubble help message for entering 
the description of the data set used for a specific item. Takes on additional 
argument that is the language name, i.e. \"English\" in nominative singular 
form. See also Wikidatas glossary for 
[[d:Wikidata:Glossary#Description|description]] and 
[[d:Wikidata:Glossary#Item|item]].\n\nParameters:\n* $1 - language 
name\n{{Related|Wikibase-input-help-message}}",
-       "wikibase-fingerprintview-input-help-message": "Bubble help message for 
simultaneously editing label, description and aliases of the entity in another 
than the user interface language via the \"In other languages\" box. Takes on 
additional argument that is the language name, i.e. \"English\" in nominative 
singular form. See also Wikidatas glossary for 
[[d:Wikidata:Glossary#Language_attributes|language attributes]] and 
[[d:Wikidata:Glossary#Item|item]].\n\nParameters:\n* $1 - language 
name\n{{Related|Wikibase-input-help-message}}",
+       "wikibase-label-input-help-message": "[[File:Screenshot WikidataRepo 
2012-05-13 I.png|right|0x150px]]\nBubble help message for entering the label of 
the data set used for a specific item. Takes on additional argument ($1) that 
is the language name, i.e. \"English\" in nominative singular form. See also 
Wikidata's glossary for [[d:Wikidata:Glossary#Label|label]] and 
[[d:Wikidata:Glossary#Item|item]].\n\nParameters:\n* $1 - language 
name\n{{Related|Wikibase-input-help-message}}",
+       "wikibase-description-input-help-message": "[[File:Screenshot 
WikidataRepo 2012-05-13 H.png|right|0x150px]]\nBubble help message for entering 
the description of the data set used for a specific item. Takes on additional 
argument that is the language name, i.e. \"English\" in nominative singular 
form. See also Wikidata's glossary for 
[[d:Wikidata:Glossary#Description|description]] and 
[[d:Wikidata:Glossary#Item|item]].\n\nParameters:\n* $1 - language 
name\n{{Related|Wikibase-input-help-message}}",
+       "wikibase-fingerprintgroupview-input-help-message": "Bubble help 
message for simultaneously editing label, description and aliases of the entity 
in multiple languages via the \"In other languages\" box. See also Wikidata's 
glossary for [[d:Wikidata:Glossary#Language_attributes|language attributes]] 
and 
[[d:Wikidata:Glossary#Item|item]].\n\n{{Related|Wikibase-input-help-message}}",
+       "wikibase-fingerprintview-input-help-message": "Bubble help message for 
simultaneously editing label, description and aliases of the entity in another 
than the user interface language via the \"In other languages\" box. Takes on 
additional argument that is the language name, i.e. \"English\" in nominative 
singular form. See also Wikidata's glossary for 
[[d:Wikidata:Glossary#Language_attributes|language attributes]] and 
[[d:Wikidata:Glossary#Item|item]].\n\nParameters:\n* $1 - language 
name\n{{Related|Wikibase-input-help-message}}",
        "wikibase-claims": "Heading for the list of claims giving specific 
information about the currently viewed entity. See also Wikidata's glossary for 
[[m:d:Wikidata:Glossary#Claim|claim]].",
        "wikibase-statements": "Heading for the list of statements giving 
specific information about the currently viewed item. See also Wikidata's 
glossary for [[m:d:Wikidata:Glossary#Statement|statements]] and 
[[m:d:Wikidata:Glossary#Item|item]].",
        "wikibase-attributes": "Heading for the list of claims defining 
attributes for the currently viewed property. See also Wikidata's glossary for 
[[m:d:Wikidata:Glossary#Claims|claims]] and 
[[m:d:Wikidata:Glossary#Property|property]].\n{{Identical|Attribute}}",
diff --git a/repo/includes/View/TermBoxView.php 
b/repo/includes/View/TermBoxView.php
index f093fd8..ac2b95a 100644
--- a/repo/includes/View/TermBoxView.php
+++ b/repo/includes/View/TermBoxView.php
@@ -64,7 +64,6 @@
 
                wfProfileIn( __METHOD__ );
 
-               $entityId = $entity->getId()->getSerialization();
                $fingerprint = $entity->getFingerprint();
                $labels = $fingerprint->getLabels();
                $descriptions = $fingerprint->getDescriptions();
@@ -75,25 +74,6 @@
                foreach ( $languageCodes as $languageCode ) {
                        $hasLabel = $labels->hasTermForLanguage( $languageCode 
);
                        $hasDescription = $descriptions->hasTermForLanguage( 
$languageCode );
-
-                       $editLabelSection = 
$this->sectionEditLinkGenerator->getHtmlForEditSection(
-                               'SetLabel',
-                               array( $entityId, $languageCode ),
-                               $this->msg( 'wikibase-edit' ),
-                               $editable
-                       );
-                       $editDescriptionSection = 
$this->sectionEditLinkGenerator->getHtmlForEditSection(
-                               'SetDescription',
-                               array( $entityId, $languageCode ),
-                               $this->msg( 'wikibase-edit' ),
-                               $editable
-                       );
-                       $editAliasesSection = 
$this->sectionEditLinkGenerator->getHtmlForEditSection(
-                               'SetAliases',
-                               array( $entityId, $languageCode ),
-                               $this->msg( 'wikibase-edit' ),
-                               $editable
-                       );
 
                        $tbody .= wfTemplate( 'wikibase-fingerprintview',
                                $languageCode,
@@ -108,7 +88,6 @@
                                        '',
                                        ''
                                ),
-                               '<td>' . $editLabelSection . '</td>',
                                wfTemplate( 'wikibase-descriptionview',
                                        $hasDescription ? '' : 'wb-empty',
                                        htmlspecialchars( $hasDescription
@@ -118,15 +97,19 @@
                                        '',
                                        ''
                                ),
-                               '<td>' . $editDescriptionSection . '</td>',
-                               $this->getHtmlForAliases( $aliasGroups, 
$languageCode ),
-                               '<td>' . $editAliasesSection . '</td>'
+                               $this->getHtmlForAliases( $aliasGroups, 
$languageCode )
                        );
                }
 
                $html = wfTemplate( 'wikibase-fingerprintgroupview',
                        $this->msg( 'wikibase-terms' ),
-                       wfTemplate( 'wikibase-fingerprintlistview', $tbody )
+                       wfTemplate( 'wikibase-fingerprintlistview', $tbody ),
+                       $this->sectionEditLinkGenerator->getHtmlForEditSection(
+                               'SpecialPages',
+                               array(),
+                               $this->msg( 'wikibase-edit' ),
+                               $editable
+                       )
                );
 
                wfProfileOut( __METHOD__ );
diff --git a/repo/resources/wikibase.ui.entityViewInit.js 
b/repo/resources/wikibase.ui.entityViewInit.js
index e66d367..21b5bd2 100644
--- a/repo/resources/wikibase.ui.entityViewInit.js
+++ b/repo/resources/wikibase.ui.entityViewInit.js
@@ -50,7 +50,7 @@
                                'claimview',
                                'descriptionview',
                                'labelview',
-                               'fingerprintview',
+                               'fingerprintgroupview',
                                'referenceview',
                                'sitelinkview'
                        ],
diff --git a/repo/tests/phpunit/includes/View/TermBoxViewTest.php 
b/repo/tests/phpunit/includes/View/TermBoxViewTest.php
index efddfd7..f460bdc 100644
--- a/repo/tests/phpunit/includes/View/TermBoxViewTest.php
+++ b/repo/tests/phpunit/includes/View/TermBoxViewTest.php
@@ -47,7 +47,6 @@
                $this->assertRegExp( '/Hauptstadt/', $html, 'expected German 
description' );
 
                $this->assertRegExp( '/wikibase-label-empty/', $html, 'expected 
label-empty message for "ru"' );
-               $this->assertRegExp( '!Q23/de!', $html, 'expected edit link for 
Q23/de' );
                $this->assertRegExp( '!<h2 
id="wb-terms".*?>\(wikibase-terms\)</h2>!', $html, 'expected h2 header' );
        }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I19c1bbda6a06b8b2147c266540b63a7f6de195d1
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Tobias Gritschacher <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to