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

Commit aae2888

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into internationalBTCFormatting
2 parents 530b439 + 46d2228 commit aae2888

File tree

9 files changed

+173
-29
lines changed

9 files changed

+173
-29
lines changed

js/languages/en-US.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@
231231
"SearchForCategory": "Search for category",
232232
"Moderators": "Moderators",
233233
"CurrentModerators": "Current Moderators",
234-
"AddModerators": "Add New Moderators",
234+
"AddModerators": "Add Moderators",
235+
"ManualAddModerator": "Add Moderators by GUID",
236+
"ManualAddModeratorHelp": "Enter the GUIDs of one or more moderators, separated by commas, here. The GUID is on the right side of their About tab on their page. Adding the GUID of a user that is not a moderator will have no effect, that GUID will be ignored.",
235237
"DeselectToRemoveModerator": "Deselect the moderators you want to remove",
236238
"SelectToAddModerator": "Select the moderators you want to add",
237239
"Categories": "Categories",

js/models/timezonesMd.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ module.exports = Backbone.Model.extend({
8888
"offset": 5
8989
},
9090
{
91-
"name":"(GMT +5:30) Bombay, Calcutta, Madras, New Delhi",
91+
"name":"(GMT +5:30) Mumbai, Kolkata, Chennai, New Delhi",
9292
"offset": 5.5
9393
},
9494
{

js/templates/buyDetails.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
</form>
3939
</div>
4040
</div>
41-
<div class="flexCol-4">
41+
<div class="flexCol-4 overflowHidden">
4242
<div class="rowItem padding2015 alignRight marginTop20">
4343
<span class="noOverflow fontSize13 js-buyWizardBTCPrice"></span>
4444
<span class="noOverflow textOpacity75 fontSize13 js-buyWizardPrice">

js/templates/settings.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Basic') %></h3>
729729
<div class="flexCol-9 borderRight0 custCol-border">
730730
<div class="hideTopAndBottomBorder js-settingsCurrentMods">
731731
</div>
732-
<div class="padding10 width100 alignCenter fadeable js-loadingMsg">
732+
<div class="padding10 width100 alignCenter fadeable js-loadingMsgOld">
733733
<i class="ion-android-sync spinner textSize24px textOpacity50"></i>
734734
</div>
735735
</div>
@@ -750,12 +750,32 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Basic') %></h3>
750750
<div class="flexCol-9 borderRight0 custCol-border">
751751
<div class="hideTopAndBottomBorder js-settingsNewMods">
752752
</div>
753-
<div class="padding10 width100 alignCenter fadeable js-loadingMsg">
753+
<div class="padding10 width100 alignCenter fadeable js-loadingMsgNew">
754754
<i class="ion-android-sync spinner textSize24px textOpacity50"></i>
755755
</div>
756756
</div>
757757
</div>
758758

759+
<div class="flexRow">
760+
<div class="flexCol-3 borderRight custCol-border zIndex1"><!-- add z-index so help box overlaps next column-->
761+
<div class="fieldItem">
762+
<label for="addManualMods" class="tooltip tooltip-box" data-tooltip="<%= polyglot.t('ManualAddModeratorHelp') %>">
763+
<%= polyglot.t('ManualAddModerator') %> <i class="ion-help-circled"></i>
764+
</label>
765+
766+
</div>
767+
</div>
768+
769+
<div class="flexCol-9 borderRight0 custCol-border">
770+
<div class="fieldItem padding0">
771+
<input name="manualMods"
772+
type="text"
773+
id="addManualMods"
774+
class="fieldItem">
775+
</div>
776+
</div>
777+
</div>
778+
759779
<div class="flexRow TODO">
760780
<div class="flexCol-3 borderRight custCol-border">
761781
<div class="fieldItem">
@@ -768,6 +788,7 @@ <h3 class="padding15 margin0 fontWeight500"><%= polyglot.t('Basic') %></h3>
768788
<div class="flexCol-9 borderRight0 custCol-border">
769789
<div class="fieldItem padding0">
770790
<!--TODO: keywords input here -->
791+
<input id="store-keywords">
771792
</div>
772793
</div>
773794
</div>

js/templates/userPage.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ <h1 class="page-userNameLarge floatLeft fancy-heading fontSize20 colorWhiteForce
257257
</a>
258258
<%}%>
259259
<% if(ob.page.profile.about) { %>
260-
<div class="js-userAbout margin0 flexContainer editableContent"><%= ob.page.profile.displayAbout %></div>
260+
<div class="js-userAbout margin0 editableContent"><%= ob.page.profile.displayAbout %></div>
261261
<%}else{%>
262262
<span class="textOpacity75"><%= polyglot.t('AboutEmpty') %></span>
263263
<%}%>

js/views/buyDetailsVw.js

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,34 @@ module.exports = Backbone.View.extend({
1515

1616
initialize: function() {
1717
"use strict";
18-
var currentShippingPrice = 0,
18+
var recipient = this.model.get('page').profile.handle || this.model.get('page').profile.guid;
19+
20+
this.model.set('recipient', recipient);
21+
22+
this.listenTo(this.model, 'change:selectedModerator change:selectedAddress', this.render);
23+
this.render();
24+
},
25+
26+
render: function(){
27+
var self = this,
28+
currentShippingPrice = 0,
1929
currentShippingBTCPrice = 0,
20-
recipient = this.model.get('page').profile.handle || this.model.get('page').profile.guid;
21-
if(this.model.get('vendor_offer').listing.shipping.free !== true) {
22-
if(this.model.get('userCountry') != this.model.get('vendor_offer').listing.shipping.shipping_origin) {
30+
shippingType = "",
31+
templJSON = {};
32+
console.log(this.model)
33+
34+
//set prices before each render
35+
if(this.model.get('vendor_offer').listing.shipping.free !== true && this.model.get('selectedAddress')) {
36+
if(this.model.get('selectedAddress').country != this.model.get('vendor_offer').listing.shipping.shipping_origin) {
2337
currentShippingPrice = this.model.get('internationalShipping');
2438
currentShippingBTCPrice = this.model.get('internationalShippingBTC');
2539
this.model.set('shippingType', 'international');
40+
shippingType = 'international';
2641
} else {
2742
currentShippingPrice = this.model.get('domesticShipping');
2843
currentShippingBTCPrice = this.model.get('domesticShippingBTC');
2944
this.model.set('shippingType', 'domestic');
45+
shippingType = 'domestic';
3046
}
3147
}
3248

@@ -40,14 +56,6 @@ module.exports = Backbone.View.extend({
4056
currency: this.model.get('userCurrencyCode')
4157
}).format(currentShippingPrice));
4258

43-
this.model.set('recipient', recipient);
44-
45-
this.listenTo(this.model, 'change:selectedModerator change:selectedAddress', this.render);
46-
this.render();
47-
},
48-
49-
render: function(){
50-
var self = this;
5159
loadTemplate('./js/templates/buyDetails.html', function(loadedTemplate) {
5260
self.$el.html(loadedTemplate(self.model.toJSON()));
5361
//this does not add it to the DOM, that is done by the parent view

js/views/settingsVw.js

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -503,9 +503,21 @@ module.exports = Backbone.View.extend({
503503
//don't add unless it comes from the model
504504
if(moderator.fromModel){
505505
this.$el.find('.js-settingsCurrentMods').append(modShort.el);
506+
if(!this.$('.js-loadingMsgOld').hasClass('foldIn')){
507+
//hide spinners after a while
508+
setTimeout(()=> {
509+
this.$('.js-loadingMsgOld').addClass('foldIn');
510+
},2000);
511+
}
506512
}
507513
}else{
508514
this.$el.find('.js-settingsNewMods').append(modShort.el);
515+
if(!this.$('.js-loadingMsgNew').hasClass('foldIn')){
516+
//hide spinners after a while
517+
setTimeout(()=> {
518+
this.$('.js-loadingMsgNew').addClass('foldIn');
519+
},2000);
520+
}
509521
}
510522
this.moderatorCount++;
511523
this.subViews.push(modShort);
@@ -557,10 +569,6 @@ module.exports = Backbone.View.extend({
557569
}
558570
});
559571
}
560-
//hide spinners after a while
561-
setTimeout(()=> {
562-
this.$('.js-loadingMsg').addClass('foldIn');
563-
},3000);
564572
this.firstLoadModerators = false;
565573
} else if (state === 'blocked') {
566574
// Since the Blocked Users View kicks off many server calls (one
@@ -811,9 +819,8 @@ module.exports = Backbone.View.extend({
811819
form = this.$el.find("#storeForm"),
812820
settingsData = {},
813821
moderatorsNew = this.$el.find('#storeForm .js-settingsNewMods .js-userShortView input:checked'),
814-
moderatorList = this.userModel.get('moderators').map(function(moderatorObject){
815-
return moderatorObject.guid;
816-
}),
822+
moderatorList = this.userModel.get('moderator_guids'),
823+
manualModList,
817824
moderatorsUnChecked = this.$('#storeForm .js-settingsCurrentMods .js-userShortView input:not(:checked)'),
818825
onFail,
819826
$saveBtn = this.$('.js-saveStore');
@@ -830,6 +837,14 @@ module.exports = Backbone.View.extend({
830837
moderatorList.push($(this).data('guid'));
831838
});
832839

840+
//add any manually entered mods
841+
manualModList = this.$('#addManualMods').val().split(',');
842+
__.each(manualModList, function(mod){
843+
if(mod.length === 40){
844+
moderatorList.push(mod);
845+
}
846+
});
847+
833848
settingsData.moderators = moderatorList.length > 0 ? moderatorList : "";
834849

835850
onFail = (data) => {

main.js

Lines changed: 99 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,99 @@ if(fs.existsSync(__dirname + path.sep + ".." + path.sep + "OpenBazaar-Server" +
154154
// be closed automatically when the JavaScript object is GCed.
155155
var mainWindow = null;
156156

157+
if (process.platform === "win32") {
158+
initWin32();
159+
}
160+
161+
function initWin32() {
162+
var Registry = require('winreg');
163+
164+
var iconPath = path.join(process.env.LOCALAPPDATA, "app.ico");
165+
registerProtocolHandlerWin32('ob', 'URL:OpenBazaar URL', iconPath, process.execPath);
166+
167+
/**
168+
* To add a protocol handler, the following keys must be added to the Windows registry:
169+
*
170+
* HKEY_CLASSES_ROOT
171+
* $PROTOCOL
172+
* (Default) = "$NAME"
173+
* URL Protocol = ""
174+
* DefaultIcon
175+
* (Default) = "$ICON"
176+
* shell
177+
* open
178+
* command
179+
* (Default) = "$COMMAND" "%1"
180+
*
181+
* Source: https://msdn.microsoft.com/en-us/library/aa767914.aspx
182+
*
183+
* However, the "HKEY_CLASSES_ROOT" key can only be written by the Administrator user.
184+
* So, we instead write to "HKEY_CURRENT_USER\Software\Classes", which is inherited by
185+
* "HKEY_CLASSES_ROOT" anyway, and can be written by unprivileged users.
186+
*/
187+
188+
function registerProtocolHandlerWin32 (protocol, name, icon, command) {
189+
var protocolKey = new Registry({
190+
hive: Registry.HKCU, // HKEY_CURRENT_USER
191+
key: '\\Software\\Classes\\' + protocol
192+
})
193+
194+
setProtocol()
195+
196+
function setProtocol (err) {
197+
if (err) log.error(err.message)
198+
console.log(protocolKey);
199+
protocolKey.set('', Registry.REG_SZ, name, setURLProtocol)
200+
}
201+
202+
function setURLProtocol (err) {
203+
if (err) log.error(err.message)
204+
console.log(protocolKey);
205+
protocolKey.set('URL Protocol', Registry.REG_SZ, '', setIcon)
206+
}
207+
208+
function setIcon (err) {
209+
if (err) log.error(err.message)
210+
211+
var iconKey = new Registry({
212+
hive: Registry.HKCU,
213+
key: '\\Software\\Classes\\' + protocol + '\\DefaultIcon'
214+
})
215+
iconKey.set('', Registry.REG_SZ, icon, setCommand)
216+
}
217+
218+
function setCommand (err) {
219+
if (err) log.error(err.message)
220+
221+
var commandKey = new Registry({
222+
hive: Registry.HKCU,
223+
key: '\\Software\\Classes\\' + protocol + '\\shell\\open\\command'
224+
})
225+
commandKey.set('', Registry.REG_SZ, '"' + command + '" "%1"', done)
226+
}
227+
228+
function done (err) {
229+
if (err) log.error(err.message)
230+
}
231+
}
232+
}
233+
234+
var iShouldQuit = app.makeSingleInstance(function(commandLine, workingDirectory) {
235+
var uri = "";
236+
if (commandLine.length == 2) {
237+
uri = commandLine[1];
238+
openURL(uri);
239+
}
240+
241+
if (mainWindow) {
242+
if (mainWindow.isMinimized()) mainWindow.restore();
243+
mainWindow.show();
244+
mainWindow.focus();
245+
}
246+
return true;
247+
});
248+
if(iShouldQuit){app.quit();return;}
249+
157250
// Quit when all windows are closed.
158251
app.on('window-all-closed', function() {
159252
// On OS X it is common for applications and their menu bar
@@ -398,7 +491,7 @@ ipcMain.on('set-badge', function(event, text) {
398491
app.dock.setBadge(String(text));
399492
});
400493

401-
app.on('open-url', function(event, uri) {
494+
function openURL(uri) {
402495
var split_uri = uri.split('://');
403496
uri = split_uri[1];
404497

@@ -410,5 +503,9 @@ app.on('open-url', function(event, uri) {
410503
mainWindow.webContents.send('external-route', uri);
411504
}
412505

506+
}
507+
508+
app.on('open-url', function(event, uri) {
509+
openURL(uri);
413510
event.preventDefault();
414-
});
511+
});

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@
3939
"sortablejs": "^1.4.2",
4040
"taggle": "1.6.1",
4141
"underscore": "1.8.3",
42-
"yargs": "^4.1.0"
42+
"yargs": "^4.1.0",
43+
"winreg": "^1.1.1"
4344
},
4445
"devDependencies": {
45-
"electron-prebuilt": "0.37.5",
46+
"electron-prebuilt": "0.37.7",
4647
"eslint": "1.9.0",
4748
"pre-commit": "^1.1.2",
4849
"valiquire": "0.3.0"

0 commit comments

Comments
 (0)