Making WordPress.org


Ignore:
Timestamp:
12/17/2018 07:34:12 AM (8 years ago)
Author:
vedjain
Message:

WCPT Application Tracker: Multiple changes in rendering of application status report, see desc.

  1. Add customRender option to allow specifying different render logic in application tracker report.
  2. Send timestamp for lastUpdated column instead of humanize_time_diff. Move logic for humanize_time_diff to frontend, because its a very simple logic, and would make a easy fix for #2501
  3. Use customRender option to display X time ago instead of absolute timestamp.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/javascript/tracker/source/components/filterable-table/row.jsx

    r3814 r7976  
    33export default React.createClass( {
    44        propTypes : {
    5                 columns : PropTypes.object,
    6                 row     : PropTypes.object,
     5                columns      : PropTypes.object,
     6                row          : PropTypes.object,
     7                customRender : PropTypes.object,
    78        },
    89
    910        getDefaultProps : function() {
    1011                return {
    11                         columns : {},
    12                         row     : {},
     12                        columns      : {},
     13                        row          : {},
     14                        customRender : {},
    1315                };
    1416        },
     
    2123                 * shouldn't be displayed, like URLs.
    2224                 */
    23                 for ( let i in this.props.columns ) {
     25                for ( let columnName in this.props.columns ) {
    2426                        let cellContent = '';
    2527
    26                         if ( ! this.props.columns.hasOwnProperty( i ) ) {
     28                        if ( ! this.props.columns.hasOwnProperty( columnName ) ) {
    2729                                continue;
    2830                        }
    2931
    30                         if ( this.props.row[ i + 'Url' ] ) {
    31                                 cellContent = <a href={ this.props.row[ i + 'Url' ] }>{ this.props.row[ i ] }</a>;
     32                        if ( this.props.row[ columnName + 'Url' ] ) {
     33                                cellContent = <a href={ this.props.row[ columnName + 'Url' ] }>{ this.props.row[ columnName ] }</a>;
     34                        } else if ( this.props.customRender[ columnName ] ) {
     35                                cellContent = this.props.customRender[ columnName ]( this.props.row[ columnName ] );
    3236                        } else {
    33                                 cellContent = this.props.row[ i ];
     37                                cellContent = this.props.row[ columnName ];
    3438                        }
    3539
     40
    3641                        cells.push(
    37                                 <td className={ i } key={ i }>
     42                                <td className={ columnName } key={ columnName }>
    3843                                        { cellContent }
    3944                                </td>
Note: See TracChangeset for help on using the changeset viewer.