r114591 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114590‎ | r114591 | r114592 >
Date:01:10, 29 March 2012
Author:raindrift
Status:deferred
Tags:
Comment:
made the controls to get the filter dropdown menu.
still need to make the menu itself
Modified paths:
  • /trunk/extensions/PageTriage/SpecialPageTriage.php (modified) (history)
  • /trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listControlNav.css (modified) (history)
  • /trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listControlNav.js (modified) (history)
  • /trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listView.js (modified) (history)

Diff [purge]

Index: trunk/extensions/PageTriage/SpecialPageTriage.php
@@ -68,6 +68,7 @@
6969 $triageInterface .= "<div id='mwe-pt-list-stats-nav' class='mwe-pt-navigation-bar'></div>";
7070
7171 // These are the templates that backbone/underscore render on the client.
 72+ // It would be awesome if they lived in separate files, but we need to figure out how to make RL do that for us.
7273 $triageInterface .= <<<HTML
7374 <!-- individual list item template -->
7475 <script type="text/template" id="listItemTemplate">
@@ -160,8 +161,17 @@
161162 <script type="text/template" id="listControlNavTemplate">
162163 <span class="mwe-pt-control-label"><b><%= gM( 'pagetriage-showing' ) %></b> some things</span>
163164 <span class="mwe-pt-control-label-right"><%= gM( 'pagetriage-article-count', 100, 'untriaged' ) %></span><br/>
164 - <span class="mwe-pt-control-label"><b><%= gM( 'pagetriage-filter-list-prompt' ) %> &#x25b8;</b></span><!-- &#x25be; is the down arrow -->
 165+ <span id="mwe-pt-filter-dropdown-control" class="mwe-pt-control-label">
 166+ <b>
 167+ <%= gM( 'pagetriage-filter-list-prompt' ) %>
 168+ <span id="mwe-pt-dropdown-arrow">&#x25b8;</span>
 169+ <!--<span class="mwe-pt-dropdown-open">&#x25be;</span>-->
 170+ </b>
 171+ </span>
165172 <span class="mwe-pt-control-label-right"><b><%= gM( 'pagetriage-viewing' ) %></b> Sort Controls</span>
 173+ <div id="mwe-pt-control-dropdown">
 174+ foo bar
 175+ </div>
166176 </script>
167177
168178 <script type="text/template" id="listStatsNavTemplate">
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listControlNav.js
@@ -4,14 +4,16 @@
55 mw.pageTriage.ListControlNav = Backbone.View.extend( {
66 tagName: "div",
77 template: _.template( $( "#listControlNavTemplate" ).html() ),
 8+ filterMenuVisible: 0,
89
910 initialize: function() {
 11+ var _this = this;
 12+
1013 // make a floating top navbar
1114 // TODO: there's a bump when the control div detaches from the page.
1215 // fill some element under it to make it scroll smoothly
1316 $( '.top' ).addClass( 'hidden' );
1417 $.waypoints.settings.scrollThrottle = 30;
15 - var _this = this;
1618 $( '#mwe-pt-list-control-nav' ).waypoint( function( event, direction ) {
1719 $( this ).parent().toggleClass( 'sticky', direction === "down" );
1820 _this.resize();
@@ -24,12 +26,27 @@
2527 clearTimeout(resizeTimer);
2628 resizeTimer = setTimeout(this.resize, 100);
2729 });
 30+
 31+ // hover for the dropdown menu control
 32+ /*
 33+ $( '#mwe-pt-filter-dropdown-control' ).hover( function() {
 34+ _this.toggleFilterMenu();
 35+ } );
 36+ */
2837 },
2938
3039 render: function() {
31 - // insert the template into the document. fill with the current model.
32 - this.$el.html( this.template( ) );
33 - return this;
 40+ _this = this;
 41+ // render and return the template. fill with the current model.
 42+ $( "#mwe-pt-list-control-nav").html( this.template() );
 43+
 44+ // now that the template's been inserted, set up some events for controlling it
 45+
 46+ // the filter dropdown menu control
 47+ $( '#mwe-pt-filter-dropdown-control' ).click( function( e ) {
 48+ _this.toggleFilterMenu();
 49+ e.stopPropagation;
 50+ } );
3451 },
3552
3653 resize: function() {
@@ -37,7 +54,18 @@
3855 // the left nav is 176 pixels
3956 // the right margin is 16 pixels
4057 $( '#mwe-pt-list-control-nav' ).css( 'width', $(window).width() - 176 - 16 + "px" );
 58+ },
 59+
 60+ toggleFilterMenu: function() {
 61+ if( this.filterMenuVisible ) {
 62+ $( '#mwe-pt-dropdown-arrow' ).html( '&#x25b8;' );
 63+ $( '#mwe-pt-control-dropdown' ).css( 'visibility', 'hidden' );
 64+ this.filterMenuVisible = 0;
 65+ } else {
 66+ $( '#mwe-pt-control-dropdown' ).css( 'visibility', 'visible' );
 67+ $( '#mwe-pt-dropdown-arrow' ).html( '&#x25be;' );
 68+ this.filterMenuVisible = 1;
 69+ }
4170 }
42 -
4371 } );
4472 } );
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listView.js
@@ -32,9 +32,9 @@
3333 this.position = 0;
3434
3535 // add the navigation bits
36 - var controlNav = new mw.pageTriage.ListControlNav();
37 - $( "#mwe-pt-list-control-nav").html( controlNav.render().el );
38 -
 36+ var controlNav = new mw.pageTriage.ListControlNav( { articles: articles } );
 37+ controlNav.render();
 38+
3939 var statsNav = new mw.pageTriage.ListStatsNav();
4040 $( "#mwe-pt-list-stats-nav").html( statsNav.render().el );
4141 },
Index: trunk/extensions/PageTriage/modules/ext.pageTriage.views/ext.pageTriage.listControlNav.css
@@ -20,3 +20,26 @@
2121 float: right;
2222 padding-right: 1em;
2323 }
 24+
 25+.mwe-pt-control-dropdown {
 26+ visibility: hidden;
 27+ width: 250px
 28+ height: ;
 29+}
 30+
 31+#mwe-pt-control-dropdown {
 32+ position: absolute;
 33+ background-color: #bebebe;
 34+ left: 5em;
 35+ visibility: hidden;
 36+}
 37+
 38+#mwe-pt-filter-dropdown-control {
 39+ /* make this match the overall link color */
 40+ color: blue;
 41+}
 42+
 43+span:hover #mwe-pt-filter-dropdown-control {
 44+ /* TODO: make this actually work */
 45+ cursor: pointer;
 46+}

Status & tagging log