r114505 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114504‎ | r114505 | r114506 >
Date:23:20, 26 March 2012
Author:raindrift
Status:deferred
Tags:
Comment:
added article link to api
moved template into special page
made the metadata actually work and stuff
Modified paths:
  • /trunk/extensions/PageTriage/SpecialPageTriage.php (modified) (history)
  • /trunk/extensions/PageTriage/includes/ArticleMetadata.php (modified) (history)
  • /trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.articleListItem.css (modified) (history)
  • /trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.articleListItem.js (modified) (history)
  • /trunk/extensions/PageTriage/sql/PageTriageTags.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/PageTriage/SpecialPageTriage.php
@@ -66,7 +66,59 @@
6767 // TODO: this should load with a spinner instead of "please wait"
6868 $triageInterface .= "<div id='listView'>Please wait...</div>";
6969 $triageInterface .= "<div id='pageTriageFooter'></div>";
70 - $triageInterface .= "<div id='backboneTemplates'></div>";
 70+
 71+ // this template is repeated many times, once for each item in list view.
 72+ $triageInterface .= <<<HTML
 73+ <div id="backboneTemplates">
 74+ <script type="text/template" id="listItemTemplate">
 75+ <div class="mwe-pt-article-row">
 76+ <% if ( afd_status == "1" || blp_prod_status == "1" || csd_status == "1" || prod_status == "1" ) { %>
 77+ <div class="mwe-pt-status-icon mwe-pt-status-icon-deleted">
 78+ [DEL] <!-- deleted -->
 79+ </div>
 80+ <% } else if ( patrol_status == "1" ) { %>
 81+ <div class="mwe-pt-status-icon mwe-pt-status-icon-triaged">
 82+ [TRI] <!-- triaged -->
 83+ </div>
 84+ <% } else { %>
 85+ <div class="mwe-pt-status-icon mwe-pt-status-icon-new">
 86+ [NEW] <!-- not patrolled -->
 87+ </div>
 88+ <% } %>
 89+ </div>
 90+ <div class="mwe-pt-info-pane">
 91+ <div class="mwe-pt-article">
 92+ <span class="mwe-pt-page-title"><a href="<%= partial_url %>"><%= title %></a></span>
 93+ <span class="mwe-pt-histlink">
 94+ (<a href="<%= mw.config.get("wgScriptPath") + "/index.php?title=" + partial_url + "&action=history" %>"><%= gM( "pagetriage-hist" ) %></a>)
 95+ </span>
 96+ <span class="mwe-pt-metadata">
 97+ &#xb7;
 98+ <%= gM( "pagetriage-bytes", page_len ) %>
 99+ &#xb7;
 100+ <%= gM( "pagetriage-edits", rev_count ) %>
 101+ &#xb7;
 102+ <% if( category_count == "0" ) { %>
 103+ <span class="mwe-pt-metadata-warning"><%= gM( "pagetriage-no-categories" ) %></span>
 104+ <% } else { %>
 105+ <%= gM( "pagetriage-categories", category_count ) %>
 106+ <% } %>
 107+ <% if( linkcount == "0" ) { %>
 108+ &#xb7; <span class="mwe-pt-metadata-warning"><%= gM("pagetriage-orphan") %></span>
 109+ <% } %>
 110+ </span>
 111+ </div>
 112+ <div class="mwe-pt-author">
 113+ </div>
 114+ <div class="mwe-pt-snippet">
 115+ <%= snippet %>
 116+ </div>
 117+ </div>
 118+ </div>
 119+ <br/>
 120+ </script>
 121+ </div>
 122+HTML;
71123
72124 // Get the list of articles
73125 //$triageInterface .= $this->getFormattedTriageList();
Index: trunk/extensions/PageTriage/sql/PageTriageTags.sql
@@ -26,4 +26,5 @@
2727 ('user_creation_date', 'User registration date'),
2828 ('user_autoconfirmed', 'Check if user is autoconfirmed' ),
2929 ('user_bot', 'Check if user is in bot group'),
30 -('user_block_status', 'User block status');
 30+('user_block_status', 'User block status'),
 31+('internal_url', 'Internal link fragment');
\ No newline at end of file
Index: trunk/extensions/PageTriage/includes/ArticleMetadata.php
@@ -321,6 +321,7 @@
322322 $metaData[$row->page_id]['creation_date'] = $row->creation_date;
323323 $metaData[$row->page_id]['rev_count'] = $row->rev_count;
324324 $metaData[$row->page_id]['title'] = $title->getPrefixedText();
 325+ $metaData[$row->page_id]['partial_url'] = $title->getPartialURL();
325326 $metaData[$row->page_id]['patrol_status'] = $row->ptrp_triaged;
326327 }
327328 // Remove any non-existing page_id from $this->mPageId
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.articleListItem.js
@@ -1,57 +1,10 @@
22 $( function() {
33 // view for the article list
44
5 -
6 - // TODO: find a way to insert these templates raw with RL instead of appending them to
7 - // the DOM with javascript later (which is lame)
8 -
9 - // This template is repeated many times for each element in list view
10 - // TODO there's some words in here which need to become wfMsg() calls
11 - $( "#backboneTemplates" ).append('<script type="text/template" id="listItemTemplate"> \
12 - <div class="mwe-pt-article-row"> \
13 - <div class="mwe-pt-status-icon"> \
14 - <% if ( afd_status == "1" || blp_prod_status == "1" || csd_status == "1" || prod_status == "1" ) { %> \
15 - [DEL] <!-- deleted --> \
16 - <% } else if ( patrol_status == "1" ) { %> \
17 - [PTR] <!-- patrolled --> \
18 - <% } else { %> \
19 - [NEW] <!-- not patrolled --> \
20 - <% } %> \
21 - </div> \
22 - <div class="mwe-pt-info-pane"> \
23 - <div> \
24 - <span class="mwe-pt-page-title"><%= title %></span> \
25 - <span class="mwe-pt-histlink">(<%= gM( "pagetriage-hist" ) %>)</span> \
26 - <span class="mwe-pt-metadata"> \
27 - &#xb7; \
28 - <%= gM( "pagetriage-bytes", page_len ) %> \
29 - &#xb7; \
30 - <%= gM( "pagetriage-edits", rev_count ) %> \
31 - &#xb7; \
32 - <% if( category_count == "0" ) { %> \
33 - <span class="mwe-pt-metadata-warning"><%= gM( "pagetriage-no-categories" ) %></span> \
34 - <% } else { %> \
35 - <%= gM( "pagetriage-categories", category_count ) %> \
36 - <% } %> \
37 - <% if( linkcount == "0" ) { %> \
38 - &#xb7; <span class="mwe-pt-metadata-warning"><%= gM("pagetriage-orphan") %></span> \
39 - <% } %> \
40 - </span> \
41 - </div> \
42 - <div class="mwe-pt-snippet"> \
43 - <%= snippet %> \
44 - </div> \
45 - </div> \
46 - </div> \
47 - <br/> \
48 - </script>'
49 - );
50 -
515 // instantiate the collection of articles
526 var articles = new mw.pageTriage.ArticleList;
537
548 // single list item
55 - // TODO: move this into its own file?
569 var ListItem = Backbone.View.extend( {
5710 tagName: "div",
5811 template: _.template( $( "#listItemTemplate" ).html() ),
@@ -106,5 +59,6 @@
10760
10861 } );
10962
 63+ // create an instance of the list view, which makes everything go.
11064 var list = new ListView();
11165 } );
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.articleListItem.css
@@ -6,14 +6,31 @@
77 .mwe-pt-status-icon {
88 float: left;
99 width: 50px;
 10+ height: 100%;
1011 }
1112
 13+.mwe-pt-status-icon-new {
 14+ background-color: #f2b3b3;
 15+}
 16+
 17+.mwe-pt-status-icon-triaged {
 18+ background-color: #c3ead7;
 19+}
 20+
 21+.mwe-pt-status-icon-deleted {
 22+ background-color: #b3b3b3;
 23+}
 24+
1225 .mwe-pt-info-pane {
1326 margin-left: 50px;
1427 }
1528
 29+/* info about the article */
 30+.mwe-pt-article {
 31+ font-size: 1.2em;
 32+}
 33+
1634 .mwe-pt-page-title {
17 - font-size: 1.2em;
1835 font-weight: bold;
1936 }
2037
@@ -22,7 +39,6 @@
2340 }
2441
2542 .mwe-pt-metadata {
26 - font-size:1.2em;
2743 }
2844
2945 .mwe-pt-metadata-warning {
@@ -30,7 +46,11 @@
3147 font-weight: bold;
3248 }
3349
 50+/* info about the article's author */
 51+.mwe-pt-author {
 52+}
 53+
 54+/* the article snippet */
3455 .mwe-pt-snippet {
3556 color: #bebebe;
3657 }
37 -

Status & tagging log