Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit 7351a1c

Browse files
committed
Finish
Closes #1538
1 parent edb0eb9 commit 7351a1c

File tree

7 files changed

+33
-37
lines changed

7 files changed

+33
-37
lines changed

css/obBase.css

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3381,7 +3381,7 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
33813381
opacity: 1;
33823382
}
33833383

3384-
.notificationUnreadIndicator {
3384+
.highlightRow {
33853385
position: absolute;
33863386
left: 0;
33873387
top: 0;
@@ -4397,6 +4397,18 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
43974397
background: red;
43984398
}
43994399

4400+
.pill.tabPill {
4401+
position: relative;
4402+
display: inline-block;
4403+
min-width: 0;
4404+
line-height: normal;
4405+
}
4406+
4407+
.pill.tabPill .badge:after {
4408+
right: -12px;
4409+
top: -8px;
4410+
}
4411+
44004412
.selectPill {
44014413
opacity: .75;
44024414
transition: opacity .2s cubic-bezier(0, 0, 0.2, 1);

js/templates/notification.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<div class="rowItem js-notification padding10 clickable positionRelative">
22
<% if (!ob.read) { %>
3-
<div class="notificationUnreadIndicator"></div>
3+
<div class="highlightRow"></div>
44
<% } %>
55
<div class="table">
66
<div>
7-
<% console.log(ob.type) %>
87
<div class="thumbnail clickable custcol-border"
98
style="background-image: <%= ob.cssImageUrl(ob.image_hash, ob.guid, 'imgs/defaultUser.png') %>; height: 50px; width: 50px"></div>
109
<div class="txt-lowleading">

js/templates/orderShort.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<div class="width100 cursorDefault">
1+
<div class="width100 cursorDefault positionWrapper">
2+
<% if (ob.unread) { %>
3+
<div class="highlightRow"></div>
4+
<% } %>
25
<div class="rowItem padding20">
36
<div class="flexRow">
47
<div class="width100">

js/templates/transactionModal.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,10 @@ <h3 class="txt-bright"><%= polyglot.t('CheckExchanges') %> </h3>
572572
<a class="btn btn-bar btn-tab custCol-secondary fontSize13 js-tab js-discussionTab paddingRight18 positionWrapper" data-tab="discussion">
573573
<span class="ion-chatbubbles fontSize11 marginRight2 textOpacity1"></span>
574574
<%= polyglot.t('Discussion') %>
575-
<span class="pill fontSize12 textOpacity75 marginLeft2 js-discussionCount">0</span>
576-
<div class="badge js-unreadBadge" data-count="<%= ob.unread || 0 %>"></div>
575+
<div class="pill fontSize12 textOpacity75 marginLeft2 tabPill">
576+
<div class="badge js-unreadBadge <% if(!ob.unread){%>hide<%}%>" data-count="<%= ob.unread || 0 %>"></div>
577+
<span class="js-discussionCount">0</span>
578+
</div>
577579
</a>
578580
</div>
579581

js/views/orderShortVw.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ module.exports = baseVw.extend({
3535
},
3636

3737
openOrderModal: function(tabState){
38-
console.log("open")
3938
window.obEventBus.trigger("openOrderModal", {
4039
'orderID': this.model.get('order_id'),
4140
'status': this.model.get('status'),
4241
'transactionType': this.model.get('transactionType'),
4342
'unread': this.model.get('unread'),
4443
'tabState': tabState
4544
});
45+
this.$('.js-unreadBadge').addClass('hide');
4646
},
4747

4848
orderSummary: function(e){

js/views/transactionModalVw.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ module.exports = baseVw.extend({
281281

282282
if(state == "discussion"){
283283
$.post(app.serverConfigs.getActive().getServerBaseUrl() + '/mark_discussion_as_read', {id: this.orderID});
284+
this.$('.js-unreadBadge').addClass('hide');
284285
}
285286

286287
if(state == "discussion" && this.discussionScroller){

js/views/transactionsVw.js

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ module.exports = baseVw.extend({
9595

9696
this.purchasesCol.fetch({
9797
success: function(models){
98-
//self.renderPurchases();
9998
self.renderTab("purchases", self.purchasesCol, self.purchasesWrapper);
10099
models.length && self.setSearchList('transactionsPurchases');
101100
self.salesCol.fetch({
@@ -106,7 +105,6 @@ module.exports = baseVw.extend({
106105
}
107106
self.casesCol.fetch({
108107
success: function(models) {
109-
//self.renderCases();
110108
self.renderTab("cases", self.casesCol, self.casesWrapper);
111109
models.length && self.setSearchList('transactionsCases');
112110
},
@@ -165,38 +163,12 @@ module.exports = baseVw.extend({
165163
});
166164
},
167165

168-
findOrderByID: function(orderID){
169-
var orderModelP = this.purchasesCol.findWhere({ order_id: this.orderID}),
170-
orderModelS = this.salesCol.findWhere({ order_id: this.orderID}),
171-
orderModelC = this.casesCol.findWhere({ order_id: this.orderID}),
172-
orderModel = orderModelP || orderModelS || orderModelC;
173-
174-
if(orderModelP){
175-
tType = "purchases";
176-
self.setState('purchases', self.orderID)
177-
} else if(orderModelS){
178-
tType = "sales";
179-
self.setState('sales', self.orderID)
180-
} else if(orderModelC){
181-
tType = "cases";
182-
self.setState('cases', self.orderID)
183-
}
184-
185-
//don't forget to make this part work to get the model when the socket message comes in
186-
return orderModel;
187-
},
188-
189166
handleSocketMessage: function(response) {
190167
var data = JSON.parse(response.data);
191168
if(data.notification && data.notification.order_id){
192169
this.getData();
193170
} else if(data.message && data.message.subject){
194-
//increment the unread count of the order with the message
195-
var orderShortDiscBtn = this.$('.js-orderShortDiscusson[data-order="'+ data.message.subject +'"]');
196-
var orderShortDiscBtnBadge = orderShortDiscBtn.find('.js-unreadBadge');
197-
orderShortDiscBtn.removeClass('hide');
198-
var newCount = Number(orderShortDiscBtnBadge.attr('data-count')) +1;
199-
orderShortDiscBtnBadge.attr('data-count', newCount);
171+
this.getData();
200172
}
201173
},
202174

@@ -280,7 +252,14 @@ module.exports = baseVw.extend({
280252
var self = this;
281253
filterBy = filterBy || this.filterBy;
282254
tabWrapper.html('');
283-
if(!filterBy || filterBy == "all" || filterBy == "dateNewest"){
255+
if(!filterBy || filterBy == "all"){
256+
tabCollection.comparator = function(model) {
257+
//add 1 so unread:zero doesn't get dropped from the front of the string when it's changed to a number by the -
258+
return -(String(model.get("unread")+1) + String(model.get("timestamp")));
259+
};
260+
tabCollection.sort();
261+
}
262+
if(filterBy == "dateNewest"){
284263
tabCollection.comparator = function(model) {
285264
return -model.get("timestamp");
286265
};

0 commit comments

Comments
 (0)