jenkins-bot has submitted this change and it was merged. Change subject: Result preview in example dialog ......................................................................
Result preview in example dialog Change-Id: I0d0a45b9ab23ae3c04aa43bb1e6a6ec3cf4be2ab --- M i18n/en.json M i18n/qqq.json M wikibase/queryService/ui/QueryExampleDialog.js 3 files changed, 28 insertions(+), 13 deletions(-) Approvals: Smalyshev: Looks good to me, approved Thiemo Mättig (WMDE): Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/i18n/en.json b/i18n/en.json index 5b5fa0f..31d551d 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -15,6 +15,8 @@ "wdqs-app-button-display": "Display", "wdqs-app-button-download": "Download", "wdqs-app-button-link": "Link", + "wdqs-dialog-examples-preview-query": "Preview query", + "wdqs-dialog-examples-preview-result": "Preview result", "wdqs-ve-find": "Find", "wdqs-ve-show": "Show", "wdqs-ve-with": "with", diff --git a/i18n/qqq.json b/i18n/qqq.json index 1297bbf..f00e5fd 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -16,6 +16,8 @@ "wdqs-app-button-display": "Button display result as table, image, ...\n{{Identical|Display}}", "wdqs-app-button-download": "Button download result\n{{Identical|Download}}", "wdqs-app-button-link": "Button get link to query\n{{Identical|Link}}", + "wdqs-dialog-examples-preview-query": "Label to preview query in example dialog", + "wdqs-dialog-examples-preview-result": "Label to preview result in example dialog", "wdqs-ve-find": "Label to find some item\n{{Identical|Find}}", "wdqs-ve-show": "Label to show some item\n{{Identical|Show}}", "wdqs-ve-with": "Label item with property\n{{Identical|With}}", diff --git a/wikibase/queryService/ui/QueryExampleDialog.js b/wikibase/queryService/ui/QueryExampleDialog.js index c33c366..04f1647 100644 --- a/wikibase/queryService/ui/QueryExampleDialog.js +++ b/wikibase/queryService/ui/QueryExampleDialog.js @@ -220,28 +220,39 @@ * @private */ SELF.prototype._addExample = function( title, query, href, tags ) { - var self = this; + var self = this, + link = $( '<a title="Select" data-dismiss="modal">' ).text( title ).attr( 'href', '#' ) + .click( function() { self._callback( query, title ); } ), + edit = $( '<a title="Edit">' ).attr( 'href', href ).attr( 'target', '_blank' ) + .append( '<span>' ).addClass( 'glyphicon glyphicon-pencil' ), - var link = $( '<a title="Select this query" data-dismiss="modal">' ).text( title ).attr( - 'href', '#' ).click( function() { - self._callback( query, title ); - } ), edit = $( '<a title="Edit this Query">' ).attr( 'href', href ).attr( 'target', - '_blank' ).append( - '<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span></a>' ), preview = $( - '<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>' ).popover( + source = $( '<span>' ).addClass( 'glyphicon glyphicon-eye-open' ).popover( { placement: 'bottom', trigger: 'hover', container: 'body', - title: 'Preview', + title: $.i18n( 'wdqs-dialog-examples-preview-query' ), content: $( '<pre style="white-space:pre-line; word-break:break-word;"/>' ).text( query ), + html: true + } ), + preview = $( '<a href="#">' ).addClass( 'glyphicon glyphicon-camera' ).clickover( + { + placement: 'right', + 'global_close': true, + trigger: 'click', + container: 'body', + title: $.i18n( 'wdqs-dialog-examples-preview-result' ), + content: $( '<iframe width="400" height="400" frameBorder="0" src="embed.html#' + + encodeURIComponent( query ) + '">' ), html: true } ); - tags = $( '<td/>' ).text( tags.join( '|' ) ).hide(); - var example = $( '<tr/>' ); - example.append( $( '<td/>' ).append( link ).append( ' ', edit ) ); - example.append( $( '<td/>' ).append( preview ) ); + tags = $( '<td>' ).text( tags.join( '|' ) ).hide(); + + var example = $( '<tr>' ); + example.append( $( '<td>' ).append( link ).append( ' ', edit ) ); + example.append( $( '<td>' ).append( preview ) ); + example.append( $( '<td>' ).append( source ) ); example.append( tags ); this._$element.find( '.searchable' ).append( example ); -- To view, visit https://gerrit.wikimedia.org/r/302743 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0d0a45b9ab23ae3c04aa43bb1e6a6ec3cf4be2ab Gerrit-PatchSet: 5 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> Gerrit-Reviewer: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> Gerrit-Reviewer: Lydia Pintscher <lydia.pintsc...@wikimedia.de> Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org> Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits