Aleksey Bekh-Ivanov (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364768 )

Change subject: Change Form's statements header text
......................................................................

Change Form's statements header text

Bug: T170388
Change-Id: I76f6152c2544af75cf716d9342c9e5f44d2639a4
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M resources/jquery.wikibase.lexemeformview.js
M src/View/LexemeFormsView.php
M src/View/LexemeViewFactory.php
6 files changed, 43 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme 
refs/changes/68/364768/1

diff --git a/extension.json b/extension.json
index 3b6b2ab..cc22539 100644
--- a/extension.json
+++ b/extension.json
@@ -84,7 +84,7 @@
                        "messages": [
                                "wikibase-lexeme-empty-form-representation",
                                "wikibase-lexeme-enter-form-representation",
-                               "wikibase-statementsection-statements"
+                               
"wikibase-lexeme-statementsection-statements-for"
                        ]
                },
                "jquery.wikibase.grammaticalfeatureview": {
diff --git a/i18n/en.json b/i18n/en.json
index 6480be1..4abf84c 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -11,6 +11,7 @@
        "wikibase-newlexeme-lexicalcategory": "Lexical category",
        "wikibase-newlexeme-language": "Language of lexeme",
        "wikibase-lexeme-view-language-lexical-category": "$1 in $2",
+       "wikibase-lexeme-statementsection-statements-for": "Statements for $1",
        "wikibase-lexeme-view-forms": "Morphology",
        "wikibase-lexeme-enter-form-representation": "Enter new form 
representation",
        "wikibase-lexeme-empty-form-representation": "No form representation 
defined",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 0d013fe..dfdb6c9 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -16,6 +16,7 @@
        "wikibase-newlexeme-lexicalcategory": "Name for \"lexical category\"",
        "wikibase-newlexeme-language": "Label for field in the lexeme creation 
form.",
        "wikibase-lexeme-view-language-lexical-category": "Description when 
both lexical category and language are present\n{{Identical|In}}",
+       "wikibase-lexeme-statementsection-statements-for": "Heading for the 
list of statements giving specific information about the currently viewed Form 
or Sense of a Lexeme.\n{{Identical|Statements}}",
        "wikibase-lexeme-view-forms": "Subheading for the morphology (forms) 
section on a lexeme page.\n{{Identical|Form}}",
        "wikibase-lexeme-enter-form-representation": "Placeholder for the 
lexeme form representation input field.",
        "wikibase-lexeme-empty-form-representation": "Placeholder message 
displayed instead of the lexeme form representation in case no representation 
has been specified yet.",
diff --git a/resources/jquery.wikibase.lexemeformview.js 
b/resources/jquery.wikibase.lexemeformview.js
index b057626..6040a4f 100644
--- a/resources/jquery.wikibase.lexemeformview.js
+++ b/resources/jquery.wikibase.lexemeformview.js
@@ -51,10 +51,11 @@
                                function () {
                                        var $container = $( '<div/>' );
                                        this.deferredFormWithId.promise().then( 
function ( form ) {
+                                               var messageKey = 
'wikibase-lexeme-statementsection-statements-for';
                                                var $header = $( '<h2/>' 
).applyTemplate(
                                                        'wb-section-heading',
                                                        [
-                                                               mw.message( 
'wikibase-statementsection-statements' ).escaped(),
+                                                               mw.message( 
messageKey, form.getId() ).escaped(),
                                                                '',
                                                                
'wikibase-statements'
                                                        ]
diff --git a/src/View/LexemeFormsView.php b/src/View/LexemeFormsView.php
index 20d119b..8794b8f 100644
--- a/src/View/LexemeFormsView.php
+++ b/src/View/LexemeFormsView.php
@@ -8,7 +8,7 @@
 use Wikibase\Lexeme\View\Template\LexemeTemplateFactory;
 use Wikibase\Lib\EntityIdHtmlLinkFormatter;
 use Wikibase\View\LocalizedTextProvider;
-use Wikibase\View\StatementSectionsView;
+use Wikibase\View\StatementGroupListView;
 use WMDE\VueJsTemplating\Templating;
 
 /**
@@ -33,9 +33,9 @@
        private $entityIdHtmlFormatter;
 
        /**
-        * @var StatementSectionsView
+        * @var StatementGroupListView
         */
-       private $statementSectionView;
+       private $statementGroupListView;
 
        /**
         * @var string
@@ -46,12 +46,12 @@
                LocalizedTextProvider $textProvider,
                LexemeTemplateFactory $templateFactory,
                EntityIdHtmlLinkFormatter $entityIdHtmlFormatter,
-               StatementSectionsView $statementSectionView
+               StatementGroupListView $statementGroupListView
        ) {
                $this->textProvider = $textProvider;
                $this->templateFactory = $templateFactory;
                $this->entityIdHtmlFormatter = $entityIdHtmlFormatter;
-               $this->statementSectionView = $statementSectionView;
+               $this->statementGroupListView = $statementGroupListView;
        }
 
        /**
@@ -101,7 +101,7 @@
                        htmlspecialchars( $form->getId()->getSerialization() ),
                        $this->renderRepresentationWidget( $form ),
                        $grammaticalFeaturesHtml,
-                       $this->statementSectionView->getHtml( 
$form->getStatements() ),
+                       $this->getStatementSectionHtml( $form ),
                        //Anchor separated from ID to avoid issue with 
front-end rendering
                        htmlspecialchars( $form->getId()->getSerialization() )
                ] );
@@ -191,4 +191,28 @@
 HTML;
        }
 
+       /**
+        * @param Form $form
+        * @return string
+        */
+       private function getStatementSectionHtml( Form $form ) {
+               $headerText = htmlspecialchars(
+                       $this->textProvider->get(
+                               
'wikibase-lexeme-statementsection-statements-for',
+                               [ $form->getId()->getSerialization() ]
+                       )
+               );
+
+               $statementHeader = <<<HTML
+<h2 class="wb-section-heading section-heading wikibase-statements" dir="auto">
+       <span class="mw-headline">{$headerText}</span>
+</h2>
+HTML;
+
+               $statementSection = $this->statementGroupListView->getHtml(
+                       $form->getStatements()->toArray()
+               );
+               return $statementHeader . $statementSection;
+       }
+
 }
diff --git a/src/View/LexemeViewFactory.php b/src/View/LexemeViewFactory.php
index 4e9e258..cc444b2 100644
--- a/src/View/LexemeViewFactory.php
+++ b/src/View/LexemeViewFactory.php
@@ -90,6 +90,13 @@
                        $this->editSectionGenerator
                );
 
+               $statementGroupListView = 
$wikibaseRepo->getViewFactory()->newStatementGroupListView(
+                       $this->languageCode,
+                       $this->labelDescriptionLookup,
+                       $this->fallbackChain,
+                       $this->editSectionGenerator
+               );
+
                $htmlTermRenderer = new FallbackHintHtmlTermRenderer(
                        $languageDirectionalityLookup,
                        new LanguageNameLookup( $this->languageCode )
@@ -108,7 +115,7 @@
                        $templateFactory,
                        $this->entityIdHtmlLinkFormatterFactory
                                ->getEntityIdFormatter( 
$retrievingLabelDescriptionLookup ),
-                       $statementSectionsView
+                       $statementGroupListView
                );
 
                $sensesView = new SensesView(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I76f6152c2544af75cf716d9342c9e5f44d2639a4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Aleksey Bekh-Ivanov (WMDE) <aleksey.bekh-iva...@wikimedia.de>

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

Reply via email to