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

Commit 9cc5bcc

Browse files
committed
Merge pull request #1463 from rmisio/modal-fullscreen
resurrecting the modal-cover-fullscreen class
2 parents 561e0b7 + ad90816 commit 9cc5bcc

36 files changed

+1166
-593
lines changed

css/obBase.css

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,6 +1456,14 @@ h5 {
14561456
padding-top: 70px;
14571457
}
14581458
1459+
.modal-cover-fullscreen {
1460+
top: 0;
1461+
}
1462+
1463+
.modal-cover-fullscreen .modal-childMain {
1464+
top: 50px;
1465+
}
1466+
14591467
.modal-childMain {
14601468
border-radius: 3px;
14611469
background-color: #327eb8;
@@ -3774,7 +3782,7 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
37743782
.modal .homeModal-heroText {
37753783
position: absolute;
37763784
bottom: 0px;
3777-
top: 210px;
3785+
top: 200px;
37783786
color: #fff;
37793787
font-size: 20px;
37803788
line-height: 22px;
@@ -4244,14 +4252,68 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
42444252
z-index: 9;
42454253
}
42464254
4247-
#loadingModal {
4255+
#loadingModal, .page-connect-modal.startup-server-connect {
42484256
z-index: 14;
42494257
}
42504258
4251-
.server-connect-modal {
4259+
#ov1 .server-connect-modal {
42524260
z-index: 15;
42534261
}
42544262
4263+
#ov1 .server-connect-modal .modal-child {
4264+
height: 625px;
4265+
overflow: hidden;
4266+
}
4267+
4268+
#ov1 .server-connect-modal .message-bar {
4269+
top: 50px;
4270+
left: 25px;
4271+
right: 25px;
4272+
z-index: 1;
4273+
transition: top .2s, opacity .2s;
4274+
}
4275+
4276+
#ov1 .server-connect-modal .message-bar > div {
4277+
background-color: #C62D2D;
4278+
padding: 8px 20px;
4279+
line-height: 2.2;
4280+
display: inline-block;
4281+
border-bottom-left-radius: 4px;
4282+
border-bottom-right-radius: 4px;
4283+
}
4284+
4285+
#ov1 .server-connect-modal .message-bar .message-bar-close {
4286+
top: -12px;
4287+
right: -3px;
4288+
}
4289+
4290+
#ov1 .server-connect-modal .message-bar.slide-out {
4291+
top: -45px;
4292+
opacity: 0;
4293+
}
4294+
4295+
#ov1 .server-config-form {
4296+
transition: top 250ms;
4297+
}
4298+
4299+
#ov1 .server-config-form.slide-out {
4300+
top: 372px;
4301+
}
4302+
4303+
#ov1 .server-config-row {
4304+
/*min-height: 73px;*/
4305+
}
4306+
4307+
#ov1 .server-config-row .connection-failed::after {
4308+
content: '';
4309+
position: absolute;
4310+
width: 6px;
4311+
background-color: #C62D2D;
4312+
top: 0;
4313+
left: 0;
4314+
bottom: 0;
4315+
}
4316+
42554317
#loadingModal .btn {
42564318
-webkit-app-region: no-drag;
42574319
}
@@ -4664,6 +4726,15 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
46644726
overflow-x: hidden;
46654727
}
46664728

4729+
#ov1 .autoOverflowYHideX {
4730+
overflow-y: auto;
4731+
overflow-x: hidden;
4732+
}
4733+
4734+
4735+
#ov1 .vertAlignMid {
4736+
vertical-align: middle;
4737+
}
46674738

46684739
#ov1 .vCentered {
46694740
/* must be inside a relatively positioned containing element */
@@ -5284,8 +5355,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
52845355
height: 46px;
52855356
}
52865357

5287-
5288-
52895358
#ov1 .height30 {
52905359
height: 30px;
52915360
line-height: 30px;
@@ -5776,6 +5845,13 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
57765845
display: block;
57775846
}
57785847

5848+
#ov1 .marginCenter {
5849+
margin-left: auto;
5850+
margin-right: auto;
5851+
}
5852+
5853+
5854+
57795855
#ov1 .heightAuto {
57805856
height: auto;
57815857
}

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ <h2 class="txt-center">
7676
<div id="statusBar"></div>
7777
<div id="pageNav" class="bar navBar navBar-main custCol-secondary padding0"></div>
7878
<!-- the loading modal must be on top of the page nav or the reload button is hidden -->
79-
<div id="loadingModal" class="modal modal-opaque js-loadingModal top0">
79+
<div id="loadingModal" class="modal modal-opaque js-loadingModal top0 hide">
8080
<div class="spinner-with-logo fullCentered">
8181
<i class="ion-android-sync spinner fontSize30 spinner-with-logo-icon"></i>
8282
</div>

js/App.js

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
var ipcRenderer = require('ipc-renderer'),
2-
Socket = require('./utils/Socket'),
2+
__ = require('underscore'),
33
$ = require('jquery'),
4-
ServerConfigMd = require('./models/serverConfigMd'),
4+
Socket = require('./utils/Socket'),
55
_app;
66

77
function App() {
@@ -15,55 +15,42 @@ function App() {
1515
this._notifUnread = 0;
1616
this._chatMessagesUnread = 0;
1717

18-
// TODO: what is wrong with the localStorage adapter??? shouldn't need
19-
// to manually provide the data to the model. All that should be needed
20-
// is an ID and then a subsequent fetch, but that doesn't return the data.
21-
// Investigate!
22-
this.serverConfig = new ServerConfigMd( JSON.parse(localStorage['_serverConfig-1'] || '{}') );
23-
24-
// serverConfigMd.fetch();
25-
if (!localStorage['_serverConfig-1']) {
26-
this.serverConfig.save();
27-
}
28-
29-
this.connectHeartbeatSocket();
30-
}
18+
// TODO: rather than attach the serverConfigs CL
19+
// in main.js, pass in the instance here so the
20+
// dependency is more explicit.
21+
};
3122

3223
App.prototype.connectHeartbeatSocket = function() {
33-
var self = this;
24+
var activeServer = this.serverConfigs.getActive();
3425

35-
clearTimeout(this.heartbeatSocketTimesup);
26+
if (!activeServer) {
27+
throw new Error(`No active server set. Please set via the Server Configs collection.`);
28+
}
3629

3730
if (this._heartbeatSocket) {
38-
this._heartbeatSocket.connect(this.serverConfig.getHeartbeatSocketUrl());
31+
this._heartbeatSocket.connect(activeServer.getHeartbeatSocketUrl());
3932
} else {
40-
this._heartbeatSocket = new Socket(this.serverConfig.getHeartbeatSocketUrl());
41-
42-
this._heartbeatSocket.on('close', function() {
43-
clearTimeout(self._heartbeatSocketTimesup);
44-
});
33+
this._heartbeatSocket = new Socket(activeServer.getHeartbeatSocketUrl());
4534
}
46-
47-
// give up if it takes to long
48-
this._heartbeatSocketTimesup = setTimeout(function() {
49-
if (self._heartbeatSocket.getReadyState() !== 1) {
50-
//self._heartbeatSocket._socket.close(); //turn off for now, until server issues are fixed
51-
alert(polyglot.t('errorMessages.serverTimeout'));
52-
}
53-
}, 30000); //wait for 30 seconds, sometimes the server stalls
5435
};
5536

5637
App.prototype.getHeartbeatSocket = function() {
5738
return this._heartbeatSocket;
5839
};
5940

6041
App.prototype.login = function() {
42+
var activeServer = this.serverConfigs.getActive();
43+
44+
if (!activeServer) {
45+
throw new Error(`No active server set. Please set via the Server Configs collection.`);
46+
}
47+
6148
return $.ajax({
62-
url: this.serverConfig.getServerBaseUrl() + '/login',
49+
url: activeServer.getServerBaseUrl() + '/login',
6350
method: 'POST',
6451
data: {
65-
username: this.serverConfig.get('username'),
66-
password: this.serverConfig.get('password')
52+
username: activeServer.get('username'),
53+
password: activeServer.get('password')
6754
},
6855
timeout: 3000
6956
});
@@ -148,7 +135,4 @@ App.getApp = function() {
148135
return _app;
149136
};
150137

151-
152138
module.exports = App;
153-
154-

js/collections/chatConversationsCl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var Backbone = require('backbone'),
44

55
module.exports = Backbone.Collection.extend({
66
url: function() {
7-
return app.serverConfig.getServerBaseUrl() + '/get_chat_conversations';
7+
return app.serverConfigs.getActive().getServerBaseUrl() + '/get_chat_conversations';
88
},
99

1010
model: ChatConversationMd,

js/collections/chatMessagesCl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var Backbone = require('backbone'),
44

55
module.exports = Backbone.Collection.extend({
66
url: function() {
7-
return app.serverConfig.getServerBaseUrl() + '/get_chat_messages';
7+
return app.serverConfigs.getActive().getServerBaseUrl() + '/get_chat_messages';
88
},
99

1010
model: ChatMessageMd,

js/collections/notificationsCl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var Backbone = require('backbone'),
55

66
module.exports = Backbone.Collection.extend({
77
url: function() {
8-
return app.serverConfig.getServerBaseUrl() + '/get_notifications';
8+
return app.serverConfigs.getActive().getServerBaseUrl() + '/get_notifications';
99
},
1010

1111
model: NotificationMd,

js/collections/ratingCl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ var __ = require('underscore'),
55

66
module.exports = Backbone.Collection.extend({
77
url: function() {
8-
return app.serverConfig.getServerBaseUrl() + '/get_ratings';
8+
return app.serverConfigs.getActive().getServerBaseUrl() + '/get_ratings';
99
},
1010

1111
model: RatingMd,

js/collections/serverConfigsCl.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
var Backbone = require('backbone'),
2+
localStorageSync = require('../utils/backboneLocalStorage'),
3+
ServerConfigMd = require('../models/serverConfigMd');
4+
5+
module.exports = Backbone.Collection.extend({
6+
sync: localStorageSync.sync,
7+
localStorage: new localStorageSync('__serverConfig'),
8+
model: ServerConfigMd,
9+
10+
getActive: function() {
11+
var config = this.get(localStorage.activeServer);
12+
13+
if (!config && this.length) {
14+
config = this.at(this.length - 1);
15+
this.setActive(config.id);
16+
}
17+
18+
return config;
19+
},
20+
21+
setActive: function(id) {
22+
var md;
23+
24+
if (!(md = this.get(id))) {
25+
throw new Error(`Unable to set the active server config. It must be an id of one of the available
26+
server configs stored in this collection.`)
27+
}
28+
29+
if (this._active !== id) {
30+
this._active = id;
31+
localStorage.activeServer = id;
32+
this.trigger('activeServerChange', md);
33+
}
34+
}
35+
});

js/languages/en-US.json

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"of": "of",
2525
"Sell": "Sell",
2626
"New": "New",
27+
"Retry": "Retry",
2728
"HighlightToStyle": "Highlight text to style",
2829
"Excellent": "Excellent",
2930
"Good": "Good",
@@ -670,23 +671,30 @@
670671
"noSearchResultsFound": "No results found"
671672
},
672673
"serverConnectModal": {
673-
"statusTryingToConnect": "Trying to connect to your server...",
674-
"statusConnected": "Connected.",
675-
"statusFailedConnection": "Unable to connect to your server",
676-
"statusFailedAuthentication": "Authentication failed",
677-
"statusTooManyAttempts": "Too many failed login attempts",
674+
"connect": "Connect",
675+
"connected": "Connected",
676+
"connecting": "Connecting",
678677
"serverConfiguration": "Server Configuration",
679-
"connecting": "Connecting...",
680678
"intro": "OpenBazaar is designed to allow you to host your server separate from the client. By default, your server will run locally, but you can override it below.",
681679
"serverIP": "Server IP",
682680
"restApiPort": "Rest API port",
683681
"websocketApiPort": "Websocket API port",
684682
"heartbeatSocketApiPort": "Heartbeat socket port",
685683
"username": "Username",
686684
"password": "Password",
687-
"restoreDefaults": "Restore defaults",
688685
"saveChanges": "Save Changes",
689-
"retry": "Retry connection"
686+
"defaultServerName": "default",
687+
"portedConnectionName": "ported connection",
688+
"connectionFailed": "Connection failed to %{serverName}",
689+
"connectingTo": "Connecting to %{serverName}",
690+
"connectingToDefault": "Connecting to the default server",
691+
"authFailed": "authentication failed",
692+
"authFailedTooManyAttempts": "too many failed authentication attempts",
693+
"serverConfigsHeaderMsg": "Your Server Configurations",
694+
"newConfigHeaderMsg": "Enter Server Details",
695+
"editConfigHeaderMsg": "Configuration Settings",
696+
"serverConfigsTitle": "Server Configurations",
697+
"newConfigTitle": "New Configuration"
690698
},
691699
"timezones": {
692700
"-12": "(GMT -12:00) Eniwetok, Kwajalein",

0 commit comments

Comments
 (0)