Jeroen De Dauw has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/375946 )

Change subject: Add help messages
......................................................................

Add help messages

https://phabricator.wikimedia.org/T168405

Change-Id: I34efbd375cf90d3d2e58f3025968fff2c31cd968
---
M extension.json
M i18n/en.json
M i18n/qqq.json
M modules/ext.advancedSearch.init.js
4 files changed, 44 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/AdvancedSearch 
refs/changes/46/375946/1

diff --git a/extension.json b/extension.json
index 1056264..4247c6c 100644
--- a/extension.json
+++ b/extension.json
@@ -66,7 +66,16 @@
                                "advancedsearch-field-insource",
                                "advancedsearch-field-filetype",
                                "advancedsearch-field-filew",
-                               "advancedsearch-field-fileh"
+                               "advancedsearch-field-fileh",
+                               "advancedsearch-help-plain",
+                               "advancedsearch-help-phrase",
+                               "advancedsearch-help-or",
+                               "advancedsearch-help-not",
+                               "advancedsearch-help-hastemplate",
+                               "advancedsearch-help-insource",
+                               "advancedsearch-help-filetype",
+                               "advancedsearch-help-filew",
+                               "advancedsearch-help-fileh"
                        ],
                        "dependencies": [
                                "mediawiki.util",
diff --git a/i18n/en.json b/i18n/en.json
index a19fca4..03ba2e2 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -24,6 +24,16 @@
        "advancedsearch-field-filew": "File width in pixels:",
        "advancedsearch-field-fileh": "File height in pixels:",
 
+       "advancedsearch-help-plain": "searches for these words in the title or 
text.",
+       "advancedsearch-help-phrase": "searches for a specific sequence of 
characters. Punctuation marks are ignored.",
+       "advancedsearch-help-or": "excludes pages containing these words from 
the search.",
+       "advancedsearch-help-not": "at least one of the search terms has to be 
included in the page.",
+       "advancedsearch-help-hastemplate": "searches for pages that contain 
exactly this template.",
+       "advancedsearch-help-insource": "only looks for the search term in the 
source code.",
+       "advancedsearch-help-filetype": "searches only for files of the 
selected type",
+       "advancedsearch-help-filew": "searches only for files with the 
specified width",
+       "advancedsearch-help-fileh": "searches only for files with the 
specified height",
+
        "advancedsearch-filetype-section-types": "General file type",
        "advancedsearch-filetype-section-image": "Image format",
        "advancedsearch-filetype-section-video": "Video format",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 25c12be..dbbbd8b 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -23,6 +23,15 @@
        "advancedsearch-field-filetype": "Label for the field for file 
type\n{{Identical|File type}}",
        "advancedsearch-field-filew": "Label for the field for file width in 
pixels",
        "advancedsearch-field-fileh": "Label for the field for file height in 
pixels",
+       "advancedsearch-help-plain": "Help text shown in a dialog for the field 
for plain search",
+       "advancedsearch-help-phrase": "Help text shown in a dialog for the 
field for exact search",
+       "advancedsearch-help-or": "Help text shown in a dialog for the field 
for or search",
+       "advancedsearch-help-not": "Help text shown in a dialog for the field 
for excluded words in search",
+       "advancedsearch-help-hastemplate": "Help text shown in a dialog for the 
field for for searching pages with a template",
+       "advancedsearch-help-insource": "Help text shown in a dialog for the 
field for wikitext search",
+       "advancedsearch-help-filetype": "Help text shown in a dialog for the 
field for file type\n{{Identical|File type}}",
+       "advancedsearch-help-filew": "Help text shown in a dialog for the field 
for file width in pixels",
+       "advancedsearch-help-fileh": "Help text shown in a dialog for the field 
for file height in pixels",
        "advancedsearch-filetype-section-types": "Label for the file type 
section",
        "advancedsearch-filetype-section-image": "Label for the image format 
section",
        "advancedsearch-filetype-section-video": "Label for the video format 
section",
diff --git a/modules/ext.advancedSearch.init.js 
b/modules/ext.advancedSearch.init.js
index 284d02a..01cefb5 100644
--- a/modules/ext.advancedSearch.init.js
+++ b/modules/ext.advancedSearch.init.js
@@ -90,6 +90,15 @@
                };
        }
 
+       function getMessageOrFalse( messageKey ) {
+               var message = mw.message( messageKey );
+               return message.exists() ? message.toString() : false;
+       }
+
+       function getOptionHelpMessageOrFalse( option ) {
+               return getMessageOrFalse( 'advancedsearch-help-' + option.id );
+       }
+
        function createOptionalFieldLayout( widget, option ) {
                return new mw.libs.advancedSearch.ui.OptionalElementLayout(
                        state,
@@ -99,7 +108,8 @@
                                align: 'right',
                                checkVisibility: function () {
                                        return 
state.filetypeSupportsDimensions();
-                               }
+                               },
+                               help: getOptionHelpMessageOrFalse( option )
                        }
                );
        }
@@ -361,7 +371,7 @@
                return widget;
        }
 
-       function createLayout( option, widget ) {
+       function createLayout( widget, option ) {
                if ( option.layout ) {
                        return option.layout( widget, option );
                }
@@ -370,7 +380,8 @@
                        widget,
                        {
                                label: mw.msg( 'advancedsearch-field-' + 
option.id ),
-                               align: 'right'
+                               align: 'right',
+                               help: getOptionHelpMessageOrFalse( option )
                        }
                );
        }
@@ -387,7 +398,7 @@
                }
 
                optionSets[ option.group ].addItems( [
-                       createLayout( option, createWidget( option ) )
+                       createLayout( createWidget( option ), option )
                ] );
        } );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I34efbd375cf90d3d2e58f3025968fff2c31cd968
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/AdvancedSearch
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>

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

Reply via email to