Henning Snater has uploaded a new change for review.
https://gerrit.wikimedia.org/r/173278
Change subject: Rearranged site link views
......................................................................
Rearranged site link views
Intermediate step on the way to implementing the new UI:
- Replaced <table> HTML structure with <ul>
- Language name is not displayed anymore
- Removed pointless message about site links being complete
- Implemented temporary css media query for already displaying the site links
next to the
main entity content if the viewport is wide enough.
Change-Id: I01a663381e4b5f9637bbf28f892e4cf3a1f94582
---
M lib/i18n/en.json
M lib/i18n/qqq.json
M lib/resources/jquery.wikibase/jquery.wikibase.sitelinkgroupview.js
M lib/resources/jquery.wikibase/jquery.wikibase.sitelinklistview.js
M lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
M lib/resources/jquery.wikibase/resources.php
M lib/resources/jquery.wikibase/themes/default/jquery.wikibase.entityview.css
M
lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgrouplistview.css
M
lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
M
lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinklistview.css
M lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkview.css
M lib/resources/jquery/jquery.sticknode.js
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/View/SiteLinksView.php
M repo/resources/templates.php
16 files changed, 94 insertions(+), 398 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/78/173278/1
diff --git a/lib/i18n/en.json b/lib/i18n/en.json
index b6a94ca..24baca4 100644
--- a/lib/i18n/en.json
+++ b/lib/i18n/en.json
@@ -56,8 +56,6 @@
"wikibase-replicationnote": "Please notice that it can take several
minutes until the changes are visible on all wikis.",
"wikibase-sitelinks-wikipedia": "Wikipedia pages linked to this item",
"wikibase-sitelinks-sitename-columnheading": "Language",
- "wikibase-sitelinks-sitename-columnheading-special": "Site",
- "wikibase-sitelinks-siteid-columnheading": "Code",
"wikibase-sitelinks-link-columnheading": "Linked page",
"wikibase-snakview-snaktypeselector-somevalue": "unknown value",
"wikibase-snakview-snaktypeselector-novalue": "no value",
diff --git a/lib/i18n/qqq.json b/lib/i18n/qqq.json
index ed69cf5..d73b044 100644
--- a/lib/i18n/qqq.json
+++ b/lib/i18n/qqq.json
@@ -65,8 +65,6 @@
"wikibase-replicationnote": "Note telling the user that it can take a
few minutes until the made changes are visible on all wikis.\nPreceded by
message {{msg-mw|Wikibase-linkitem-success-link}}",
"wikibase-sitelinks-wikipedia": "[[File:Screenshot WikidataRepo
2012-05-13 A.png|right|0x150px]]\nHeader messages for pages on different
Wikipedias linked to this item. Similar messages can be created for each group
of target sites, depending on configuration.\nSee also Wikidatas glossary for
[[d:Wikidata:Glossary#sitelinks|site links]] and
[[d:Wikidata:Glossary#Item|item]].\n{{Related|Wikibase-sitelinks}}",
"wikibase-sitelinks-sitename-columnheading": "Site links table column
heading for the column containing the language names.\n{{Identical|Language}}",
- "wikibase-sitelinks-sitename-columnheading-special": "Site links table
column heading for the sitename column for special sites such as e.g.
Commons.\n{{Identical|Site}}",
- "wikibase-sitelinks-siteid-columnheading": "Site links table column
heading for the column containing the language codes.\n{{Identical|Code}}",
"wikibase-sitelinks-link-columnheading": "Site links table column
heading for the column containg the title/link of/to the referenced (wiki)
page.\n{{Identical|Linked page}}",
"wikibase-snakview-snaktypeselector-somevalue": "Short descriptive
title of a some-value snak (see [[d:Wikidata:Glossary]]) used in a drop-down
menu allowing to select the snak type when adding or editing a snak. The
drop-down menu can be opened by clicking an anchor right next to the input
element(s) used to specify a claim's value. Although this is regarded a
'special', seldom used feature, the term 'snak' should be avoided here since
the concept of snaks is a technical abstraction that does not give any
additional meaning within the user interface. The basic meaning of this option
is that a value exists but it is unknown.",
"wikibase-snakview-snaktypeselector-novalue": "A short descriptive
title of a no-value snak (see [[d:Wikidata:Glossary]]) used in a drop-down menu
allowing to select the snak type when adding or editing a snak. The drop-down
menu can be opened by clicking an anchor right next to the input element(s)
used to specify a claim's value. Although this is regarded a 'special', seldom
used feature, the term 'snak' should be avoided here since the concept of snaks
is a technical abstraction that does not give any additional meaning within the
user interface. The basic meaning of this option is that no value exists.",
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkgroupview.js
b/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkgroupview.js
index b2e936f..97a62c5 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkgroupview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkgroupview.js
@@ -42,6 +42,7 @@
'' // group
],
templateShortCuts: {
+ '$headingContainer':
'.wikibase-sitelinkgroupview-heading-container',
'$h': 'h2',
'$counter': '.wikibase-sitelinkgroupview-counter'
},
@@ -113,6 +114,12 @@
// .text( mw.msg( 'wikibase-sitelinks-' + this.options.value.group
) )
.text( this.__headingText )
.append( this.$counter );
+
+ if( !this.$headingContainer.data( 'sticknode' ) ) {
+ this.$headingContainer.sticknode( {
+ $container: this.element
+ } );
+ }
if( !this.$sitelinklistview.data( 'sitelinklistview' ) ) {
this._createSitelinklistview();
@@ -366,10 +373,6 @@
sitelinkgroupview.stopEditing( false );
}
} );
-
- $container.sticknode( {
- $container:
sitelinkgroupview.$sitelinklistview.data( 'sitelinklistview' ).$thead
- } );
},
'sitelinkgroupviewchange sitelinkgroupviewafterstartediting':
function( event ) {
var $sitelinkgroupview = $( event.target ),
@@ -432,7 +435,7 @@
$sitelinkview
.removetoolbar( {
- $container: $( '<div/>' ).appendTo(
$sitelinkview.children( 'td' ).last() )
+ $container: $( '<span/>' ).appendTo(
$sitelinkview )
} )
.on( 'removetoolbarremove.removetoolbar',
function( event ) {
if( event.target !== $sitelinkview.get(
0 ) ) {
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.sitelinklistview.js
b/lib/resources/jquery.wikibase/jquery.wikibase.sitelinklistview.js
index b09525e..010500b 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.sitelinklistview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.sitelinklistview.js
@@ -38,19 +38,10 @@
options: {
template: 'wikibase-sitelinklistview',
templateParams: [
- '', // table header
- '', // listview
- function() {
- return mw.wbTemplate(
'wikibase-sitelinklistview-tfoot',
- this.isFull() ? mw.msg(
'wikibase-sitelinksedittool-full' ) : '',
- '' // toolbar
- );
- }
+ '' // listview
],
templateShortCuts: {
- '$thead': 'thead',
- '$listview': 'tbody',
- '$tfoot': 'tfoot'
+ '$listview': 'ul'
},
value: [],
allowedSiteIds: [],
@@ -76,11 +67,6 @@
PARENT.prototype._create.call( this );
- if( this.element.children( 'thead' ).children().length ) {
- // Initially sort on the site id column.
- this.element.tablesorter( { sortList: [{ 1: 'asc' }] }
);
- }
-
this._eventSingletonManager = this.options.eventSingletonManager
|| new $.util.EventSingletonManager();
@@ -91,10 +77,8 @@
* @see jQuery.ui.EditableTemplatedWidget.destroy
*/
destroy: function() {
- this.$thead.data( 'sticknode' ).destroy();
this.$listview.data( 'listview' ).destroy();
this.$listview.off( '.' + this.widgetName );
- this.element.removeData( 'tablesorter' );
this.element.removeClass( 'wikibase-sitelinklistview' );
this._eventSingletonManager.unregister( this, window, '.' +
this.widgetName );
@@ -122,14 +106,6 @@
this.element
.off( event, updateAutoInput )
.on( event, updateAutoInput );
- }
-
- if( !this.$thead.data( 'sticknode' ) ) {
- this.$thead.sticknode( {
- $container: this.element
- } );
-
- this._applyStickiness();
}
return $.Deferred().resolve().promise();
@@ -161,7 +137,7 @@
}
} ),
value: self.options.value || null,
- listItemNodeName: 'TR'
+ listItemNodeName: 'LI'
} )
.on( prefix + 'change.' + this.widgetName, function( event ) {
event.stopPropagation();
@@ -200,54 +176,9 @@
+ ' listviewitemadded.' + this.widgetName,
function( event ) {
self._refreshCounter();
- self._refreshTableHeader();
self._trigger( 'change' );
}
);
- },
-
- _applyStickiness: function() {
- var self = this,
- stickyNode = this.$thead.data( 'sticknode' );
-
- this.$thead.on( 'sticknodeupdate', function() {
- if( !stickyNode.isFixed() ) {
- return;
- }
-
- var $firstBodyTrTds = self.$listview.find( 'tr:first
td' );
-
- if( !$firstBodyTrTds.length ) {
- return;
- }
-
- self.$thead.find( 'th' ).each( function( i ) {
- var $th = $( this );
-
- if( !self.isInEditMode() ) {
- $th.removeAttr( 'style' );
- }
-
- if( i === 2 && !self.isInEditMode() ) {
- return;
- }
-
- var width = $firstBodyTrTds.eq( i ).width();
-
- // Translate border width and padding added by
tablesorter:
- if( i === 0 ) {
- width -= 10;
- } else if( i === 3 ) {
- width += 1;
- } else {
- width -= 11;
- }
-
- $th.width( width );
- } );
-
- self.$thead.width( self.element.width() );
- } );
},
/**
@@ -455,8 +386,6 @@
*/
startEditing: function() {
var self = this;
-
- this._refreshTablesorter();
this._eventSingletonManager.register(
this,
@@ -768,7 +697,6 @@
if( key === 'value' ) {
this.$listview.data( 'listview' ).value( value );
this._refreshCounter();
- this._refreshTableHeader();
} else if( key === 'disabled' ) {
this.$listview.data( 'listview' ).option( key, value );
}
@@ -841,11 +769,6 @@
}
this._refreshCounter();
- this._refreshTableHeader();
-
- if( !this.isFull() ) {
- this.$tfoot.find( 'tr td' ).first().text( '' );
- }
},
/**
@@ -869,24 +792,17 @@
if( !dropValue && siteLink ) {
listview.addItem( siteLink );
-
- if( self.isFull() ) {
- self.$tfoot.find( 'tr td'
).first()
- .text( mw.msg(
'wikibase-sitelinksedittool-full' ) );
- }
}
if( self.__pendingItems &&
--self.__pendingItems !== 0 ) {
return;
}
- self._refreshTableHeader();
self._refreshCounter();
self._trigger( 'afterstopediting', null,
[dropValue] );
} );
- self._refreshTableHeader();
self._refreshCounter();
if( !self.isInEditMode() ) {
@@ -899,52 +815,7 @@
listview.enterNewItem();
this.__pendingItems = this.__pendingItems ? this.__pendingItems
+ 1 : 1;
- },
-
- _refreshTablesorter: function() {
- if( this.isInEditMode() ) {
- // Re-sorting the table involves reconstructing the
table's DOM. This may lead to
- // interference with focusing (IE, though it does not
lose focus, is unable to reflect
- // character input into the input box).
- return;
- }
-
- this.element.removeData( 'tablesorter' );
-
- if( this.$thead.children().length ) {
- this.element.tablesorter();
- this.element.data( 'tablesorter' ).sort( [] );
- }
- },
-
- _refreshTableHeader: function() {
- var $items = this.$listview.data( 'listview' ).items();
-
- if( !$items.length ) {
- this.$thead.empty();
- return;
- } else if( this.$thead.children().length ) {
- this._refreshTablesorter();
- return;
- }
-
- var siteNameMessageKey =
'wikibase-sitelinks-sitename-columnheading';
-
- // FIXME: quickfix to allow a custom site-name / handling for
the site groups which
- // are special according to the specialSiteLinkGroups setting
- if( this.element.data( 'wikibase-sitelinks-group' ) ===
'special' ) {
- siteNameMessageKey += '-special';
- }
-
- this.$thead.append( mw.wbTemplate(
'wikibase-sitelinklistview-thead',
- mw.message( siteNameMessageKey ).text(),
- mw.message( 'wikibase-sitelinks-siteid-columnheading'
).text(),
- mw.message( 'wikibase-sitelinks-link-columnheading'
).text()
- ) );
-
- this._refreshTablesorter();
}
-
} );
/**
diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
b/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
index a79e6c1..7ad34ee 100644
--- a/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
+++ b/lib/resources/jquery.wikibase/jquery.wikibase.sitelinkview.js
@@ -65,17 +65,15 @@
},
function() {
var site = this._getSite();
- return site ? site.getShortName() : '';
+ return site ? site.getId() : '';
},
function() {
var site = this._getSite();
- return site ? site.getId() : '';
+ return site ? site.getShortName() : '';
},
- '', // page name
- '' // toolbar
+ '' // page name
],
templateShortCuts: {
- '$siteName': '.wikibase-sitelinkview-sitename',
'$siteId' : '.wikibase-sitelinkview-siteid',
'$link': '.wikibase-sitelinkview-link'
},
@@ -266,11 +264,7 @@
self._trigger( 'change' );
} );
- this.$siteName.remove();
-
- this.$siteId
- .attr( 'colspan', '2' )
- .append( $siteIdInput );
+ this.$siteId.append( $siteIdInput );
$pageNameInput
.on( 'keydown.' + this.widgetName, function( event ) {
diff --git a/lib/resources/jquery.wikibase/resources.php
b/lib/resources/jquery.wikibase/resources.php
index 3d9c344..f7e99bd 100644
--- a/lib/resources/jquery.wikibase/resources.php
+++ b/lib/resources/jquery.wikibase/resources.php
@@ -351,7 +351,6 @@
),
'dependencies' => array(
'jquery.event.special.eachchange',
- 'jquery.sticknode',
'jquery.tablesorter',
'jquery.ui.EditableTemplatedWidget',
'jquery.util.EventSingletonManager',
@@ -373,11 +372,6 @@
'wikibase-propertyedittool-counter-pending-tooltip',
'wikibase-sitelink-site-edit-placeholder',
'wikibase-sitelink-page-edit-placeholder',
- 'wikibase-sitelinks-sitename-columnheading',
-
'wikibase-sitelinks-sitename-columnheading-special',
- 'wikibase-sitelinks-siteid-columnheading',
- 'wikibase-sitelinks-link-columnheading',
- 'wikibase-sitelinksedittool-full',
),
),
diff --git
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.entityview.css
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.entityview.css
index 680c274..9a44b8f 100644
---
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.entityview.css
+++
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.entityview.css
@@ -14,5 +14,5 @@
}
.wikibase-entityview .wikibase-entityview-main {
- margin-right: 2em;
+ margin: 0 2em 2em 0;
}
diff --git
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgrouplistview.css
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgrouplistview.css
index 0adbe1d..63843e1 100644
---
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgrouplistview.css
+++
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgrouplistview.css
@@ -4,5 +4,11 @@
*/
.wikibase-sitelinkgrouplistview {
float: left;
- width: 100%;
+ width: 65em;
+}
+
+@media screen and ( min-width: 1570px ) {
+ .wikibase-sitelinkgrouplistview {
+ width: 26em;
+ }
}
diff --git
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
index 589cb5f..74c2219 100644
---
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
+++
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkgroupview.css
@@ -3,23 +3,41 @@
* @author H. Snater < [email protected] >
*/
.wikibase-sitelinkgroupview {
+ border: 1px solid #C9C9C9;
float: left;
- width: 100%;
+ margin: 0 2em 2em 0;
+ width: 30em;
}
-.wikibase-sitelinkgroupview h2 {
- width: auto;
+@media screen and ( min-width: 1570px ) {
+ .wikibase-sitelinkgroupview {
+ margin-right: 0;
+ width: 100%
+ }
+}
+
+.wikibase-sitelinkgroupview.wb-edit {
+ background-color: #D6F3FF;
}
.wikibase-sitelinkgroupview .wikibase-sitelinkgroupview-heading-container {
- position: relative;
+ background-color: #FFFFFF;
+ display: table-row;
}
-.wikibase-sitelinkgroupview .wikibase-toolbar-container
.wikibase-toolbar-container {
- position: static;
+.wikibase-sitelinkgroupview.wb-edit
.wikibase-sitelinkgroupview-heading-container {
+ background-color: #D6F3FF;
+}
+
+.wikibase-sitelinkgroupview h2 {
+ display: table-cell;
+ float: none;
+ width: auto;
}
.wikibase-sitelinkgroupview .wikibase-sitelinkgroupview-heading-container >
.wikibase-toolbar-container {
- margin-top: 1.9em;
- z-index: 1;
+ display: table-cell;
+ position: static;
+ padding-left: 0.5em;
+ width: auto;
}
diff --git
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinklistview.css
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinklistview.css
index b277001..2666a84 100644
---
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinklistview.css
+++
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinklistview.css
@@ -3,110 +3,30 @@
* @author H. Snater < [email protected] >
*/
-.wikibase-sitelinklistview {
- border-spacing: 0;
- width: 100%;
- border-bottom: 1px solid #C9C9C9;
+.wikibase-sitelinklistview .wikibase-sitelinklistview-listview {
+ list-style: outside none none;
+ margin: 0 0 0 10px;
clear: both;
}
-.wikibase-sitelinklistview th {
- background-color: #C9C9C9;
- text-align: left;
+.wikibase-sitelinklistview .wikibase-sitelinklistview-listview > * {
+ margin: 3px 0;
}
-.wikibase-sitelinklistview td {
- height: 2.2em;
- border-top: 1px solid #C9C9C9;
-}
-
-.wikibase-sitelinklistview .wikibase-sitelinkview-sitename {
- width: 25%;
- word-wrap: break-word;
- padding-left: 10px;
- padding-right: 10px;
- border-left: 1px solid #C9C9C9;
-}
-
-.wikibase-sitelinklistview .wikibase-sitelinkview-siteid {
- width: 10%;
- padding: 0 10px;
+.wikibase-sitelinklistview .wikibase-sitelinklistview-listview
.wikibase-sitelinkview-siteid {
+ background-color: #F0F0F0;
+ padding: 0.2em 0.4em;
white-space: nowrap;
}
-.wikibase-sitelinklistview .wikibase-sitelinkview-link {
- width: 65%;
+.wikibase-sitelinklistview .wikibase-sitelinklistview-listview
.wikibase-sitelinkview-link {
+ display: inline-block;
+ margin-left: 0.2em;
+ white-space: nowrap;
word-wrap: break-word;
- padding-left: 10px;
- padding-right: 16px;
}
-.wikibase-sitelinklistview .wikibase-sitelinkview-badges {
- display: table-cell;
-}
-
-.wikibase-sitelinklistview .wikibase-sitelinkview-page {
- display: table-cell;
- width: 100%;
-}
-
-.wikibase-sitelinklistview tbody td {
- background: #F0F0F0;
-}
-.wikibase-sitelinklistview tbody tr:nth-child(even) td {
- background: #F8F8F8;
-}
-.wikibase-sitelinklistview tbody td.wikibase-sitelinkview-siteid {
- background: #E8E8E8;
-}
-.wikibase-sitelinklistview tbody tr:nth-child(even)
td.wikibase-sitelinkview-siteid {
- background: #F0F0F0;
-}
-
-.wikibase-sitelinklistview td:last-child {
- border-right: 1px solid #C9C9C9;
- padding-right: 0;
- height: 32px;
- display: table-cell;
- float: none;
-}
-
-.wikibase-sitelinklistview .wikibase-toolbar-container {
- float: right;
+.wikibase-sitelinklistview .wikibase-sitelinklistview-listview
.wikibase-toolbar-container {
+ padding-left: 0.5em;
position: static;
}
-
-.wikibase-sitelinklistview tfoot td.wikibase-sitelinklistview-placeholder {
- padding-left: 10px;
- padding-right: 10px;
- border-left: 1px solid #C9C9C9;
-}
-
-.wikibase-sitelinklistview .wikibase-sitelinkview.wb-edit td {
- background-color: #D6F3FF; /* hihglight color when editing */
-}
-.wikibase-sitelinklistview .wikibase-sitelinkview.wb-edit
td.wikibase-sitelinkview-siteid {
- background-color: #D0EBF7;
-}
-
-.wikibase-sitelinklistview .wikibase-sitelinkview.wb-edit.wb-error td {
- background-color: #FFDFC9;
-}
-
-.wikibase-sitelinklistview .wikibase-toolbar {
- float: none; /* prevent white space jittering */
-}
-
-.wikibase-sitelinklistview .wikibase-sitelinkview.wb-edit
.wikibase-sitelinkview-sitename {
- white-space: normal;
-}
-
-.wikibase-sitelinklistview .wikibase-sitelinkview.wb-edit
.wikibase-sitelinkview-link {
- padding-left: 7px;
-}
-@-moz-document url-prefix() { /* Firefox */
- .wikibase-sitelinklistview .wikibase-sitelinkview.wb-edit
.wikibase-sitelinkview-link {
- padding-left: 6px;
- }
-}
-
diff --git
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkview.css
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkview.css
index 118904a..d918b45 100644
---
a/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkview.css
+++
b/lib/resources/jquery.wikibase/themes/default/jquery.wikibase.sitelinkview.css
@@ -31,7 +31,6 @@
margin: 0;
font-family: inherit;
font-size: 1em; /* prevent font size rounding errors */
- width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
diff --git a/lib/resources/jquery/jquery.sticknode.js
b/lib/resources/jquery/jquery.sticknode.js
index 4650ac4..5265f4b 100644
--- a/lib/resources/jquery/jquery.sticknode.js
+++ b/lib/resources/jquery/jquery.sticknode.js
@@ -172,12 +172,14 @@
offset: this.$node.offset(),
position: this.$node.css( 'position' ),
top: this.$node.css( 'top' ),
- left: this.$node.css( 'left' )
+ left: this.$node.css( 'left' ),
+ width: this.$node.css( 'width' )
};
this.$node
.css( 'left', this._initialAttributes.offset.left + 'px' )
.css( 'top', this.$node.outerHeight() - this.$node.outerHeight(
true ) )
+ .css( 'width', this.$node.width() )
.css( 'position', 'fixed' );
},
@@ -185,6 +187,7 @@
this.$node
.css( 'left', this._initialAttributes.left )
.css( 'top', this._initialAttributes.top )
+ .css( 'width', this._initialAttributes.width )
.css( 'position', this._initialAttributes.position );
this._initialAttributes.offset = null;
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 670ec77..bb8e80e 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -62,7 +62,6 @@
"wikibase-ui-pendingquantitycounter-pending-pendingsubpart": "+$1",
"wikibase-propertyedittool-counter-pending-tooltip": "{{PLURAL:$1|One
value|$1 values}} not saved yet",
"wikibase-propertyedittool-counter-entrieslabel":
"{{PLURAL:$1|entry|entries}}",
- "wikibase-sitelinksedittool-full": "Links to pages are already set for
all known sites.",
"wikibase-disambiguation-title": "Disambiguation for \"$1\"",
"wb-special-newitem-new-item-notification": "New item $1 created and
redirected to its page. Back to $2.",
"wikibase-aliases-label": "Also known as:",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index 1a8f8cd..d6428ba 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -88,7 +88,6 @@
"wikibase-ui-pendingquantitycounter-pending-pendingsubpart":
"{{optional}}\nThe pending quantity of a counter and a leading '+'.\n\nThe
pending quantity of a counter can for example be the number of site-links in an
item's site-links table which are not yet saved.\n\nUsed as <code>$3</code> in
{{msg-mw|Wikibase-ui-pendingquantitycounter-pending}}.",
"wikibase-propertyedittool-counter-pending-tooltip": "Parameters:\n* $1
is the number of elements not saved yet.",
"wikibase-propertyedittool-counter-entrieslabel": "Used in the counter
on top of the site-links table.\n\nThe counter is giving information about how
many site-links exist in the following table.\n\nThis is just the label for the
counter's subject, the site-links.\n\nParameters:\n* $1 - the number of
site-links (for PLURAL), not part of the message\n\nSee also:\n*
{{msg-mw|Wikibase-ui-pendingquantitycounter-nonpending}}\n{{Identical|Entry}}",
- "wikibase-sitelinksedittool-full": "The list of elements the user can
enter is exhausted and there are no additional sites available. See also
Wikidatas glossary for [[d:Wikidata:Glossary#sitelinks|sitelinks]].",
"wikibase-disambiguation-title": "Disambiguation page title.
Parameters:\n* $1 - the label of the item being disambiguated",
"wb-special-newitem-new-item-notification": "Message displayed when a
new item was created on [[d:Special:NewItem]] and the user has been redirected
to the new items page.\n\nParameters:\n* $1 - the new items id\n* $2 - a link
back to the special page with \"special-newitem\" as label",
"wikibase-aliases-label": "Label for list of aliases, displayed in
front of the list. Aliases are alternate names and nicknames for the item. See
also [[d:Wikidata:Glossary]].",
diff --git a/repo/includes/View/SiteLinksView.php
b/repo/includes/View/SiteLinksView.php
index 0e9722a..5277acf 100644
--- a/repo/includes/View/SiteLinksView.php
+++ b/repo/includes/View/SiteLinksView.php
@@ -114,39 +114,16 @@
* @return string
*/
private function getHtmlForSiteLinkGroup( array $siteLinks, $itemId,
$group, $editable ) {
- $isSpecialGroup = $group === 'special';
-
- $sites = $this->getSitesForGroup( $group );
- $siteLinksForTable = $this->getSiteLinksForTable( $sites,
$siteLinks );
-
- $html = $thead = $tbody = $tfoot = '';
-
- if ( !empty( $siteLinksForTable ) ) {
- $thead = $this->getTableHeadHtml( $isSpecialGroup );
- $tbody = $this->getTableBodyHtml(
- $siteLinksForTable,
- $itemId,
- $isSpecialGroup,
- $editable
- );
- }
-
- // Build table footer with button to add site-links, consider
list could be complete!
- // The list is complete if it has a site link for every known
site. Since
- // $siteLinksForTable only has an entry for links to existing
sites, this
- // simple comparison works.
- $isFull = count( $siteLinksForTable ) >= count( $sites );
- $tfoot = $this->getTableFootHtml( $isFull );
-
- return $html . wfTemplate( 'wikibase-sitelinkgroupview',
+ return wfTemplate( 'wikibase-sitelinkgroupview',
// TODO: support entity-id as prefix for element IDs.
htmlspecialchars( 'sitelinks-' . $group, ENT_QUOTES ),
wfMessage( 'wikibase-sitelinks-' . $group )->parse(),
'', // counter
wfTemplate( 'wikibase-sitelinklistview',
- $thead,
- $tbody,
- $tfoot
+ $this->getHtmlForSiteLinks(
+ $this->getSiteLinksForTable(
$this->getSitesForGroup( $group ), $siteLinks ),
+ $group === 'special'
+ )
),
htmlspecialchars( $group ),
$this->getHtmlForEditSection( $itemId, '', 'edit',
$editable )
@@ -220,70 +197,28 @@
}
/**
+ * @param array[] $siteLinksForTable
* @param bool $isSpecialGroup
*
* @return string
*/
- private function getTableHeadHtml( $isSpecialGroup ) {
- // FIXME: quickfix to allow a custom site-name / handling for
the site groups which are
- // special according to the specialSiteLinkGroups setting
- $siteNameMessageKey =
'wikibase-sitelinks-sitename-columnheading';
- if ( $isSpecialGroup ) {
- $siteNameMessageKey .= '-special';
- }
-
- $thead = wfTemplate( 'wikibase-sitelinklistview-thead',
- wfMessage( $siteNameMessageKey )->parse(),
- wfMessage( 'wikibase-sitelinks-siteid-columnheading'
)->parse(),
- wfMessage( 'wikibase-sitelinks-link-columnheading'
)->parse()
- );
-
- return $thead;
- }
-
- /**
- * @param object[] $siteLinksForTable
- * @param ItemId|null $itemId
- * @param bool $isSpecialGroup
- *
- * @return string
- */
- private function getTableBodyHtml( $siteLinksForTable, $itemId,
$isSpecialGroup ) {
- $tbody = '';
+ private function getHtmlForSiteLinks( $siteLinksForTable,
$isSpecialGroup ) {
+ $html = '';
foreach ( $siteLinksForTable as $siteLinkForTable ) {
- $tbody .= $this->getHtmlForSiteLink(
- $siteLinkForTable,
- $itemId,
- $isSpecialGroup
- );
+ $html .= $this->getHtmlForSiteLink( $siteLinkForTable );
}
- return $tbody;
- }
-
- /**
- * @param bool $isFull
- *
- * @return string
- */
- private function getTableFootHtml( $isFull ) {
- $tfoot = wfTemplate( 'wikibase-sitelinklistview-tfoot',
- $isFull ? wfMessage( 'wikibase-sitelinksedittool-full'
)->parse() : '',
- ''
- );
-
- return $tfoot;
+ return $html;
}
/**
* @param object $siteLinkForTable
- * @param ItemId|null $itemId The id of the item
* @param bool $isSpecialGroup
*
* @return string
*/
- private function getHtmlForSiteLink( $siteLinkForTable, $itemId,
$isSpecialGroup ) {
+ private function getHtmlForSiteLink( $siteLinkForTable, $isSpecialGroup
) {
/** @var Site $site */
$site = $siteLinkForTable['site'];
@@ -291,7 +226,7 @@
$siteLink = $siteLinkForTable['siteLink'];
if ( $site->getDomain() === '' ) {
- return $this->getHtmlForUnknownSiteLink( $siteLink,
$itemId );
+ return $this->getHtmlForUnknownSiteLink( $siteLink );
}
$languageCode = $site->getLanguageCode();
@@ -315,8 +250,8 @@
htmlspecialchars( $siteId ), // ID used in classes
$languageCode,
'auto',
- $siteName,
htmlspecialchars( $siteId ), // displayed site ID
+ $siteName,
$this->getHtmlForPage( $siteLink, $site )
);
}
@@ -340,19 +275,14 @@
/**
* @param SiteLink $siteLink
- * @param ItemId|null $itemId The id of the item
*
* @return string
*/
- private function getHtmlForUnknownSiteLink( $siteLink, $itemId ) {
- $siteId = $siteLink->getSiteId();
- $pageName = $siteLink->getPageName();
-
+ private function getHtmlForUnknownSiteLink( $siteLink ) {
// FIXME: No need for separate template; Use
'wikibase-sitelinkview' template.
return wfTemplate( 'wikibase-sitelinkview-unknown',
- htmlspecialchars( $siteId ),
- htmlspecialchars( $pageName ),
- $this->getHtmlForEditSection( $itemId, $siteId )
+ htmlspecialchars( $siteLink->getSiteId() ),
+ htmlspecialchars( $siteLink->getPageName() )
);
}
diff --git a/repo/resources/templates.php b/repo/resources/templates.php
index 5356bf0..0caa64d 100644
--- a/repo/resources/templates.php
+++ b/repo/resources/templates.php
@@ -266,51 +266,17 @@
$templates['wikibase-sitelinklistview'] =
<<<HTML
-<table class="wikibase-sitelinklistview">
- <colgroup>
- <col class="wikibase-sitelinklistview-sitename" />
- <col class="wikibase-sitelinklistview-siteid" />
- <col class="wikibase-sitelinklistview-link" />
- <col/>
- </colgroup>
- <thead>
- <!-- wikibase-sitelinklist-thead -->$1
- </thead>
- <tbody>
- <!-- [0,*] wikibase-sitelinkview -->$2
- </tbody>
- <tfoot>
- <!-- wikibase-sitelinklistview-tfoot -->$3
- </tfoot>
-</table>
-HTML;
-
- $templates['wikibase-sitelinklistview-thead'] =
-<<<HTML
-<tr class="wikibase-sitelinklistview-columnheaders">
- <th class="wikibase-sitelinkview-sitename">$1</th>
- <th class="wikibase-sitelinkview-siteid">$2</th>
- <th class="wikibase-sitelinkview-link">$3</th>
- <th class="unsortable"></th>
-</tr>
-HTML;
-
- $templates['wikibase-sitelinklistview-tfoot'] =
-<<<HTML
-<tr>
- <td colspan="3" class="wikibase-sitelinklistview-placeholder">$1</td>
- <td><!-- wikibase-toolbar -->$2</td>
-</tr>
+<div class="wikibase-sitelinklistview">
+ <ul class="wikibase-sitelinklistview-listview"><!-- [0,*]
wikibase-sitelinkview -->$1</ul>
+</div>
HTML;
$templates['wikibase-sitelinkview'] =
<<<HTML
-<tr class="wikibase-sitelinkview wikibase-sitelinkview-$1" data-wb-siteid="$1">
- <td class="wikibase-sitelinkview-sitename
wikibase-sitelinkview-sitename-$1" lang="$2" dir="$3">$4</td>
- <td class="wikibase-sitelinkview-siteid
wikibase-sitelinkview-siteid-$1">$5</td>
- <td class="wikibase-sitelinkview-link wikibase-sitelinkview-link-$1"
lang="$2" dir="$3"><!-- wikibase-sitelinkview-pagename -->$6</td>
- <td><!-- placeholder for remove toolbar dynamically generated in edit
mode --></td>
-</tr>
+<li class="wikibase-sitelinkview wikibase-sitelinkview-$1" data-wb-siteid="$1">
+ <span class="wikibase-sitelinkview-siteid
wikibase-sitelinkview-siteid-$1" title="$5">$4</span>
+ <span class="wikibase-sitelinkview-link wikibase-sitelinkview-link-$1"
lang="$2" dir="$3"><!-- wikibase-sitelinkview-pagename -->$6</span>
+</li>
HTML;
$templates['wikibase-sitelinkview-pagename'] =
@@ -320,12 +286,10 @@
$templates['wikibase-sitelinkview-unknown'] =
<<<HTML
-<tr class="wikibase-sitelinkview-site-unknown">
- <td class="wikibase-sitelinkview-sitename
wikibase-sitelinkview-sitename-unknown"></td>
- <td class="wikibase-sitelinkview-siteid
wikibase-sitelinkview-siteid-unknown">$2</td>
- <td class="wikibase-sitelinkview-link
wikibase-sitelinkview-link-unknown">$3</td>
- <td><!-- placeholder for remove toolbar dynamically generated in edit
mode --></td>
-</tr>
+<li class="wikibase-sitelinkview-site-unknown">
+ <span class="wikibase-sitelinkview-siteid
wikibase-sitelinkview-siteid-unknown">$1</span>
+ <span class="wikibase-sitelinkview-link
wikibase-sitelinkview-link-unknown">$2</span>
+</li>
HTML;
$templates['wb-badge'] =
--
To view, visit https://gerrit.wikimedia.org/r/173278
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I01a663381e4b5f9637bbf28f892e4cf3a1f94582
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Henning Snater <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits