Making WordPress.org

Changeset 2903


Ignore:
Timestamp:
04/05/2016 08:54:28 PM (9 years ago)
Author:
ocean90
Message:

Trac: List commits between ticket description and attachments.

Props iseulde for the idea.

Location:
sites/trunk/wordpress.org/public_html/style/trac
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/style/trac/wp-trac.css

    r2363 r2903  
    18811881}
    18821882
     1883#commits > div.commits {
     1884    border: 1px solid #ccc;
     1885    padding-right: 1em;
     1886}
     1887
     1888#commits ul {
     1889    margin-left: 2em;
     1890    padding: 0;
     1891}
     1892
     1893#commits li {
     1894    list-style: square;
     1895    padding-bottom: 4px;
     1896    margin-left: 10px
     1897}
     1898
    18831899/* =Responsive / Mobile
    18841900----------------------------------------------- */
  • sites/trunk/wordpress.org/public_html/style/trac/wp-trac.js

    r2310 r2903  
    387387            });
    388388
     389            // List commits between #ticket and #attachments
     390            var $commitChanges = $( 'div.change' ).has( '.comment p a.changeset' ).has( '.comment div.message p a.ticket' ),
     391                $commits = $( '<ul/>' ), commitCount = 0;
     392
     393            $commitChanges.each( function( i, el ) {
     394                var $el = $( el ), $comment = $el.find( '.comment' ), commitNumber, firstLine,
     395                    author, date, $commit = $( '<li>' );
     396
     397                commitNumber = $comment.find( '> p ').html().trim().replace( /^In /, '' ).replace( /:<br>$/, '' );
     398                $commit.append( '[' + commitNumber + '] ' );
     399
     400                firstLine = $comment.find( '.message > p' ).html().trim().replace( /<br>$/, '' );
     401                $commit.append( firstLine + '&hellip;' );
     402
     403                author = $el.find( '.username' ).data( 'username' );
     404                $commit.append( ' by <a href="https://profiles.wordpress.org/' + author + '">@' + author + '</a>' );
     405
     406                date = $el.find( '.time-ago' ).html();
     407                $commit.append( ' ' + date );
     408
     409                $commits.append( $commit );
     410                commitCount += 1;
     411            });
     412
     413            $( '#ticket' ).after(
     414                $( '<div/>', {
     415                    id: 'commits',
     416                    class: 'collapsed'
     417                })
     418                .append(
     419                    $( '<h3/>', {
     420                        class: 'foldable'
     421                    })
     422                    .html( '<a href="#no0" id="no0">Commits <span class="trac-count">(' + commitCount + ')</span></a>' )
     423                    .after(
     424                        $( '<div/>', {
     425                            class: 'commits'
     426                        })
     427                        .append( $commits )
     428                    )
     429                )
     430            );
     431
     432            // See $.fn.enableFolding().
     433            $( '#no0' ).on( 'click', function() {
     434                var $div = $( this.parentNode.parentNode ).toggleClass( 'collapsed' );
     435                return ! $div.hasClass( 'collapsed' );
     436            });
     437
    389438            // 'User Interface' preferences tab => 'Help Links' (and removes icons-only setting)
    390439            var uitab = $('#tab_userinterface');
Note: See TracChangeset for help on using the changeset viewer.