Skip to content

Commit

Permalink
UI-2415: no longer list voicemails with the date filter by default
Browse files Browse the repository at this point in the history
  • Loading branch information
JRMaitre committed Oct 4, 2016
1 parent 29b6856 commit c6af967
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 15 deletions.
21 changes: 14 additions & 7 deletions app.js
Expand Up @@ -16,7 +16,7 @@ define(function(require){
appFlags: {
voicemails: {
maxRange: 31,
defaultRange: 7
defaultRange: 1
}
},

Expand Down Expand Up @@ -103,6 +103,10 @@ define(function(require){

self.displayVMList(parent, vmboxId);
});

template.find('.toggle-filter').on('click', function() {
template.find('.filter-by-date').toggleClass('active');
});
},

bindReceivedVMs: function(template) {
Expand Down Expand Up @@ -337,10 +341,11 @@ define(function(require){
});
},

displayVMList: function(container, vmboxId, fromDate, toDate) {
displayVMList: function(container, vmboxId) {
var self = this,
fromDate = container.find('input.filter-from').datepicker('getDate'),
toDate = container.find('input.filter-to').datepicker('getDate');
toDate = container.find('input.filter-to').datepicker('getDate'),
filterByDate = container.find('.filter-by-date').hasClass('active');

container.removeClass('empty');

Expand All @@ -357,10 +362,12 @@ define(function(require){

monster.ui.footable(container.find('.voicemails-table .footable'), {
getData: function(filters, callback) {
filters = $.extend(true, filters, {
created_from: monster.util.dateToBeginningOfGregorianDay(fromDate),
created_to: monster.util.dateToEndOfGregorianDay(toDate),
});
if(filterByDate) {
filters = $.extend(true, filters, {
created_from: monster.util.dateToBeginningOfGregorianDay(fromDate),
created_to: monster.util.dateToEndOfGregorianDay(toDate),
});
}
// we do this to keep context
self.voicemailsGetRows(filters, vmboxId, callback);
},
Expand Down
1 change: 1 addition & 0 deletions i18n/en-US.json
Expand Up @@ -5,6 +5,7 @@
"receivedVMs": "Received Voicemails"
},
"receivedVMs": {
"filterByDate": "Filter by Dates",
"table": {
"columns": {
"status": "Status",
Expand Down
22 changes: 20 additions & 2 deletions style/app.css
Expand Up @@ -209,10 +209,10 @@
}


.received-voicemails-container .date-ranges {
/*.received-voicemails-container .date-ranges {
float: right;
margin-left: 60px;
}
}*/

.received-voicemails-container .date-ranges > * {
margin: 0 10px 0 0;
Expand All @@ -228,6 +228,24 @@
width: 80px;
}

.received-voicemails-container .filter-by-date {
float: right;
line-height: 30px;
margin-left: 30px;
}

.received-voicemails-container .filter-by-date.active .expand-dates {
float: right;
}

.received-voicemails-container .filter-by-date .date-ranges,
.received-voicemails-container .filter-by-date.active .expand-dates {
display: none;
}

.received-voicemails-container .filter-by-date.active .date-ranges {
display: block;
}

/* CDR Popup */
#voicemails_cdr_details_dialog {
Expand Down
18 changes: 12 additions & 6 deletions views/received-voicemails.html
Expand Up @@ -63,12 +63,18 @@
</button>
</div>

<div class="date-ranges">
<span>{{i18n.startDate}}</span>
<input id="startDate" type="text" class="date-filter filter-from">
<span>{{i18n.endDate}}</span>
<input id="endDate" type="text" class="date-filter filter-to">
<button type="button" class="apply-filter monster-button monster-button-primary">{{i18n.filter}}</button>
<div class="filter-by-date">
<div class="expand-dates">
<a class="monster-link blue toggle-filter">{{ i18n.voicemails.receivedVMs.filterByDate }}</a>
</div>
<div class="date-ranges">
<span>{{i18n.startDate}}</span>
<input id="startDate" type="text" class="date-filter filter-from">
<span>{{i18n.endDate}}</span>
<input id="endDate" type="text" class="date-filter filter-to">
<button type="button" class="apply-filter monster-button monster-button-primary">{{i18n.filter}}</button>
<a class="monster-link blue toggle-filter">{{i18n.cancel}}</a>
</div>
</div>
</div>

Expand Down

0 comments on commit c6af967

Please sign in to comment.