Difference between revisions of "Template:Draft article check/doc"

From blackwiki
Jump to navigation Jump to search
imported>HectorMoffet
imported>HectorMoffet
Line 22: Line 22:
 
==Test Cases==
 
==Test Cases==
 
As of 15:43, 23 December 2013 (UTC), the following testcases passed:  (altering the text/existence of relevant pages in future may alter the results)
 
As of 15:43, 23 December 2013 (UTC), the following testcases passed:  (altering the text/existence of relevant pages in future may alter the results)
* [[Draft:Example]] should show a link to the Wikipedia article [[Example]]
+
* [[Draft:Example]] should show a link to the corresponding Wikipedia article  
* [[Draft talk:Example]] should show a link to the Wikipedia article [[Example]]
+
* [[Draft talk:Example]] should show a link to the corresponding Wikipedia article
* [[Talk:Example]] should show a link to [[Draft:Example]]
+
* [[Talk:Example]] should show a link to the corresponding Draft .
* If you are '''not logged-in''', then the Wikipedia article [[Example]] should NOT show a link. (although inspection of html source should show a html element with the style "visiblity: hidden;")   
+
* If you are '''not logged-in''', then the Wikipedia article [[Example]] should NOT show any links to drafts. (Although inspection of html source should show a html element with the style "visiblity: hidden;")   
* if you are '''logged-in''', (and ShowOnlyToLoggedInUsers.js is installed), then the Wikipedia article [[Example]] SHOULD show a link corresponding draft.  
+
* if you are '''logged-in''', (and '''[[User:HectorMoffet/ShowOnlyToLoggedInUsers.js|ShowOnlyToLoggedInUsers.js]] is installed'''), then the Wikipedia article [[Example]] SHOULD show a link to the corresponding draft.  
  
* [[Draft:DraftcheckerNullTest]] and [[Draft talk:DraftcheckerNullTest]] should report the non-existence of [[DraftcheckerNullTest]].  
+
* [[Draft:DraftcheckerNullTest]] and [[Draft talk:DraftcheckerNullTest]] should report the non-existence of the corresponding article.  
 
* [[Kierkegaard (disambiguation)]] and [[Talk:Kierkegaard (disambiguation)]] should not report anything.
 
* [[Kierkegaard (disambiguation)]] and [[Talk:Kierkegaard (disambiguation)]] should not report anything.
 
* [[Wikipedia:Example]] should not report anything.
 
* [[Wikipedia:Example]] should not report anything.

Revision as of 16:19, 23 December 2013

DraftChecker is a template to alert editors to the existence of relevant articles or drafts.

  • In Draft or Draft_Talk, DraftChecker will check for an Article of the same title.
  • In Article_Talk, DraftChecker will check for a Draft of the same title.
  • In the Article namespace, Draftchecker will check for a Draft of the same title, but will only show a message if a custom javascript determines the user is logged in.

Usage

{{DraftChecker}}

Technical details

Logged-in Editors -vs- Anonymous Readers

In order for logged-in editors to view DraftChecker's links in the main Article namespace, two lines of javascript code must be installed: the ShowOnlyToLoggedInUsers.js script.

While DraftChecker is in development, you can install this script by adding the following line to your common.js file:

importScript('User:HectorMoffet/ShowOnlyToLoggedInUsers.js');

In the future, the ShowOnlyToLoggedInUsers.js script could become a Gadget enabled by default, or its two lines of code could be incorporated into Wikipedia's default javascript file (MediaWiki:Common.js).

Test Cases

As of 15:43, 23 December 2013 (UTC), the following testcases passed: (altering the text/existence of relevant pages in future may alter the results)

  • Draft:Example should show a link to the corresponding Wikipedia article
  • Draft talk:Example should show a link to the corresponding Wikipedia article
  • Talk:Example should show a link to the corresponding Draft .
  • If you are not logged-in, then the Wikipedia article Example should NOT show any links to drafts. (Although inspection of html source should show a html element with the style "visiblity: hidden;")
  • if you are logged-in, (and ShowOnlyToLoggedInUsers.js is installed), then the Wikipedia article Example SHOULD show a link to the corresponding draft.