Aude has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/123576

Change subject: Revert "(bug 63068) Show claims on property pages"
......................................................................

Revert "(bug 63068) Show claims on property pages"

not ready to deploy

This reverts commit 353f01e6992f90e63d00ea44ca7ebc8146cde108.

Change-Id: I5bbbd386923fc6534fc399b93dd64396d05057e8
---
M lib/resources/templates.php
M lib/resources/wikibase.css
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/EntityView.php
M repo/includes/ItemView.php
M repo/includes/PropertyView.php
7 files changed, 61 insertions(+), 127 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/76/123576/1

diff --git a/lib/resources/templates.php b/lib/resources/templates.php
index 4b977b4..d8f49e4 100644
--- a/lib/resources/templates.php
+++ b/lib/resources/templates.php
@@ -26,9 +26,15 @@
 HTML;
 
 
-       $templates['wb-entity-header-separator'] =
+       $templates['wb-entity-content'] =
 <<<HTML
+$1 <!-- label -->
+$2 <!-- description -->
 <hr class="wb-hr" />
+$3 <!-- aliases -->
+$4 <!-- table of contents -->
+$5 <!-- terms -->
+$6 <!-- claims -->
 HTML;
 
        $templates['wb-entity-toc'] =
@@ -340,7 +346,7 @@
 <<<HTML
 <div class="wb-datatype wb-value-row">
        <span class="wb-datatype-label">$1</span>
-       <span class="wb-datatype-value">$2</span>
+       <span class="wb-value">$2</span>
 </div>
 HTML;
 
diff --git a/lib/resources/wikibase.css b/lib/resources/wikibase.css
index 132cd18..c148c50 100644
--- a/lib/resources/wikibase.css
+++ b/lib/resources/wikibase.css
@@ -1014,19 +1014,12 @@
        float: left;
        clear: both;
        margin-left: 10px;
-       margin-bottom: 0.2em;
-       margin-top: 0.5em;
+       margin-top: 2em;
 }
 
-.wb-propertypage .wb-datatype-label {
-       float: left;
-       font-weight: bold;
-       margin-right: 1ex;
-}
-
-.wb-propertypage .wb-datatype-value {
-       float: left;
-       font-weight: normal;
+.wb-propertypage .wb-datatype span {
+       display: inline;
+       margin-right: .3em;
 }
 
 /********** /PROPERTY PAGE **********/
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index bb4d035..17ad99d 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -32,9 +32,7 @@
     "wikibase-alias-edit-placeholder": "enter an alias",
     "wikibase-label-input-help-message": "Enter the title of this data set in 
$1.",
     "wikibase-description-input-help-message": "Enter a short description in 
$1.",
-    "wikibase-claims": "Claims",
     "wikibase-statements": "Statements",
-    "wikibase-constraints": "Constraints",
     "wikibase-terms": "In other languages",
     "wikibase-sitelinks-add": "add a link to a site-link",
     "wikibase-sitelinks-empty": "No site-link for this item yet.",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index c6f3569..434f97d 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -53,9 +53,7 @@
     "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 sub site identifier, i.e. \"English\" in nominative singular form. See 
also Wikidatas glossary for 
[[d:Wikidata:Glossary#languageattribute-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 sub site identifier, ie. \"English\" in nominative 
singular form. See also Wikidatas glossary for 
[[d:Wikidata:Glossary#languageattribute-description|description]] 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-constraints": "Heading for the list of claims defining 
constraints for the currently viewed property. See also Wikidata's glossary for 
[[m:d:Wikidata:Glossary#Claims|claims]] and 
[[m:d:Wikidata:Glossary#Property|property]].",
     "wikibase-terms": "Heading for the table with the labels and descriptions 
in other languages.\n{{Identical|Otherlanguages}}",
     "wikibase-sitelinks-add": "Add a sitelink to a language specific page on 
the cluster. See also Wikidata's glossary for 
[[d:Wikidata:Glossary#Sitelink|sitelinks]].",
     "wikibase-sitelinks-empty": "There are no site links for any of the 
language specific pages on the given cluster.  See also Wikidatas glossary for 
[[d:Wikidata:Glossary#sitelinks|sitelinks]] and 
[[d:Wikidata:Glossary#sitelinks-title|title]].",
diff --git a/repo/includes/EntityView.php b/repo/includes/EntityView.php
index 53424b4..343b9ec 100644
--- a/repo/includes/EntityView.php
+++ b/repo/includes/EntityView.php
@@ -220,19 +220,32 @@
        public function getInnerHtml( EntityRevision $entityRevision, $editable 
= true ) {
                wfProfileIn( __METHOD__ );
 
-               $entity = $entityRevision->getEntity();
+               $claims = '';
 
-               $html = '';
+               if ( $entityRevision->getEntity()->getType() === 'item' ) {
+                       $claims = $this->getHtmlForClaims( 
$entityRevision->getEntity(), $editable );
+               }
 
-               $html .= $this->getHtmlForLabel( $entity, $editable );
-               $html .= $this->getHtmlForDescription( $entity, $editable );
+               if ( $entityRevision->getEntity()->getId() ) {
+                       // Placeholder for a termbox for the present item.
+                       // EntityViewPlaceholderExpander must know about the 
parameters used here.
+                       $languageTerms = $this->textInjector->newMarker(
+                               'termbox',
+                               
$entityRevision->getEntity()->getId()->getSerialization()
+                       );
+               } else {
+                       //NOTE: this should only happen during testing
+                       $languageTerms = '';
+               }
 
-               $html .= wfTemplate( 'wb-entity-header-separator' );
-
-               $html .= $this->getHtmlForAliases( $entity, $editable );
-               $html .= $this->getHtmlForToc();
-               $html .= $this->getHtmlForTermBox( $entity, $editable );
-               $html .= $this->getHtmlForClaims( $entity, $editable );
+               $html = wfTemplate( 'wb-entity-content',
+                       $this->getHtmlForLabel( $entityRevision->getEntity(), 
$editable ),
+                       $this->getHtmlForDescription( 
$entityRevision->getEntity(), $editable ),
+                       $this->getHtmlForAliases( $entityRevision->getEntity(), 
$editable ),
+                       $this->getHtmlForToc(),
+                       $languageTerms,
+                       $claims
+               );
 
                wfProfileOut( __METHOD__ );
                return $html;
@@ -283,25 +296,6 @@
         */
        protected function getTocSections() {
                return array();
-       }
-
-       /**
-        * @param Entity $entity
-        * @param bool $editable
-        *
-        * @return string
-        */
-       protected function getHtmlForTermBox( Entity $entity, $editable = true 
) {
-               if ( $entity->getId() ) {
-                       // Placeholder for a termbox for the present item.
-                       // EntityViewPlaceholderExpander must know about the 
parameters used here.
-                       return $this->textInjector->newMarker(
-                               'termbox',
-                               $entity->getId()->getSerialization()
-                       );
-               }
-
-               return '';
        }
 
        /**
@@ -482,26 +476,6 @@
        }
 
        /**
-        * Returns the HTML for the heading of the claims section
-        *
-        * @since 0.5
-        *
-        * @param Entity $entity
-        * @param bool $editable
-        *
-        * @return string
-        */
-       protected function getHtmlForClaimsSectionHeading( Entity $entity, 
$editable = true ) {
-               $html = wfTemplate(
-                       'wb-section-heading',
-                       wfMessage( 'wikibase-claims' ),
-                       'claims' // ID - TODO: should not be added if output 
page is not the entity's page
-               );
-
-               return $html;
-       }
-
-       /**
         * Builds and returns the HTML representing a WikibaseEntity's claims.
         *
         * @since 0.2
@@ -514,8 +488,13 @@
                wfProfileIn( __METHOD__ );
 
                $claims = $entity->getClaims();
+               $html = '';
 
-               $html = $this->getHtmlForClaimsSectionHeading( $entity, 
$editable );
+               $html .= wfTemplate(
+                       'wb-section-heading',
+                       wfMessage( 'wikibase-statements' ),
+                       'claims' // ID - TODO: should not be added if output 
page is not the entity's page
+               );
 
                // aggregate claims by properties
                $claimsByProperty = array();
diff --git a/repo/includes/ItemView.php b/repo/includes/ItemView.php
index 3d9ed9c..75a33f1 100644
--- a/repo/includes/ItemView.php
+++ b/repo/includes/ItemView.php
@@ -30,26 +30,6 @@
        }
 
        /**
-        * Returns the HTML for the heading of the claims section
-        *
-        * @since 0.5
-        *
-        * @param Entity $entity
-        * @param bool $editable
-        *
-        * @return string
-        */
-       protected function getHtmlForClaimsSectionHeading( Entity $entity, 
$editable = true ) {
-               $html = wfTemplate(
-                       'wb-section-heading',
-                       wfMessage( 'wikibase-statements' ),
-                       'claims' // ID - TODO: should not be added if output 
page is not the entity's page
-               );
-
-               return $html;
-       }
-
-       /**
         * @see EntityView::getTocSections
         */
        protected function getTocSections() {
diff --git a/repo/includes/PropertyView.php b/repo/includes/PropertyView.php
index 2f86870..1019088 100644
--- a/repo/includes/PropertyView.php
+++ b/repo/includes/PropertyView.php
@@ -18,66 +18,46 @@
 class PropertyView extends EntityView {
 
        /**
-        * Builds and returns the inner HTML for representing a whole 
WikibaseEntity. The difference to getHtml() is that
-        * this does not group all the HTMl within one parent node as one 
entity.
+        * @see EntityView::getInnerHtml
         *
-        * @string
-        *
-        * @param EntityRevision $entityRevision
+        * @param EntityRevision $propertyRevision
         * @param bool $editable
         *
         * @throws \InvalidArgumentException
         * @return string
         */
-       public function getInnerHtml( EntityRevision $entityRevision, $editable 
= true ) {
+       public function getInnerHtml( EntityRevision $propertyRevision, 
$editable = true ) {
                wfProfileIn( __METHOD__ );
 
-               /* @var Property $property */
-               $property = $entityRevision->getEntity();
+               $property = $propertyRevision->getEntity();
 
                if ( !( $property instanceof Property ) ) {
                        throw new \InvalidArgumentException( '$propertyRevision 
must contain a Property' );
                }
 
+               /* @var Property $property */
+
+               $html = parent::getInnerHtml( $propertyRevision, $editable );
+
+               $html .= $this->getHtmlForDataType(
+                       $this->getDataType( $property ),
+                       $editable
+               );
+
+               $html .= $this->getFooterHtml();
+
+               wfProfileOut( __METHOD__ );
+               return $html;
+       }
+
+       protected function getFooterHtml() {
                $html = '';
-
-               $html .= $this->getHtmlForLabel( $property, $editable );
-               $html .= $this->getHtmlForDescription( $property, $editable );
-               $html .= $this->getHtmlForDataType( $this->getDataType( 
$property ) );
-
-               $html .= wfTemplate( 'wb-entity-header-separator' );
-
-               $html .= $this->getHtmlForAliases( $property, $editable );
-               $html .= $this->getHtmlForToc();
-               $html .= $this->getHtmlForTermBox( $property, $editable );
-               $html .= $this->getHtmlForClaims( $property, $editable );
 
                $footer = $this->msg( 'wikibase-property-footer' );
 
                if ( !$footer->isBlank() ) {
                        $html .= "\n" . $footer->parse();
                }
-
-               wfProfileOut( __METHOD__ );
-               return $html;
-       }
-
-       /**
-        * Returns the HTML for the heading of the claims section
-        *
-        * @since 0.5
-        *
-        * @param Entity $entity
-        * @param bool $editable
-        *
-        * @return string
-        */
-       protected function getHtmlForClaimsSectionHeading( Entity $entity, 
$editable = true ) {
-               $html = wfTemplate(
-                       'wb-section-heading',
-                       wfMessage( 'wikibase-constraints' ),
-                       'claims' // ID - TODO: should not be added if output 
page is not the entity's page
-               );
 
                return $html;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5bbbd386923fc6534fc399b93dd64396d05057e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: mw1.23-wmf21
Gerrit-Owner: Aude <[email protected]>

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

Reply via email to