Changeset 7984
- Timestamp:
- 12/17/2018 07:35:16 AM (6 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/javascript/tracker/source/components/filterable-table/row.jsx
r7976 r7984 33 33 cellContent = <a href={ this.props.row[ columnName + 'Url' ] }>{ this.props.row[ columnName ] }</a>; 34 34 } else if ( this.props.customRender[ columnName ] ) { 35 cellContent = this.props.customRender[ columnName ]( this.props.row [ columnName ] );35 cellContent = this.props.customRender[ columnName ]( this.props.row, this.props.row[ columnName ] ); 36 36 } else { 37 37 cellContent = this.props.row[ columnName ]; -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/javascript/tracker/source/tracker.jsx
r7982 r7984 8 8 9 9 /** 10 * Courtesy: https://stackoverflow.com/a/3177838/1845153 11 * 12 * Converts unix seconds into human readable time. 13 * Looks like exact javascript convert of WordPress's human_time_diff, except this always compares from current time, instead of getting two arguments. 14 * 15 * @param {int} seconds Seconds ago to convert to human readable time 16 * 17 * @returns {string} Human readable time ago 10 * Custom render function for lastUpdatedColumn. Will display X time ago instead of unix timestamp. Use `humanizedTime` field sent from server. 18 11 */ 19 const timeSince = ( seconds ) => { 20 21 let interval = Math.floor ( seconds / 31536000 ); 22 23 if ( interval >= 1) { 24 return interval + " years"; 25 } 26 interval = Math.floor ( seconds / 2592000); 27 if ( interval >= 1 ) { 28 return interval + " months"; 29 } 30 interval = Math.floor ( seconds / 86400); 31 if ( interval >= 1 ) { 32 return interval + " days"; 33 } 34 interval = Math.floor ( seconds / 3600); 35 if ( interval >= 1 ) { 36 return interval + " hours"; 37 } 38 interval = Math.floor ( seconds / 60); 39 if ( interval >= 1 ) { 40 return interval + " minutes"; 41 } 42 return Math.floor ( seconds ) + " seconds"; 43 }; 44 45 /** 46 * Custom render function for lastUpdatedColumn. Will display X time ago instead of unix timestamp 47 */ 48 const renderHumanizeTime = ( time ) => { 49 return timeSince( time ) + " ago"; 12 const renderHumanizedTime = ( row ) => { 13 return row['humanizedTime']; 50 14 }; 51 15 … … 57 21 customRender = { 58 22 { 59 lastUpdate: renderHumanize Time23 lastUpdate: renderHumanizedTime 60 24 } 61 25 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-event/tracker.php
r7983 r7984 85 85 if ( 'wordcamp' === $application_type ) { 86 86 $events[] = array( 87 'city' => $post->post_title, 88 'cityUrl' => filter_var( get_post_meta( $post->ID, 'URL', true ), FILTER_VALIDATE_URL ), 89 'applicant' => esc_html( get_post_meta( $post->ID, 'Organizer Name', true ) ), 90 'milestone' => $milestones[ $post->post_status ], 91 'status' => $statuses[ $post->post_status ], 92 'lastUpdate' => time() - $last_update_timestamp, 87 'city' => $post->post_title, 88 'cityUrl' => filter_var( get_post_meta( $post->ID, 'URL', true ), FILTER_VALIDATE_URL ), 89 'applicant' => esc_html( get_post_meta( $post->ID, 'Organizer Name', true ) ), 90 'milestone' => $milestones[ $post->post_status ], 91 'status' => $statuses[ $post->post_status ], 92 'lastUpdate' => $last_update_timestamp, 93 'humanizedTime' => human_time_diff( $last_update_timestamp ), 93 94 ); 94 95 } elseif ( 'meetup' === $application_type ) { 95 96 $events[] = array( 96 'city' => $post->post_title, 97 'cityUrl' => filter_var( get_post_meta( $post->ID, 'Meetup URL', true ), FILTER_VALIDATE_URL ), 98 'applicant' => esc_html( get_post_meta( $post->ID, 'Organizer Name', true ) ), 99 'status' => $statuses[ $post->post_status ], 100 'lastUpdate' => time() - $last_update_timestamp, 97 'city' => $post->post_title, 98 'cityUrl' => filter_var( get_post_meta( $post->ID, 'Meetup URL', true ), FILTER_VALIDATE_URL ), 99 'applicant' => esc_html( get_post_meta( $post->ID, 'Organizer Name', true ) ), 100 'status' => $statuses[ $post->post_status ], 101 'lastUpdate' => $last_update_timestamp, 102 'humanizedTime' => human_time_diff( $last_update_timestamp ), 101 103 ); 102 104 }
Note: See TracChangeset
for help on using the changeset viewer.