WordPress.org

Making WordPress.org

Changeset 1955


Ignore:
Timestamp:
10/10/2015 07:21:00 PM (4 years ago)
Author:
ocean90
Message:

Trac: Move JavaScript logic for contributor labels into wp-trac.js.

Fixes #1326.

Location:
sites/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/trac.wordpress.org/templates/core/site-specific.html

    r1951 r1955  
    1414<div id="report-popup"></div>
    1515<script>
    16 (function($){
    17 var titles = {
     16var wpTracContributorLabels = {
    1817    matt: 'Project Lead',
    1918    markjaquith: 'Lead Developer',
     
    2423
    2524    ocean90: 'Core Committer',
    26     sergeybiryukov: 'Core Committer',
     25    SergeyBiryukov: 'Core Committer',
    2726    johnbillion: 'Core Committer',
    2827    pento: 'Core Committer',
     
    4443    iandstewart: 'Themes Committer',
    4544    karmatosed: 'Themes Committer',
    46     drewapicture: 'Docs Committer',
     45    DrewAPicture: 'Docs Committer',
    4746
    4847    ryan: 'Lead Developer',
     
    5251};
    5352
    54 $('h3.change .profile-link').each( function() {
    55     var el = $(this);
    56     user = el.attr('href').split('/').pop().toLowerCase();
    57     if ( user in titles ) {
    58         el.after( ' <span class="contributor-label">(' + titles[ user ] + ')</span>' );
    59     }
    60 });
    61 })(jQuery);
    6253</script>
    6354</body>
  • sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js

    r1952 r1955  
    5050                wpTrac.nonGardeners();
    5151            }
     52
     53            if ( 'undefined' !== typeof wpTracContributorLabels ) {
     54                wpTrac.showContributorLabels( wpTracContributorLabels );
     55            }
     56
    5257            if ( ! $(document.body).hasClass( 'plugins' ) ) {
    5358                wpTrac.workflow.init();
     
    5964        },
    6065
     66        showContributorLabels: function( labels ) {
     67            $( 'h3.change .username' ).each( function() {
     68                var $el = $( this ),
     69                    username = $el.data( 'username' );
     70
     71                if ( username in labels ) {
     72                    $el.parent( 'a.profile-link' ).after( ' <span class="contributor-label">(' + labels[ username ] + ')</span>' );
     73                }
     74            });
     75        },
    6176        // These ticket hacks need to be re-run after ticket previews.
    6277        postPreviewHacks: function() {
     
    7489                }
    7590                appendTo = li.parent().parent(); // div.change
    76                 image = new Image;
     91                image = new Image();
    7792                image.src = href;
    7893                image.onload = function() {
Note: See TracChangeset for help on using the changeset viewer.