Changeset 7472
- Timestamp:
- 07/17/2018 07:24:58 PM (6 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-attendance/addons
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-attendance/addons/assets/attendance-ui.js
r7454 r7472 15 15 defaults: function() { 16 16 return { 17 id: null, 17 18 status: false, 19 sort: 'firstName', 18 20 avatar: '', 19 name: '', 21 firstName: '', 22 lastName: '' 20 23 } 21 24 }, … … 163 166 */ 164 167 render: function() { 165 this.$el.html( this.template( this.model.toJSON() ) ); 168 var attendeeData = _.extend( this.model.toJSON(), { sort: this.controller.filterSettings.sort } ); 169 this.$el.html( this.template( attendeeData ) ); 166 170 return this; 167 171 }, … … 316 320 events: { 317 321 'fastClick .close': 'close', 322 'fastClick .filter-sort li': 'toggleSort', 318 323 'fastClick .filter-attendance li': 'toggleAttendance', 319 324 'fastClick .filter-tickets li': 'toggleTickets' … … 367 372 this.controller.trigger( 'filter', this.filterSettings ); 368 373 }, 374 375 /** 376 * Toggle sort order for tickets list 377 */ 378 toggleSort: function( event ) { 379 var sortOrder = $( event.target ).data( 'sort' ); 380 this.filterSettings.sort = sortOrder; 381 this.render(); 382 383 this.controller.trigger( 'filter', this.filterSettings ); 384 } 369 385 }); 370 386 … … 381 397 'fastClick .dashicons-menu': 'menu', 382 398 'fastClick .submenu .search': 'searchView', 399 'fastClick .submenu .sort': 'sortView', 383 400 'fastClick .submenu .refresh': 'refresh', 384 401 'fastClick .submenu .filter': 'filterView' … … 397 414 'attendance': 'none', 398 415 'tickets': _camptixAttendanceTickets, 399 'search': '' 416 'search': '', 417 'sort': 'firstName' 400 418 }; 401 419 … … 433 451 434 452 // Dispose of the current collection and cache it for later use. 435 if ( 'undefined' != typeof this.collection ) {453 if ( 'undefined' !== typeof this.collection ) { 436 454 this.collection.off( null, null, this ); 437 455 this.cache.push( this.collection ); -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-attendance/addons/attendance-ui.php
r919 r7472 20 20 </script> 21 21 22 <meta name="viewport" content="width=device-width ; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />22 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" /> 23 23 <meta name="referrer" content="never" /> 24 24 </head> … … 27 27 <div class="spinner-container"><span class="spinner"></span></div> 28 28 <a href="#" class="status toggle <# if ( data.status ) { #> yes <# } #>"><div class="dashicons dashicons-admin-users"></div></a> 29 29 30 <span class="name"> 30 {{ data.name }} 31 <# if ( 'lastName' == data.sort ) { #> 32 {{ data.lastName }}, {{ data.firstName }} 33 <# } else { #> 34 {{ data.firstName }} {{ data.lastName }} 35 <# } #> 31 36 </span> 32 37 </script> … … 34 39 <script id="tmpl-attendee-toggle" type="text/template"> 35 40 <img src="{{ data.avatar }}" /> 36 <p>Did <strong>{{ data. name }}</strong> attend <?php echo esc_html( $camptix_options['event_name'] ); ?>?</p>41 <p>Did <strong>{{ data.firstName }} {{ data.lastName }}</strong> attend <?php echo esc_html( $camptix_options['event_name'] ); ?>?</p> 37 42 38 43 <div class="yes-no-container"> … … 52 57 <div class="submenu"> 53 58 <a href="#" class="search">Search</a> 54 <a href="#" class="filter"> Filter</a>59 <a href="#" class="filter">Sort & Filter</a> 55 60 <a href="#" class="refresh">Refresh</a> 56 61 </div> … … 79 84 <a href="#" class="close dashicons dashicons-no"></a> 80 85 <div class="wrapper"> 81 <h1>Filters</h1> 86 <h1>Sort & Filter</h1> 87 88 <h1 class="section-title">Sort Attendees By</h1> 89 <ul class="filter-sort section-controls"> 90 <li data-sort="firstName" <# if ( data.sort == 'firstName' ) { #> class="selected" <# } #> >First Name</li> 91 <li data-sort="lastName" <# if ( data.sort == 'lastName' ) { #> class="selected" <# } #> >Last Name</li> 92 <li data-sort="orderDate" <# if ( data.sort == 'orderDate' ) { #> class="selected" <# } #> >Order Date</li> 93 </ul> 82 94 83 95 <h1 class="section-title">Attendance</h1> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/camptix-attendance/addons/attendance.php
r5531 r7472 71 71 72 72 /** 73 * Synchronize a nattendee model.73 * Synchronize a single attendee model. 74 74 * 75 75 * Sets are removes the attended flag for a given camptix_id. … … 114 114 115 115 $query_args = array( 116 'post_type' => 'tix_attendee',117 'post_status' => 'publish',118 'orderby' => 'title',119 'order' => 'ASC',120 'paged' => $paged,116 'post_type' => 'tix_attendee', 117 'post_status' => 'publish', 118 'orderby' => 'title', 119 'order' => 'ASC', 120 'paged' => $paged, 121 121 'posts_per_page' => 50, 122 'meta_query' => '',122 'meta_query' => '', 123 123 ); 124 125 /** 126 * Sort Attendee Posts 127 */ 128 if ( ! empty( $_REQUEST['camptix_filters']['sort'] ) ) { 129 switch ( $_REQUEST['camptix_filters']['sort'] ) { 130 case 'lastName': 131 $query_args['orderby'] = 'meta_value'; 132 $query_args['meta_key'] = 'tix_last_name'; 133 break; 134 case 'orderDate': 135 $query_args['orderby'] = 'date'; 136 $query_args['order'] = 'DESC'; 137 break; 138 case 'firstName': 139 default: 140 // each $attendee->post_title is already First Lastname 141 break; 142 } 143 144 unset( $_REQUEST['camptix_filters']['sort'] ); 145 } 124 146 125 147 $filters = array(); … … 174 196 175 197 $first_name = get_post_meta( $attendee->ID, 'tix_first_name', true ); 176 $last_name = get_post_meta( $attendee->ID, 'tix_last_name', true );198 $last_name = get_post_meta( $attendee->ID, 'tix_last_name', true ); 177 199 $avatar_url = sprintf( 'https://secure.gravatar.com/avatar/%s?s=160', md5( get_post_meta( $attendee->ID, 'tix_email', true ) ) ); 178 200 $avatar_url = add_query_arg( 'd', 'https://secure.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s=160', $avatar_url ); … … 182 204 return array( 183 205 'id' => $attendee->ID, 184 'name' => sprintf( '%s %s', $first_name, $last_name ), 206 'firstName' => $first_name, 207 'lastName' => $last_name, 185 208 'avatar' => esc_url_raw( $avatar_url ), 186 209 'status' => $status, … … 250 273 public function setup_sections( $sections ) { 251 274 $sections['attendance-ui'] = esc_html__( 'Attendance UI', 'wordcamporg' ); 275 252 276 return $sections; 253 277 } … … 314 338 315 339 /** 316 * Get CampTix Tickets 340 * Get CampTix Tickets (not to be confused with Attendees) 317 341 * 318 342 * Returns an array of published tickets registered with CampTix.
Note: See TracChangeset
for help on using the changeset viewer.