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

Commit dc5cb32

Browse files
committed
Merge pull request #1583 from OpenBazaar/pr/1555
Pr/1555
2 parents b486859 + 1b13560 commit dc5cb32

File tree

7 files changed

+80
-23
lines changed

7 files changed

+80
-23
lines changed

css/obBase.css

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ form {
218218
top: 6px;
219219
}
220220

221-
html:not(.platform-mac) #appBar .windowControls {
221+
#appBar.style-win .windowControls {
222222
left: auto;
223223
right: 8px;
224224
top: 5px;
@@ -2043,27 +2043,27 @@ margin: auto;
20432043
position: relative;
20442044
}
20452045

2046-
html:not(.platform-mac) .btn.btn-win {
2046+
#appBar.style-win .btn.btn-win {
20472047
background-color: transparent;
20482048
border-radius: 0;
20492049
width: 19px;
20502050
height: 19px;
20512051
box-shadow: none;
20522052
}
20532053

2054-
html:not(.platform-mac) .btn.btn-winClose {
2054+
#appBar.style-win .btn.btn-winClose {
20552055
float: right;
20562056
margin-left: 6px;
20572057
}
20582058

2059-
html:not(.platform-mac) .btn.btn-win .btn-win-icon {
2059+
#appBar.style-win .btn.btn-win .btn-win-icon {
20602060
display: block;
20612061
top: -3px;
20622062
font-size: 21px;
20632063
color: #fff;
20642064
}
20652065

2066-
html:not(.platform-mac) .btn.btn-winMax {
2066+
#appBar.style-win .btn.btn-winMax {
20672067
float: right;
20682068
margin-left: 6px;
20692069
border: 1px solid #fff;
@@ -2072,8 +2072,8 @@ html:not(.platform-mac) .btn.btn-winMax {
20722072
top: 3px;
20732073
}
20742074

2075-
html:not(.platform-mac) .btn.btn-winMax .btn-win-icon,
2076-
html:not(.platform-mac) .btn.btn-win.btn-winMax:hover .btn-win-icon {
2075+
#appBar.style-win .btn.btn-winMax .btn-win-icon,
2076+
#appBar.style-win .btn.btn-win.btn-winMax:hover .btn-win-icon {
20772077
display: none;
20782078
}
20792079

js/languages/en-US.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,10 @@
348348
"Avatar": "Avatar",
349349
"AdditionalPaymentData": "Additional payment data",
350350
"AdditionalPaymentDataInfo": "Include name of purchase and order number in payment QR code?",
351+
"AppBarStyle": "Application Top Bar Style",
352+
"AppBarStyleInfo": "How should the top bar of the application be styled?",
353+
"OSWindows": "Windows",
354+
"OSMac": "Mac",
351355
"ShippableHelp": "This product can be shipped to one of your currently saved addresses. Add more addresses in the Settings/Addresses section to be able to purchase more listings.",
352356
"firewall": {
353357
"Open": "Open",

js/templates/appBar.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<div class="windowControls ctrlGroup">
2-
<a class="btn btn-win btn-winClose js-navClose tooltip <% ob.platform !== 'darwin' && print('tooltip-left') %>" data-tooltip="<% print(polyglot.t(ob.launchedFromInstaller ? 'ClosingOpenBazaar' : 'ClosingOpenBazaarNonInstaller')) %>">
2+
<a class="btn btn-win btn-winClose js-navClose tooltip <% ob.style !== 'mac' && print('tooltip-left') %>" data-tooltip="<% print(polyglot.t(ob.launchedFromInstaller ? 'ClosingOpenBazaar' : 'ClosingOpenBazaarNonInstaller')) %>">
33
<div class="btn-win-icon ion-ios-close-empty"></div>
44
</a>
5-
<a class="btn btn-win btn-winMin js-navMin tooltip <% ob.platform !== 'darwin' && print('tooltip-left') %>" data-tooltip="<%= window.polyglot.t('Minimize') %>">
5+
<a class="btn btn-win btn-winMin js-navMin tooltip <% ob.style !== 'mac' && print('tooltip-left') %>" data-tooltip="<%= polyglot.t('Minimize') %>">
66
<div class="btn-win-icon ion-ios-minus-empty"></div>
77
</a>
8-
<a class="btn btn-win btn-winMax js-navMax tooltip <% ob.platform !== 'darwin' && print('tooltip-left') %>" data-tooltip="<%= window.polyglot.t('Maximize') %>">
8+
<a class="btn btn-win btn-winMax js-navMax tooltip <% ob.style !== 'mac' && print('tooltip-left') %>" data-tooltip="<%= polyglot.t('Maximize') %>">
99
<div class="btn-win-icon ion-ios-plus-empty"></div>
1010
</a>
1111
</div>

js/templates/settings.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,26 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Advanced') %></h3>
12391239
</div>
12401240
</div>
12411241

1242+
<div class="flexRow">
1243+
<div class="flexCol-3 borderRight custCol-border">
1244+
<div class="fieldItem">
1245+
<label>
1246+
<%= polyglot.t('AppBarStyle') %>
1247+
</label>
1248+
<i class="ion-help-circled tooltip tooltip-box" data-tooltip="<%= polyglot.t('AppBarStyleInfo') %>"></i>
1249+
</div>
1250+
</div>
1251+
1252+
<div class="flexCol-9 borderRight0 custCol-border">
1253+
<div class="fieldItem">
1254+
<input type="radio" class="fieldItem" id="app_bar_style_windows" name="appBarStyle" value="win" checked />
1255+
<label for="app_bar_style_windows" class="radioLabel"><%= polyglot.t('OSWindows') %></label>
1256+
<input type="radio" class="fieldItem" id="app_bar_style_mac" name="appBarStyle" value="mac" />
1257+
<label for="app_bar_style_mac" class="radioLabel"><%= polyglot.t('OSMac') %></label>
1258+
</div>
1259+
</div>
1260+
</div>
1261+
12421262
<div class="flexRow">
12431263

12441264
<div class="flexCol-3 borderRight custCol-border">

js/views/appBarVw.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,32 @@ module.exports = BaseVw.extend({
1414
},
1515

1616
initialize: function(options) {
17+
var style = localStorage.appBarStyle;
18+
1719
this.options = options || {};
1820
this.currentWindow = remote.getCurrentWindow();
1921
this.title = this.titlePrefix;
22+
23+
if (!style || ['mac', 'win'].indexOf(style) === -1) {
24+
style = remote.process.platform === 'darwin' ? 'mac' : 'win';
25+
}
26+
27+
this.setStyle(style);
28+
},
29+
30+
setStyle: function(style) {
31+
if (!style || ['mac', 'win'].indexOf(style) === -1) {
32+
throw new Error(`Please provide a style ('mac' or 'win')`);
33+
}
34+
35+
this.$el.removeClass('style-mac style-win');
36+
this.$el.addClass(`style-${style}`);
37+
localStorage.appBarStyle = style;
38+
this.render();
39+
},
40+
41+
getStyle: function() {
42+
return localStorage.appBarStyle;
2043
},
2144

2245
navCloseClick: function() {
@@ -60,7 +83,7 @@ module.exports = BaseVw.extend({
6083
render: function() {
6184
loadTemplate('./js/templates/appBar.html', (t) => {
6285
this.$el.html(t({
63-
platform: remote.process.platform,
86+
style: this.getStyle(),
6487
title: this.title
6588
}));
6689
});

js/views/settingsVw.js

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ module.exports = Backbone.View.extend({
5858
'keyup #moderatorFeeInput': 'keypressFeeInput',
5959
'click #advancedForm input[name="notFancy"]': 'toggleFancyStyles',
6060
'click #advancedForm input[name="useTestnet"]': 'toggleTestnet',
61+
'change #advancedForm input[name="appBarStyle"]': 'changeAppBarStyle',
6162
'blur input': 'validateInput',
6263
'blur textarea': 'validateInput',
6364
'change #handle': 'handleChange',
@@ -385,6 +386,8 @@ module.exports = Backbone.View.extend({
385386
currency = this.$('#currency_code'),
386387
timezone = this.$('#time_zone'),
387388
language = this.$('#language'),
389+
generalForm = this.$('#generalForm'),
390+
advancedForm = this.$('#advancedForm'),
388391
user = this.model.get('user'),
389392
ship_country_str = "",
390393
country_str = "",
@@ -398,13 +401,15 @@ module.exports = Backbone.View.extend({
398401
fancyStatus = window.localStorage.getItem('notFancy'),
399402
smtp_notifications = user.smtp_notifications == 1;
400403

401-
this.$('#pageForm input[name=nsfw]').val([String(pageNSFW)]);
402-
this.$("#generalForm input[name=nsfw][value=" + localStorage.getItem('NSFWFilter') + "]").prop('checked', true);
403-
this.$("#generalForm input[name=notifications][value=" + notifications + "]").prop('checked', true);
404-
this.$("#storeForm input[name=vendor][value=" + vendorStatus + "]").prop('checked', true);
405-
this.$("#advancedForm input[name=notFancy][value=" + fancyStatus + "]").prop('checked', true);
406-
this.$("#advancedForm input[name=additionalPaymentData][value=" + localStorage.getItem('AdditionalPaymentData') + "]").prop('checked', true);
407-
this.$("#advancedForm input[name=smtp_notifications][value=" + smtp_notifications + "]").prop('checked', true);
404+
this.$("#pageForm").find("input[name=nsfw]").val([String(pageNSFW)]);
405+
generalForm.find("input[name=nsfw][value=" + localStorage.getItem('NSFWFilter') + "]").prop('checked', true);
406+
generalForm.find("input[name=notifications][value=" + notifications + "]").prop('checked', true);
407+
this.$("#storeForm").find("input[name=vendor][value=" + vendorStatus + "]").prop('checked', true);
408+
advancedForm.find("input[name=notFancy][value=" + fancyStatus + "]").prop('checked', true);
409+
advancedForm.find("input[name=additionalPaymentData][value=" + localStorage.getItem('AdditionalPaymentData') + "]").prop('checked', true);
410+
advancedForm.find("input[name=smtp_notifications][value=" + smtp_notifications + "]").prop('checked', true);
411+
advancedForm.find("input[name=smtp_notifications][value=" + smtp_notifications + "]").prop('checked', true);
412+
advancedForm.find("input[name=appBarStyle][value=" + app.appBar.getStyle() + "]").prop('checked', true);
408413

409414
currencyList = __.uniq(currencyList, function(item){
410415
return item.code;
@@ -462,8 +467,7 @@ module.exports = Backbone.View.extend({
462467

463468
//set moderator status
464469
this.$('#moderatorForm').find('input[name=moderator]').val([String(moderatorStatus)]);
465-
466-
this.$('#advancedForm').find('input[name=smtp_mo]').val([String(moderatorStatus)]);
470+
advancedForm.find('input[name=smtp_mo]').val([String(moderatorStatus)]);
467471
},
468472

469473
showModeratorFeeHolder: function(){
@@ -1072,11 +1076,13 @@ module.exports = Backbone.View.extend({
10721076
},
10731077

10741078
toggleFancyStyles: function(){
1079+
var $html = $('html');
1080+
10751081
if ($('#advancedForm').find('input[name="notFancy"]').prop('checked')){
1076-
$('html').addClass('notFancy');
1082+
$html.addClass('notFancy');
10771083
localStorage.setItem('notFancy', "true");
10781084
} else {
1079-
$('html').removeClass('notFancy');
1085+
$html.removeClass('notFancy');
10801086
localStorage.setItem('notFancy', "false");
10811087
}
10821088
},
@@ -1086,6 +1092,10 @@ module.exports = Backbone.View.extend({
10861092
window.location.reload();
10871093
},
10881094

1095+
changeAppBarStyle: function(e) {
1096+
app.appBar.setStyle($(e.target).val());
1097+
},
1098+
10891099
close: function(){
10901100
__.each(this.subModels, function(subModel) {
10911101
subModel.off();

main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var fs = require('fs'),
2222

2323
var launched_from_installer = false;
2424
var platform = os.platform();
25-
switch(platform) {
25+
switch (platform) {
2626
case "darwin":
2727
platform = "mac";
2828
}

0 commit comments

Comments
 (0)