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

Commit 50156e9

Browse files
committed
Merge pull request #1389 from OpenBazaar/pr/1367
Pr/1367
2 parents 3f45d5f + 23bad92 commit 50156e9

File tree

11 files changed

+166
-66
lines changed

11 files changed

+166
-66
lines changed

js/config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ module.exports = {
1010

1111
bitcoinValidationRegex: bitcoinValidationRegex,
1212

13+
keyShortcutPrefix: window.navigator.platform === 'MacIntel' ? '⌘' : 'Ctrl+',
14+
1315
keyShortcuts: {
16+
undo: 'z',
1417
discover: 'd',
1518
myPage: 'h',
1619
customizePage: 'e',
@@ -20,6 +23,7 @@ module.exports = {
2023
cases: 'j',
2124
settings: 'g',
2225
addressBar: 'l',
26+
save: 's',
2327
restart: 'r'
2428
},
2529

js/main.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ $(window).bind('keydown', function(e) {
196196

197197
if (ctrl) {
198198
switch (char) {
199-
case 'z':
199+
case config.keyShortcuts.undo:
200200
//run undo programmatically to avoid crash
201201
e.preventDefault();
202202
document.execCommand('undo');
@@ -229,11 +229,14 @@ $(window).bind('keydown', function(e) {
229229
// Select all text in address bar
230230
$('.js-navAddressBar').select();
231231
break;
232+
case config.keyShortcuts.save:
233+
window.obEventBus.trigger('saveCurrentForm');
234+
break;
232235
}
233236

234237
if (route !== null) {
235238
e.preventDefault();
236-
Backbone.history.navigate(route, {
239+
Backbone.history.navigate(route, {
237240
trigger: true
238241
});
239242
}

js/templates/itemEdit.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ <h5><%= polyglot.t('Expiration') %> (<%= polyglot.t('Optional') %>)</h5>
419419
<div class="ctrlGroup js-itemEditButtons floatRight">
420420
<a class="btn btn-large custCol-secondary js-saveItem">
421421
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
422-
<%= polyglot.t('SaveChanges') %>
422+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
423423
</a>
424424
</div>
425425
<div class="ctrlGroup js-itemEditButtons textOpacity1 floatRight marginRight5">

js/templates/pageNav.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,18 @@ <h3 class="margin0 marginTop25"><%= polyglot.t('Discover') %></h3>
7070
<a href="#userPage">
7171
<span class="ion-document-text fontSize12 marginRight2 textOpacity1"></span>
7272
<%= polyglot.t('nav.myPage') %>
73-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.myPage.toUpperCase() %></span>
73+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.myPage.toUpperCase() %></span>
7474
</a>
7575
<a href="#userPage/<%= ob.guid %>/customize">
7676
<span class="ion-paintbucket fontSize10 textOpacity1"></span>
7777
<%= polyglot.t('nav.customizePage') %>
78-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.customizePage.toUpperCase() %></span>
78+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.customizePage.toUpperCase() %></span>
7979
</a>
8080
<% if(ob.vendor) { %>
8181
<a href="#userPage/<%= ob.guid %>/listingNew" >
8282
<span class="ion-ios-pricetag fontSize10 marginRight2 textOpacity1"></span>
8383
<%= polyglot.t('nav.createListing') %>
84-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.create.toUpperCase() %></span>
84+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.create.toUpperCase() %></span>
8585
</a>
8686
<% }else{ %>
8787
<a href="#userPage/<%= ob.guid %>/createStore">
@@ -101,27 +101,27 @@ <h3 class="margin0 marginTop25"><%= polyglot.t('Discover') %></h3>
101101
<a href="#transactions/purchases">
102102
<span class="ion-log-out fontSize11 marginRight2 textOpacity1"></span>
103103
<%= polyglot.t('nav.purchases') %>
104-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.purchases.toUpperCase() %></span>
104+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.purchases.toUpperCase() %></span>
105105
</a>
106106
<% if(ob.vendor) { %>
107107
<a href="#transactions/sales">
108108
<span class="ion-log-in fontSize11 marginRight2 textOpacity1"></span>
109109
<%= polyglot.t('nav.sales') %>
110-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.sales.toUpperCase() %></span>
110+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.sales.toUpperCase() %></span>
111111
</a>
112112
<% } %>
113113
<% if(ob.moderator) { %>
114114
<a href="#transactions/cases">
115115
<span class="ion-briefcase fontSize11 marginRight2 textOpacity1"></span>
116116
<%= polyglot.t('nav.cases') %>
117-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.cases.toUpperCase() %></span>
117+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.cases.toUpperCase() %></span>
118118
</a>
119119
<% } %>
120120
<hr/>
121121
<a href="#settings">
122122
<span class="ion-toggle-filled fontSize11 marginRight2 textOpacity1"></span>
123123
<%= polyglot.t('nav.settings') %>
124-
<span class="pull-right txt-muted"><%= ob.ctrlCmdKey + config.keyShortcuts.settings.toUpperCase() %></span>
124+
<span class="pull-right txt-muted"><%= config.keyShortcutPrefix + config.keyShortcuts.settings.toUpperCase() %></span>
125125
</a>
126126
<a class="js-navRestart">
127127
<span class="ion-refresh fontSize11 marginRight2 textOpacity1"></span>
@@ -174,7 +174,7 @@ <h3 class="margin0 marginTop25"><%= polyglot.t('Discover') %></h3>
174174
</div>
175175
</div>
176176
<div class="ctrlGroup">
177-
<a class="btn btn-home ion-eye custCol-primary custCol-text fontSize15 tooltip" href="#home" data-tooltip="<%= polyglot.t('Discover') %> (<%= ob.ctrlCmdKey + config.keyShortcuts.discover.toUpperCase() %>)"></a>
177+
<a class="btn btn-home ion-eye custCol-primary custCol-text fontSize15 tooltip" href="#home" data-tooltip="<%= polyglot.t('Discover') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.discover.toUpperCase() %>)"></a>
178178
</div>
179179
<div class="ctrlGroup">
180180
<div class="btn btn-notifications ion-android-notifications custCol-primary custCol-text fontSize14 js-navNotifications tooltip" data-tooltip="<%= polyglot.t('nav.notifications') %>" data-popmenu=".popMenu-notifications">

js/templates/settings.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('General') %></h3>
179179

180180
<a class="btn btn-large js-saveGeneral custCol-secondary pull-right marginRight15 marginTop15 marginBottom50 btn-secondary">
181181
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
182-
<%= polyglot.t('SaveChanges') %>
182+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
183183
</a>
184184
<a class="btn btn-large js-cancelGeneral custCol-secondary pull-right marginRight5 marginTop15 marginBottom50 btn-secondary width87px"><%= polyglot.t('Reset') %></a>
185185

@@ -678,7 +678,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Theme') %></h3>
678678

679679
<a class="btn btn-large js-savePage custCol-secondary pull-right marginRight15 marginTop15 marginBottom50 btn-secondary">
680680
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
681-
<%= polyglot.t('SaveChanges') %>
681+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
682682
</a>
683683
<a class="btn btn-large js-cancelPage custCol-secondary pull-right marginRight5 marginTop15 marginBottom50 btn-secondary width87px"><%= polyglot.t('Reset') %></a>
684684

@@ -815,7 +815,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Content') %></h3>
815815

816816
<a class="btn btn-large js-saveStore custCol-secondary pull-right marginRight15 marginTop15 marginBottom5 btn-secondary">
817817
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
818-
<%= polyglot.t('SaveChanges') %>
818+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
819819
</a>
820820
<a class="btn btn-large js-cancelStore custCol-secondary pull-right marginRight5 marginTop15 marginBottom50 btn-secondary width87px"><%= polyglot.t('Reset') %></a>
821821
</div>
@@ -984,7 +984,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('NewAddress') %></h3>
984984

985985
<a class="btn btn-large js-saveAddress custCol-secondary pull-right marginRight15 marginTop15 marginBottom50 btn-secondary">
986986
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
987-
<%= polyglot.t('SaveChanges') %>
987+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
988988
</a>
989989
<a class="btn btn-large js-cancelAddress custCol-secondary pull-right marginRight5 marginTop15 marginBottom50 btn-secondary width87px"><%= polyglot.t('Reset') %></a>
990990
</div>
@@ -1045,7 +1045,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('moderatorSettings.Di
10451045
</div>
10461046
<a class="btn btn-large js-saveModerator custCol-secondary pull-right marginRight15 marginTop15 marginBottom50 btn-secondary">
10471047
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
1048-
<%= polyglot.t('SaveChanges') %>
1048+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
10491049
</a>
10501050
<a class="btn btn-large js-cancelModerator custCol-secondary pull-right marginRight5 marginTop15 marginBottom50 btn-secondary width87px"><%= polyglot.t('Reset') %></a>
10511051
</div>
@@ -1229,7 +1229,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Advanced') %></h3>
12291229

12301230
<a class="btn btn-large js-saveAdvanced custCol-secondary pull-right marginRight15 marginTop15 marginBottom50 btn-secondary">
12311231
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
1232-
<%= polyglot.t('SaveChanges') %>
1232+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
12331233
</a>
12341234
<a class="btn btn-large js-cancelAdvanced custCol-secondary pull-right marginRight5 marginTop15 marginBottom50 btn-secondary width87px"><%= polyglot.t('Reset') %></a>
12351235
</div>

js/templates/userPage.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
<div class="ctrlGroup js-pageCustomizationButtons js-userPageControls hide">
2727
<a class="btn btn-txt custCol-primary js-saveCustomization">
2828
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
29-
<%= polyglot.t('SaveChanges') %>
29+
<% console.log(config.keyShortcuts) %>
30+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
3031
</a>
3132
</div>
3233
</div>
@@ -203,13 +204,13 @@ <h1 class="page-userNameLarge floatLeft fancy-heading fontSize20 colorWhiteForce
203204
<div class="ctrlGroup hide js-itemEditButtons js-userPageControls hide">
204205
<a class="btn btn-txt custCol-primary js-saveItem">
205206
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
206-
<%= polyglot.t('SaveChanges') %>
207+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
207208
</a>
208209
</div>
209210
<div class="ctrlGroup hide js-itemCustomizationButtons js-userPageControls hide">
210211
<a class="btn btn-txt custCol-primary js-saveCustomization">
211212
<span class="ion-checkmark fontSize11 marginRight2 textOpacity1"></span>
212-
<%= polyglot.t('SaveChanges') %>
213+
<%= polyglot.t('SaveChanges') %> (<%= config.keyShortcutPrefix + config.keyShortcuts.save.toUpperCase() %>)
213214
</a>
214215
</div>
215216
</div>

js/views/itemEditVw.js

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

9090
render: function(){
9191
var self = this;
92+
9293
loadTemplate('./js/templates/itemEdit.html', function(loadedTemplate) {
9394
var context = __.extend({}, self.model.toJSON(), { MAX_PHOTOS: self.MAX_PHOTOS });
9495

js/views/itemVw.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ module.exports = baseVw.extend({
8585
"use strict";
8686
var imageExtension = self.model.get('imageExtension') || "";
8787
});
88+
8889
//el must be passed in from the parent view
8990
loadTemplate('./js/templates/item.html', function(loadedTemplate) {
9091
loadTemplate('./js/templates/ratingStars.html', function(starsTemplate) {

js/views/pageNavVw.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ module.exports = baseVw.extend({
249249
//load userProfile data into model
250250
this.model.set('guid', this.userProfile.get('profile').guid);
251251
this.model.set('avatar_hash', this.userProfile.get('profile').avatar_hash);
252-
this.model.set('ctrlCmdKey', window.navigator.platform === 'MacIntel' ? '&#8984;' : 'Ctrl+');
253252
this.model.set('version', pjson.version);
254253
loadTemplate('./js/templates/pageNav.html', function(loadedTemplate) {
255254
self.$el.html(loadedTemplate(self.model.toJSON()));

0 commit comments

Comments
 (0)