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

Commit 625c00f

Browse files
authored
Merge pull request #1802 from OpenBazaar/setHandleInAppBar
Set Handle in AppBar Title
2 parents 329e883 + 2c5092e commit 625c00f

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

js/views/userPageVw.js

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ UserPageVw = pageVw.extend({
315315
// Handle was requested
316316
if (profile.handle) {
317317
window.obEventBus.trigger('handleObtained', profile);
318+
app.appBar.setTitle(profile.handle);
318319
}
319320
} else {
320321
//model was returned as a blank object
@@ -483,10 +484,9 @@ UserPageVw = pageVw.extend({
483484
},
484485

485486
setState: function(state, hash, options) {
486-
var currentAddress,
487+
var currentHandle = this.model.get('page').profile.handle,
487488
addressState,
488-
currentHandle = this.model.get('page').profile.handle,
489-
isItemType = false;
489+
currentAddress;
490490

491491
options = options || {};
492492

@@ -543,25 +543,16 @@ UserPageVw = pageVw.extend({
543543
}
544544

545545
if (state == "listing" || state == "listingOld" || state == "listingNew") {
546-
isItemType = true;
547-
}
548-
549-
//set address bar
550-
if (isItemType) {
551546
addressState = "/listing";
547+
addressState = hash ? addressState + "/" + hash : addressState;
552548
} else {
553549
addressState = "/" + state;
554550
}
555-
currentAddress = this.model.get('page').profile.guid + addressState;
556-
currentHandle = currentHandle ? currentHandle + addressState : "";
557-
if (isItemType && hash) {
558-
currentAddress += "/"+ hash;
559-
currentHandle = currentHandle ? currentHandle += "/"+ hash : "";
560-
} else if (addressState === "createStore"){
561-
currentAddress = this.model.get('page').profile.guid;
562-
}
563551

564-
window.obEventBus.trigger("setAddressBar", {'addressText': currentAddress, 'handle': currentHandle});
552+
currentAddress = currentHandle || this.model.get('page').profile.guid;
553+
currentAddress += addressState;
554+
555+
window.obEventBus.trigger("setAddressBar", {'addressText': currentAddress});
565556
},
566557

567558
setControls: function(state){

0 commit comments

Comments
 (0)