Mglaser has uploaded a new change for review.

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

Change subject: InsertMagic: Added examples to description and reference 
implementation
......................................................................

InsertMagic: Added examples to description and reference implementation

You can now add several examples to the description of a magic word. How
this is done can be seen in the Blog extension reference implementation.

Change-Id: I7ae654929f0ec3559a5882a22d78d481a335a763
---
M Blog/Blog.class.php
M InsertMagic/InsertMagic.setup.php
M InsertMagic/i18n/en.json
M InsertMagic/i18n/qqq.json
M InsertMagic/resources/BS.InsertMagic/Window.js
5 files changed, 41 insertions(+), 9 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BlueSpiceExtensions 
refs/changes/67/291567/1

diff --git a/Blog/Blog.class.php b/Blog/Blog.class.php
index 4ffe0c9..2880d3c 100644
--- a/Blog/Blog.class.php
+++ b/Blog/Blog.class.php
@@ -310,7 +310,12 @@
                        'type' => 'tag',
                        'name' => 'blog',
                        'desc' => wfMessage( 'bs-blog-tag-blog-desc' )->text(),
-                       'code' => '<bs:blog count="5" cat="Wiki" 
newentryfieldposition="bottom" />',
+                       'code' => '<bs:blog />',
+                       'examples' => array(
+                               array(
+                                       'code' => '<bs:blog count="5" 
cat="Wiki" newentryfieldposition="bottom" />'
+                               )
+                       ),
                        'helplink' => 
'https://help.bluespice.com/index.php/Blog'
                );
 
@@ -328,7 +333,12 @@
                        'type' => 'tag',
                        'name' => 'blogtime',
                        'desc' => wfMessage( 'bs-blog-tag-blogtime-desc' 
)->text(),
-                       'code' => '<bs:blog:time time="201503161200" />',
+                       'code' => '<bs:blog:time time="YYYYMMDDHHmm" />',
+                       'examples' => array(
+                               array(
+                                       'code' => '<bs:blog:time 
time="201601010000" />'
+                               )
+                       ),
                        'helplink' => 
'https://help.bluespice.com/index.php/Blog'
                );
 
diff --git a/InsertMagic/InsertMagic.setup.php 
b/InsertMagic/InsertMagic.setup.php
index 6bf2c7f..acc7143 100644
--- a/InsertMagic/InsertMagic.setup.php
+++ b/InsertMagic/InsertMagic.setup.php
@@ -30,6 +30,7 @@
                'bs-insertmagic-label-second',
                'bs-insertmagic-label-third',
                'bs-insertmagic-label-desc',
+               'bs-insertmagic-label-examples',
                'bs-insertmagic-label-see-also'
        ),
        'dependencies' => array(
diff --git a/InsertMagic/i18n/en.json b/InsertMagic/i18n/en.json
index bfb4815..2b71b8c 100644
--- a/InsertMagic/i18n/en.json
+++ b/InsertMagic/i18n/en.json
@@ -65,5 +65,6 @@
        "bs-insertmagic-label-first": "1. Choose tag or magic word",
        "bs-insertmagic-label-second": "2. Modify code",
        "bs-insertmagic-label-desc": "Description",
-       "bs-insertmagic-label-see-also": "See also:"
+       "bs-insertmagic-label-examples": "Examples",
+       "bs-insertmagic-label-see-also": "See also"
 }
diff --git a/InsertMagic/i18n/qqq.json b/InsertMagic/i18n/qqq.json
index 9a50688..b7d6fc5 100644
--- a/InsertMagic/i18n/qqq.json
+++ b/InsertMagic/i18n/qqq.json
@@ -68,5 +68,6 @@
        "bs-insertmagic-label-first": "Headline text for 1. choose tag or magic 
word \n {{Identical|1. Choose tag or magic word}}",
        "bs-insertmagic-label-second": "Headline text for 2. modify code \n 
{{Identical|2. Modify code}}",
        "bs-insertmagic-label-desc": "Headline text for description \n 
{{Identical|Description}}",
+       "bs-insertmagic-label-examples": "Textlabel above the example section 
in the description field of the insert magic dialog.",
        "bs-insertmagic-label-see-also": "Textlabel above the see also link for 
more information in the description field of the insert magic dialog."
 }
diff --git a/InsertMagic/resources/BS.InsertMagic/Window.js 
b/InsertMagic/resources/BS.InsertMagic/Window.js
index 0043ec6..c741972 100644
--- a/InsertMagic/resources/BS.InsertMagic/Window.js
+++ b/InsertMagic/resources/BS.InsertMagic/Window.js
@@ -37,7 +37,7 @@
 
                this.tagsStore = Ext.create( 'BS.store.BSApi', {
                        apiAction: 'bs-insertmagic-data-store',
-                       fields: ['id', 'type', 'name', 'desc', 'code', 
'helplink' ],
+                       fields: ['id', 'type', 'name', 'desc', 'code', 
'examples', 'helplink' ],
                        submitValue: false,
                        remoteSort: false,
                        remoteFilter: false,
@@ -174,7 +174,8 @@
                var data = {
                        desc : record.get( 'desc' ),
                        type : record.get( 'type' ),
-                       helplink : record.get( 'helplink' )
+                       helplink : record.get( 'helplink' ),
+                       examples : record.get( 'examples' )
                };
                this.currentData.type = data.type;
                this.currentData.name = record.get( 'name' );
@@ -184,12 +185,30 @@
 
        setCommonFields: function( text, data ) {
                var desc = data.desc;
-               if ( typeof(data.helplink) !== "undefined" && data.helplink != 
'' ) {
+               if ( typeof( data.examples ) !== "undefined" && data.examples 
!= '' ) {
                        desc = desc
-                                       + '<br/><br/>'
+                                       + '<br/><br/><strong>'
+                                       + mw.message( 
'bs-insertmagic-label-examples' ).plain()
+                                       + '</strong>';
+                       for ( var i = 0; i < data.examples.length; i++ ) {
+                               desc = desc + '<br/><br/>';
+                               var example = data.examples[i];
+                               if ( typeof( example.label ) !== "undefined" && 
example.label != '' ) {
+                                       desc = desc
+                                               + $( '<div>', { text: 
example.label } ).wrap( '<div/>' ).parent().html();
+                               };
+                               if ( typeof( example.code ) !== "undefined" && 
example.code != '' ) {
+                                       desc = desc
+                                               + $( '<code>', { text: 
example.code } ).wrap( '<div/>' ).parent().html();
+                               }
+                       }
+               }
+               if ( typeof( data.helplink ) !== "undefined" && data.helplink 
!= '' ) {
+                       desc = desc
+                                       + '<br/><br/><strong>'
                                        + mw.message( 
'bs-insertmagic-label-see-also' ).plain()
-                                       + '<br/>'
-                                       + $( '<a>', { href: data.helplink, 
text: data.helplink } ).wrap( '<div/>' ).parent().html();
+                                       + '</strong><br/><br/>'
+                                       + $( '<a>', { href: data.helplink, 
target: '_blank', text: data.helplink } ).wrap( '<div/>' ).parent().html();
                }
                this.descPanel.update( desc );
                this.syntaxTextArea.setValue( text );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7ae654929f0ec3559a5882a22d78d481a335a763
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BlueSpiceExtensions
Gerrit-Branch: master
Gerrit-Owner: Mglaser <gla...@hallowelt.biz>

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

Reply via email to