diff --git a/app.js b/app.js index 1bb13b4..4cc291f 100644 --- a/app.js +++ b/app.js @@ -363,19 +363,19 @@ define(function(require){ formatInboundData: function(data) { var self = this, - formattedFaxes = self.formatFaxes(data); + formattedFaxes = self.formatFaxes(data, 'inbound'); return formattedFaxes; }, formatOutboundData: function(data) { var self = this, - formattedFaxes = self.formatFaxes(data); + formattedFaxes = self.formatFaxes(data, 'outbound'); return formattedFaxes; }, - formatFaxes: function(data) { + formatFaxes: function(data, type) { var self = this; _.each(data, function(fax) { @@ -394,16 +394,17 @@ define(function(require){ fax.formatted.sendingFaxbox = self.appFlags.faxboxes.hasOwnProperty(fax.faxbox_id) ? self.appFlags.faxboxes[fax.faxbox_id].name : '-'; fax.formatted.sendingNumber = monster.util.formatPhoneNumber(fax.from_number); fax.formatted.pages = details.hasOwnProperty('total_pages') ? details.total_pages : self.i18n.active().fax.table.noData; - fax.formatted.uri = self.formatFaxURI(fax.id); + fax.formatted.uri = self.formatFaxURI(fax.id, type); }); return data; }, - formatFaxURI: function(mediaId) { - var self = this; + formatFaxURI: function(mediaId, pType) { + var self = this, + type = pType === 'inbound' ? 'inbox' : 'outbox'; - return self.apiUrl + 'accounts/' + self.accountId + '/faxes/' + mediaId + '/attachments?auth_token=' + self.authToken; + return self.apiUrl + 'accounts/' + self.accountId + '/faxes/'+ type +'/' + mediaId + '/attachment?auth_token=' + self.authToken; }, getInboundFaxes: function(fromDate, toDate, callback) { @@ -465,8 +466,8 @@ define(function(require){ getFaxDetails: function(type, faxId, callback) { var self = this, - resourceName = 'faxes.' + (type === 'inbound' ? 'getAttachmentInbound' : 'getAttachmentOutbound'); - //resourceName = 'faxes.' + (type === 'inbound' ? 'getDetailsInbound' : 'getDetailsOutbound'); + //resourceName = 'faxes.' + (type === 'inbound' ? 'getAttachmentInbound' : 'getAttachmentOutbound'); + resourceName = 'faxes.' + (type === 'inbound' ? 'getDetailsInbound' : 'getDetailsOutbound'); self.callApi({ resource: resourceName, diff --git a/views/inbound-faxes-list.html b/views/inbound-faxes-list.html index 73ecaa1..38b71c6 100644 --- a/views/inbound-faxes-list.html +++ b/views/inbound-faxes-list.html @@ -26,10 +26,10 @@ {{formatted.sendingNumber}} {{formatted.pages}} - + + diff --git a/views/outbound-faxes-list.html b/views/outbound-faxes-list.html index c63e28d..610bf2a 100644 --- a/views/outbound-faxes-list.html +++ b/views/outbound-faxes-list.html @@ -30,10 +30,10 @@ {{formatted.receivingNumber}} {{formatted.pages}} - + +