r114510 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114509‎ | r114510 | r114511 >
Date:01:18, 27 March 2012
Author:raindrift
Status:deferred
Tags:
Comment:
added a comparator for sorting
added alternating background colors
Modified paths:
  • /trunk/extensions/PageTriage/SpecialPageTriage.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)

Diff [purge]

Index: trunk/extensions/PageTriage/SpecialPageTriage.php
@@ -69,9 +69,8 @@
7070
7171 // this template is repeated many times, once for each item in list view.
7272 $triageInterface .= <<<HTML
73 - <div id="backboneTemplates">
7473 <script type="text/template" id="listItemTemplate">
75 - <div class="mwe-pt-article-row">
 74+ <div id="mwe-pt-article-row">
7675 <% if ( afd_status == "1" || blp_prod_status == "1" || csd_status == "1" || prod_status == "1" ) { %>
7776 <div class="mwe-pt-status-icon mwe-pt-status-icon-deleted">
7877 [DEL] <!-- deleted -->
@@ -86,7 +85,11 @@
8786 </div>
8887 <% } %>
8988 </div>
90 - <div class="mwe-pt-info-pane">
 89+ <% if ( position % 2 == 0 ) { %>
 90+ <div class="mwe-pt-info-pane mwe-pt-info-pane-even">
 91+ <% } else { %>
 92+ <div class="mwe-pt-info-pane mwe-pt-info-pane-odd">
 93+ <% } %>
9194 <div class="mwe-pt-article">
9295 <span class="mwe-pt-page-title"><a href="<%= partial_url %>"><%= title %></a></span>
9396 <span class="mwe-pt-histlink">
@@ -107,17 +110,20 @@
108111 &#xb7; <span class="mwe-pt-metadata-warning"><%= gM("pagetriage-orphan") %></span>
109112 <% } %>
110113 </span>
 114+ <span class="mwe-pt-creation-date">
 115+ <!-- TODO: format nicely, but remember to also make localizable... -->
 116+ <%= creation_date %>
 117+ </span>
111118 </div>
112119 <div class="mwe-pt-author">
 120+ Author info goes here...
113121 </div>
114122 <div class="mwe-pt-snippet">
115123 <%= snippet %>
116124 </div>
117125 </div>
118126 </div>
119 - <br/>
120127 </script>
121 - </div>
122128 HTML;
123129
124130 // Get the list of articles
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.articleListItem.js
@@ -4,6 +4,11 @@
55 // instantiate the collection of articles
66 var articles = new mw.pageTriage.ArticleList;
77
 8+ // set the default sort order.
 9+ articles.comparator = function( article ) {
 10+ return -article.get( "creation_date" );
 11+ };
 12+
813 // single list item
914 var ListItem = Backbone.View.extend( {
1015 tagName: "div",
@@ -30,6 +35,7 @@
3136 initialize: function() {
3237
3338 // these events are triggered when items are added to the articles collection
 39+ this.position = 0;
3440 articles.bind( 'add', this.addOne, this );
3541 articles.bind( 'reset', this.addAll, this );
3642
@@ -41,11 +47,19 @@
4248 },
4349
4450 render: function() {
 51+ this.position = 0;
4552 // TODO: refresh the view (show/hide the parts that aren't attached to the ListItem view)
4653 },
4754
4855 // add a single article to the list
4956 addOne: function( article ) {
 57+ // define position, for making alternating background colors.
 58+ // this is added at the last minute, so it gets updated when the sort changes.
 59+ if(! this.position ) {
 60+ this.position = 0;
 61+ }
 62+ article.set( 'position', this.position++ );
 63+
5064 // pass in the specific article instance
5165 var view = new ListItem( { model: article } );
5266 this.$( "#listView" ).append( view.render().el );
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.articleListItem.css
@@ -1,8 +1,16 @@
22
3 -.mwe-pt-article-row {
4 - width: 100%;
 3+.mwe-pt-info-pane-even {
 4+ background-color: #efefef;
55 }
66
 7+.mwe-pt-info-pane-odd {
 8+ background-color: white;
 9+}
 10+
 11+.mwe-pt-info-pane {
 12+ margin-left: 50px;
 13+}
 14+
715 .mwe-pt-status-icon {
816 float: left;
917 width: 50px;
@@ -21,10 +29,6 @@
2230 background-color: #b3b3b3;
2331 }
2432
25 -.mwe-pt-info-pane {
26 - margin-left: 50px;
27 -}
28 -
2933 /* info about the article */
3034 .mwe-pt-article {
3135 font-size: 1.2em;
@@ -46,6 +50,10 @@
4751 font-weight: bold;
4852 }
4953
 54+.mwe-pt-creation-date {
 55+ float: right;
 56+}
 57+
5058 /* info about the article's author */
5159 .mwe-pt-author {
5260 }

Status & tagging log