Skip to content
This repository was archived by the owner on Aug 14, 2018. It is now read-only.

Commit 7a88bc9

Browse files
committed
Retrieve newest activities first.
1 parent dfd5243 commit 7a88bc9

1 file changed

Lines changed: 71 additions & 70 deletions

File tree

src/experts-activities/experts-activity-list.html

Lines changed: 71 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@
6060
[hidden] {
6161
display: none !important;
6262
}
63-
.table {
64-
display: table;
63+
.table {
64+
display: table;
6565
width: 100%; }
6666
.tr { display: table-row; }
6767
.thead { display: table-header-group; }
@@ -155,7 +155,7 @@
155155
}
156156
.sorting {
157157
width: 18px;
158-
height: 18px;
158+
height: 18px;
159159
}
160160
</style>
161161
<!--
@@ -165,7 +165,7 @@
165165
-->
166166

167167

168-
<iron-ajax
168+
<iron-ajax
169169
id = "activityListRequest"
170170
method = "GET"
171171
url = "https://elite-firefly-737.appspot.com/_ah/api/expertstracking/v2.0/activityMaster/activityMaster?limit=100"
@@ -179,7 +179,7 @@
179179
last-response = "{{_apiActivityMasterDelete}}"
180180
on-response = "_handleActivityMasterDelete"></iron-ajax>
181181

182-
<experts-activity-edit
182+
<experts-activity-edit
183183
id = "activityEdit"
184184
activity-groups = "{{activityGroups}}"
185185
product-groups = "{{productGroups}}"
@@ -192,122 +192,122 @@
192192

193193
<div class="table">
194194
<div class="thead">
195-
<div
196-
class$="th col1 [[_cssColumnSortStatus('activityName',_sortTerm)]]"
195+
<div
196+
class$="th col1 [[_cssColumnSortStatus('activityName',_sortTerm)]]"
197197
name="activityName"
198198
on-tap="_sortBy">
199199
<div class="horizontal">
200200
<div>
201201
<template is="dom-if" if="[[_columnSortStatus('activityName',_sortTerm, _sortReverse)]]">
202202
<iron-icon class="sorting" icon="arrow-upward"></iron-icon>
203-
</template>
203+
</template>
204204
<template is="dom-if" if="[[_columnReverseSortStatus('activityName',_sortTerm, _sortReverse)]]">
205205
<iron-icon class="sorting" icon="arrow-downward"></iron-icon>
206-
</template>
206+
</template>
207207
</div>
208208
<div>
209-
Activity name
209+
Activity name
210210
</div>
211211
</div>
212-
</div>
213-
<div
214-
class$="th col2 [[_cssColumnSortStatus('date',_sortTerm)]]"
215-
name="date"
212+
</div>
213+
<div
214+
class$="th col2 [[_cssColumnSortStatus('date',_sortTerm)]]"
215+
name="date"
216216
on-tap="_sortBy">
217217
<div class="horizontal">
218218
<div>
219219
<template is="dom-if" if="[[_columnSortStatus('date',_sortTerm, _sortReverse)]]">
220220
<iron-icon class="sorting" icon="arrow-upward"></iron-icon>
221-
</template>
221+
</template>
222222
<template is="dom-if" if="[[_columnReverseSortStatus('date',_sortTerm, _sortReverse)]]">
223223
<iron-icon class="sorting" icon="arrow-downward"></iron-icon>
224-
</template>
224+
</template>
225225
</div>
226-
<div>
226+
<div>
227227
Date
228228
</div>
229229
</div>
230-
</div>
231-
<div
232-
class$="th col3 [[_cssColumnSortStatus('type',_sortTerm)]]"
233-
name="type"
230+
</div>
231+
<div
232+
class$="th col3 [[_cssColumnSortStatus('type',_sortTerm)]]"
233+
name="type"
234234
on-tap="_sortBy">
235235
<div class="horizontal">
236236
<div>
237237
<template is="dom-if" if="[[_columnSortStatus('type',_sortTerm, _sortReverse)]]">
238238
<iron-icon class="sorting" icon="arrow-upward"></iron-icon>
239-
</template>
239+
</template>
240240
<template is="dom-if" if="[[_columnReverseSortStatus('type',_sortTerm, _sortReverse)]]">
241241
<iron-icon class="sorting" icon="arrow-downward"></iron-icon>
242-
</template>
242+
</template>
243243
</div>
244-
<div>
244+
<div>
245245
Type
246246
</div>
247247
</div>
248-
</div>
249-
<div
250-
class$="th col4 [[_cssColumnSortStatus('directReach',_sortTerm)]]"
251-
name="directReach"
248+
</div>
249+
<div
250+
class$="th col4 [[_cssColumnSortStatus('directReach',_sortTerm)]]"
251+
name="directReach"
252252
on-tap="_sortBy">
253253
<div class="horizontal">
254254
<div>
255255
<template is="dom-if" if="[[_columnSortStatus('directReach',_sortTerm, _sortReverse)]]">
256256
<iron-icon class="sorting" icon="arrow-upward"></iron-icon>
257-
</template>
257+
</template>
258258
<template is="dom-if" if="[[_columnReverseSortStatus('directReach',_sortTerm, _sortReverse)]]">
259259
<iron-icon class="sorting" icon="arrow-downward"></iron-icon>
260-
</template>
260+
</template>
261261
</div>
262-
<div>
262+
<div>
263263
Direct reach
264264
</div>
265265
</div>
266-
</div>
267-
<div
268-
class$="th col5 [[_cssColumnSortStatus('trained',_sortTerm)]]"
269-
name="trained"
266+
</div>
267+
<div
268+
class$="th col5 [[_cssColumnSortStatus('trained',_sortTerm)]]"
269+
name="trained"
270270
on-tap="_sortBy">
271271
<div class="horizontal">
272272
<div>
273273
<template is="dom-if" if="[[_columnSortStatus('trained',_sortTerm, _sortReverse)]]">
274274
<iron-icon class="sorting" icon="arrow-upward"></iron-icon>
275-
</template>
275+
</template>
276276
<template is="dom-if" if="[[_columnReverseSortStatus('trained',_sortTerm, _sortReverse)]]">
277277
<iron-icon class="sorting" icon="arrow-downward"></iron-icon>
278-
</template>
278+
</template>
279279
</div>
280-
<div>
280+
<div>
281281
Trained
282282
</div>
283283
</div>
284-
</div>
285-
<div
286-
class$="th col6 [[_cssColumnSortStatus('indirectReach',_sortTerm)]]"
287-
name="indirectReach"
284+
</div>
285+
<div
286+
class$="th col6 [[_cssColumnSortStatus('indirectReach',_sortTerm)]]"
287+
name="indirectReach"
288288
on-tap="_sortBy">
289289
<div class="horizontal">
290290
<div>
291291
<template is="dom-if" if="[[_columnSortStatus('indirectReach',_sortTerm, _sortReverse)]]">
292292
<iron-icon class="sorting" icon="arrow-upward"></iron-icon>
293-
</template>
293+
</template>
294294
<template is="dom-if" if="[[_columnReverseSortStatus('indirectReach',_sortTerm, _sortReverse)]]">
295295
<iron-icon class="sorting" icon="arrow-downward"></iron-icon>
296-
</template>
296+
</template>
297297
</div>
298-
<div>
298+
<div>
299299
Indirect reach
300300
</div>
301301
</div>
302-
</div>
302+
</div>
303303
<div class="th col7"></div>
304304
</div>
305305
<div class="tbody">
306-
<template
306+
<template
307307
id="activityList"
308-
is="dom-repeat"
309-
items="{{activities}}"
310-
as="activity"
308+
is="dom-repeat"
309+
items="{{activities}}"
310+
as="activity"
311311
sort="[[_computeSort(_sortTerm, _sortReverse)]]">
312312
<div class="tr" id="r-{{activity.id}}">
313313
<div class="td col1 action" on-tap="_doActivityEdit" title="Edit this Activity">{{activity.title}}</div>
@@ -372,27 +372,27 @@ <h2>Sorry Human, I can't do that.</h2>
372372
observer: "_userChanged",
373373
value: null
374374
},
375-
375+
376376
productGroups: {
377377
type: Array,
378378
value: function() {
379379
return [];
380380
}
381-
},
381+
},
382382
activityGroups: {
383383
type: 'array',
384384
notify: true,
385-
value: function(){
385+
value: function(){
386386
return [];
387387
},
388-
},
388+
},
389389

390390
_activityTypes: {
391391
type: Array,
392392
value: function() {
393393
return [];
394394
}
395-
},
395+
},
396396
_sortTerm: {
397397
type: String,
398398
value: "date"
@@ -410,21 +410,21 @@ <h2>Sorry Human, I can't do that.</h2>
410410

411411
ready: function() {
412412
/*
413-
* Attaching dialog to main body to make it live over the gray div
414-
* Bug that will be corrected
413+
* Attaching dialog to main body to make it live over the gray div
414+
* Bug that will be corrected
415415
* https://github.com/PolymerElements/polymer-starter-kit/issues/154
416416
* https://github.com/PolymerElements/paper-dialog/issues/7
417417
*/
418-
this.activityEdit = this.$.activityEdit
418+
this.activityEdit = this.$.activityEdit
419419
document.querySelector('body').appendChild(this.activityEdit);
420420

421-
this.deleteActivityConfirm = this.$.deleteActivityConfirm
421+
this.deleteActivityConfirm = this.$.deleteActivityConfirm
422422
document.querySelector('body').appendChild(this.deleteActivityConfirm);
423423
},
424424

425425

426426
// *******************************************************************************************
427-
// Observers
427+
// Observers
428428
// *******************************************************************************************
429429

430430
_userChanged: function(){
@@ -438,7 +438,7 @@ <h2>Sorry Human, I can't do that.</h2>
438438
},
439439

440440

441-
441+
442442
// *******************************************************************************************
443443
// Event listener
444444
// *******************************************************************************************
@@ -471,7 +471,7 @@ <h2>Sorry Human, I can't do that.</h2>
471471

472472
// pop up the modal confirm window
473473
this.$.deleteActivityConfirm.open();
474-
},
474+
},
475475

476476

477477
_deleteActitityMasterConfirmed: function() {
@@ -498,7 +498,7 @@ <h2>Sorry Human, I can't do that.</h2>
498498
// fast reset
499499
this.activityToDelete = null;
500500
this.deleteActivityTitle = '';
501-
501+
502502
} else {
503503

504504
// That did not go right; pop the error window
@@ -515,7 +515,7 @@ <h2>Sorry Human, I can't do that.</h2>
515515
} else {
516516
this._sortTerm = columnName;
517517
this._sortReverse = false;
518-
}
518+
}
519519
},
520520

521521
// *******************************************************************************************
@@ -528,7 +528,8 @@ <h2>Sorry Human, I can't do that.</h2>
528528
generateActivityListRequest: function() {
529529
var request = this.$.activityListRequest;
530530
request.params = {
531-
email: this.user.email
531+
email: this.user.email,
532+
order: '-date'
532533
}
533534
request.generateRequest();
534535
},
@@ -556,7 +557,7 @@ <h2>Sorry Human, I can't do that.</h2>
556557
// console.debug("[experts-activities] activityEdit", this.activityEdit)
557558
this.activityEdit.open();
558559
},
559-
560+
560561

561562
_cssColumnSortStatus: function(columnName, sortTerm) {
562563
if (columnName != sortTerm) {
@@ -568,14 +569,14 @@ <h2>Sorry Human, I can't do that.</h2>
568569
_columnSortStatus: function(columnName, sortTerm, sortReverse) {
569570
if (columnName != sortTerm || sortReverse) {
570571
return false;
571-
}
572+
}
572573
return true;
573574
},
574575

575576
_columnReverseSortStatus: function(columnName, sortTerm, sortReverse) {
576577
if (columnName != sortTerm || !sortReverse) {
577578
return false;
578-
}
579+
}
579580
return true;
580581
},
581582

@@ -593,7 +594,7 @@ <h2>Sorry Human, I can't do that.</h2>
593594

594595
if (itemA[prop[sortTerm]] === itemB[prop[sortTerm]] ) {
595596
return 0;
596-
}
597+
}
597598
if (sortReverse) {
598599
if (itemA[prop[sortTerm]] < itemB[prop[sortTerm]] ) {
599600
return 1;
@@ -604,7 +605,7 @@ <h2>Sorry Human, I can't do that.</h2>
604605
if (itemA[prop[sortTerm]] < itemB[prop[sortTerm]] ) {
605606
return -1;
606607
}
607-
return 1;
608+
return 1;
608609
}
609610
},
610611

0 commit comments

Comments
 (0)