Jonas Kress (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365071 )

Change subject: Show toast when auto completion is available
......................................................................

Show toast when auto completion is available

Bug:T170542
Change-Id: Ifb4718c6260f0bcca1aeec89315b7b07509fb0a4
---
M index.html
M wikibase/queryService/ui/App.js
2 files changed, 10 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui 
refs/changes/71/365071/1

diff --git a/index.html b/index.html
index c2bb2d6..7e3e6ca 100644
--- a/index.html
+++ b/index.html
@@ -148,9 +148,6 @@
                                                </tr>
                                        </table>
                                        <div class="status navbar 
navbar-default">
-                                               <div class="navbar-left">
-                                                       <span 
data-i18n="[html]wdqs-app-footer-help"></span>
-                                               </div>
                                                <div class="navbar-right">
                                                        <span 
class="dataUpdated"> </span>
                                                </div>
diff --git a/wikibase/queryService/ui/App.js b/wikibase/queryService/ui/App.js
index d7930b1..6b92f7f 100644
--- a/wikibase/queryService/ui/App.js
+++ b/wikibase/queryService/ui/App.js
@@ -149,8 +149,18 @@
         * @private
         */
        SELF.prototype._initEditor = function() {
+               var self = this;
+
                this._editor.fromTextArea( this._$element.find( '.queryEditor' 
)[0] );
 
+               this._editor.registerCallback( 'change', function( editor, 
changeObj ) {
+                       if ( changeObj.text[0] === ':' ) {
+                               var $help = $( '<a target="_blank" 
rel="noopener" 
href="https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/Wikidata_Query_Help/SPARQL_Editor#Code_Completion";>'
 )
+                               .append( $.i18n( 'wdqs-app-footer-help' ) );
+                               $.toast( $help[0].outerHTML );
+                       }
+               } );
+
                // if(window.history.pushState) {//this works only in modern 
browser
                // this._editor.registerCallback( 'change', $.proxy( 
this._updateQueryUrl, this) );
                // }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifb4718c6260f0bcca1aeec89315b7b07509fb0a4
Gerrit-PatchSet: 1
Gerrit-Project: wikidata/query/gui
Gerrit-Branch: master
Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de>

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

Reply via email to