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

Commit 8f0cfa9

Browse files
authored
Merge pull request #1704 from rmisio/unify-modals
Unify modals
2 parents 857b3a9 + 5d505bb commit 8f0cfa9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+2994
-2282
lines changed

css/obBase.css

Lines changed: 42 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -329,10 +329,6 @@ h6, .h6 {
329329
position: relative;
330330
}
331331

332-
#contentFrame.modalOpen #pageNav .badge {
333-
display: none;
334-
}
335-
336332
#pageNav {
337333
position: relative;
338334
-webkit-app-region: no-drag;
@@ -357,16 +353,6 @@ h6, .h6 {
357353
box-sizing: border-box;
358354
}
359355

360-
#obContainer.modalOpen,
361-
#obContainer.innerModalOpen {
362-
overflow: hidden;
363-
/* obContainer must also be set to scrollTop(0), otherwise the modal may be scrolled out of place */
364-
}
365-
366-
#obContainer.modalOpen #content {
367-
-webkit-filter: blur(1px);
368-
}
369-
370356
#obContainer.customizeUserPage {
371357
overflow: hidden;
372358
border: 5px dashed #fff;
@@ -528,6 +514,7 @@ h6, .h6 {
528514
float: left;
529515
}
530516

517+
/* while not used for modals, overlay is used when page nav drop downs are opened */
531518
#overlay,
532519
.overlay {
533520
position: absolute;
@@ -536,7 +523,7 @@ h6, .h6 {
536523
height: 100%;
537524
width: 100%;
538525
background-color: rgba(25,25,25,0.85);
539-
z-index: 0;
526+
z-index: 1;
540527
transition: all .25s cubic-bezier(0, 0, 0.2, .5);
541528
}
542529

@@ -1313,8 +1300,34 @@ label.fieldItem {
13131300
pointer-events: all;
13141301
}
13151302

1316-
.modal.noNav {
1317-
padding-top: 85px
1303+
.modal .btn-corner {
1304+
z-index: 0;
1305+
}
1306+
1307+
.modal.underPageNav {
1308+
top: 46px
1309+
}
1310+
1311+
/*
1312+
.insideApp will position the modal below the nav bar and so it doesn't obscure chat.
1313+
*/
1314+
.modal.insideApp {
1315+
top: 46px;
1316+
width: calc(100% - 47px);
1317+
z-index: 0;
1318+
}
1319+
1320+
#ov1.chatOpen .modal.insideApp {
1321+
width: calc(100% - 230px);
1322+
}
1323+
1324+
/*
1325+
A fullscreen modal has it's content extended across the entire screen
1326+
(excluding the top menu bar), as opposed to being a "box" centered in
1327+
the screen (e.g the loading modal). It's not really compatible with .insideApp.
1328+
*/
1329+
.modal.modalCoverFullscreen {
1330+
padding-top: 0;
13181331
}
13191332

13201333
.modal-child {
@@ -1327,6 +1340,11 @@ label.fieldItem {
13271340
transition: right 0.5s ease;
13281341
}
13291342

1343+
.modal.modalCoverFullscreen .modal-child {
1344+
width: 100%;
1345+
height: 100%;
1346+
}
1347+
13301348
.modal-opaque .modal-child {
13311349
height: 574px;
13321350
}
@@ -4419,71 +4437,25 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
44194437
position: absolute;
44204438
}
44214439
4422-
#modalHolder,
4423-
.modalHolder {
4424-
position: absolute;
4425-
z-index: 0;
4426-
top: 0;
4427-
width: 100%;
4428-
height: 100%;
4429-
pointer-events: none;
4430-
}
4431-
4432-
#pageNav .modalHolder {
4433-
/* patch for the about modal. It should be moved to the baseModal view */
4434-
position: fixed;
4435-
z-index: 1;
4436-
top: 74px;
4437-
}
4438-
4439-
#messageModal {
4440-
z-index: 9;
4441-
}
4442-
4443-
#loadingModal {
4444-
padding-top: 0;
4445-
}
4446-
44474440
.page-connect-modal .spinner-with-logo {
44484441
margin-top: -45px;
44494442
}
44504443
4451-
#ov1 #loadingModal.hide {
4452-
height: 0; /* kludge to allow top bar to fade in. Transitions don't work if display is none */
4453-
padding: 0;
4454-
overflow: hidden;
4455-
display: block;
4456-
}
4457-
4458-
#loadingModal #loadingModalContent {
4444+
.loadingModal .loadingModalContent {
44594445
position: absolute;
44604446
right: 0;
44614447
left: 0;
44624448
top: 50%;
44634449
margin-top: 117px;
4464-
opacity: 1;
4450+
opacity: 0;
44654451
transition: opacity 1s 5s ease;
44664452
box-sizing: border-box;
44674453
padding: 9px;
44684454
text-align: center;
44694455
}
44704456
4471-
#loadingModal #loadingModalBtns {
4472-
opacity: 1;
4473-
transition: opacity 1s 5s ease;
4474-
/* this seems redundant, but if you don't also have a transition on the button container, for some reason the normal
4475-
background color will be used instead of the background color from the custCol-secondary class until the parent
4476-
transition is complete on Win64 10. */
4477-
}
4478-
4479-
#loadingModal.hide #loadingModalContent,
4480-
#loadingModal.hide #loadingModalBtns {
4481-
opacity: 0;
4482-
}
4483-
44844457
#ov1 .server-connect-modal .modal-child {
44854458
height: 625px;
4486-
overflow: hidden;
44874459
}
44884460
44894461
#ov1 .server-connect-modal .message-bar {
@@ -5427,6 +5399,10 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
54275399
margin-top: -8px;
54285400
}
54295401

5402+
#ov1 .marginTop0 {
5403+
margin-top: 0px;
5404+
}
5405+
54305406
#ov1 .marginTop1 {
54315407
margin-top: 1px;
54325408
}
@@ -6187,8 +6163,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
61876163
#ov1.minEffects #overlay,
61886164
#ov1.minEffects #sideBar,
61896165
#ov1.minEffects #pageNav,
6190-
#ov1.minEffects #modalHolder,
6191-
#ov1.minEffects #messageModal,
61926166
#ov1.minEffects #statusBar {
61936167
transition: none !important;
61946168
-webkit-filter: none !important;
@@ -6303,8 +6277,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
63036277
#ov1.minEffects #overlay .disabled,
63046278
#ov1.minEffects #sideBar .disabled,
63056279
#ov1.minEffects #pageNav .disabled,
6306-
#ov1.minEffects #modalHolder .disabled,
6307-
#ov1.minEffects #messageModal .disabled,
63086280
#ov1.minEffects #statusBar .disabled {
63096281
opacity: 0.2 !important;
63106282
}
@@ -6315,8 +6287,6 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
63156287
#ov1.minEffects #overlay .disabled2,
63166288
#ov1.minEffects #sideBar .disabled2,
63176289
#ov1.minEffects #pageNav .disabled2,
6318-
#ov1.minEffects #modalHolder .disabled2,
6319-
#ov1.minEffects #messageModal .disabled2,
63206290
#ov1.minEffects #statusBar .disabled2 {
63216291
opacity: 0.7 !important;
63226292
}
@@ -6326,27 +6296,12 @@ input[type="checkbox"].fieldItem:checked + label .togLabelOff {
63266296
}
63276297

63286298
/* add a shadow and a glow, so modal close buttons are still barely visible if the user picks a bad color */
6329-
#ov1 .js-closeIndexModal [class *= "ion-"]:before,
6330-
#ov1 #userPage .js-closeIndexModal [class *= "ion-"]:before,
6331-
#ov1 #obContainer .js-closeIndexModal [class *= "ion-"]:before,
6332-
#ov1 #modalHolder .js-closeIndexModal [class *= "ion-"]:before,
6333-
#ov1 #messageModal .js-closeIndexModal [class *= "ion-"]:before,
6334-
#ov1.minEffects .js-closeIndexModal [class *= "ion-"]:before,
6335-
#ov1.minEffects #userPage .js-closeIndexModal [class *= "ion-"]:before,
6336-
#ov1.minEffects #obContainer .js-closeIndexModal [class *= "ion-"]:before,
6337-
#ov1.minEffects #modalHolder .js-closeIndexModal [class *= "ion-"]:before,
6338-
#ov1.minEffects #messageModal .js-closeIndexModal [class *= "ion-"]:before,
63396299
#ov1 .js-modal-close [class *= "ion-"]:before,
63406300
#ov1 #userPage .js-modal-close [class *= "ion-"]:before,
63416301
#ov1 #obContainer .js-modal-close [class *= "ion-"]:before,
6342-
#ov1 #modalHolder .js-modal-close [class *= "ion-"]:before,
6343-
#ov1 #messageModal .js-modal-close [class *= "ion-"]:before,
63446302
#ov1.minEffects .js-modal-close [class *= "ion-"]:before,
63456303
#ov1.minEffects #userPage .js-modal-close [class *= "ion-"]:before,
6346-
#ov1.minEffects #obContainer .js-modal-close [class *= "ion-"]:before,
6347-
#ov1.minEffects #modalHolder .js-modal-close [class *= "ion-"]:before,
6348-
#ov1.minEffects #messageModal .js-modal-close [class *= "ion-"]:before,
6349-
#ov1 #modalHolder .js-closeBuyWizardModal [class *= "ion-"]:before {
6304+
#ov1.minEffects #obContainer .js-modal-close [class *= "ion-"]:before {
63506305
text-shadow: 0 0 1px rgba(0,0,0,1), 0 0 2px rgba(255,255,255, 1) !important;
63516306
}
63526307

index.html

Lines changed: 7 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
<div id="appBar" class="top0 alignCenter custCol-secondary"></div>
1818

1919
<div id="contentFrame">
20+
<!-- Overlay is used by pageNav drop down menus and should be here in the markup so that it
21+
properly obscures any open modals (without having to manage z-indexes). -->
22+
<div id="overlay" class="hide"></div>
2023

2124
<div id="navArea">
2225
<div id="pageNav" class="custCol-secondary"></div>
@@ -25,13 +28,11 @@
2528
<div id="contentArea">
2629
<div class="container custCol-background custCol-text" id="obContainer">
2730
<div id="content"></div>
28-
<div id="modalHolder">
29-
<!-- container for modal views -->
30-
</div>
3131
</div>
3232

3333
<div id="sideBar"></div>
3434

35+
3536
<div id="messageModal" class="modal modal-opaque js-messageModal hide">
3637
<!-- modal for messages -->
3738
<div class="modal-child modal-childMain color-primary custCol-secondary padding20 custCol-text">
@@ -52,25 +53,11 @@ <h2 class="ion-android-close custCol-text clickable"></h2>
5253
</div>
5354
</div>
5455
</div>
55-
56-
<div id="overlay" class="hide"></div>
56+
5757
<div id="statusBar"></div>
5858

5959
</div>
6060

61-
<div id="loadingModal" class="modal modal-opaque modal-fullscreen js-loadingModal hide">
62-
<div class="spinner-with-logo fullCentered">
63-
<i class="ion-android-sync spinner fontSize30 spinner-with-logo-icon"></i>
64-
</div>
65-
<div id="loadingModalContent">
66-
<p class="fontSize16 js-translate" data-translate="errorMessages.loadingViewError"></p>
67-
<div id="loadingModalBtns">
68-
<a class="btn btn-large marginRight10 custCol-secondary custCol-text js-indexReload"><i class="ion-android-sync"></i> <span class="js-translate" data-translate="Reload"></span></a>
69-
<a class="btn btn-large custCol-secondary custCol-text" href="#home"><i class="ion-eye"></i> <span class="js-translate" data-translate="LoadIndex"></span></a>
70-
</div>
71-
</div>
72-
</div>
73-
7461
</div>
7562

7663
</div>
@@ -80,38 +67,7 @@ <h2 class="ion-android-close custCol-text clickable"></h2>
8067

8168
<!--TODO: modularize non-modular scripts -->
8269
<script src="js/utils/list.min.js"></script>
83-
84-
<script>
85-
var app = require('./js/start');
86-
87-
window.translateIndex = function(){
88-
$('.js-translate').each(function() {
89-
$(this).text(polyglot.t($(this).data("translate")));
90-
});
91-
};
92-
translateIndex();
93-
$('.js-closeIndexModal').on('click', function(){
94-
$(this).closest('.modal').addClass('hide');
95-
});
96-
$('.js-closeIndexApp').on('click', function(){
97-
var win = remote.getCurrentWindow();
98-
var process = remote.process;
99-
if (process.platform != 'darwin') {
100-
win.close();
101-
} else {
102-
win.hide();
103-
}
104-
});
105-
$('.js-indexReload').on('click', function(){
106-
location.reload();
107-
});
108-
$('.js-newServerIndexApp').on('click', function(){
109-
var newServer = $('#indexNewServer').val();
110-
app.loadNewServer(newServer);
111-
});
112-
$('.js-defaultServerIndexApp').on('click', function(){
113-
app.loadNewServer("http://localhost:18469/api/v1/");
114-
});
115-
</script>
70+
71+
<script>require('./js/start')</script>
11672
</body>
11773
</html>

js/App.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict';
1+
'use strict';
22

33
var ipcRenderer = require('ipc-renderer'),
44
$ = require('jquery'),

js/languages/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@
560560
"refundAlreadySent": "The refund has already been successfully sent for this order",
561561
"serverTimeout": "No response was received from the server. It may be unreachable or taking a very long time to respond.",
562562
"noData": "No data is available for the options you have selected.",
563-
"loadingViewError": "Loading this page is taking longer than expected.",
563+
"loadingTakingTooLong": "Loading is taking longer than expected.",
564564
"smtpServerError": "SMTP Connection Error",
565565
"smtpServerSuccess": "SMTP Connection Success",
566566
"noSMTPConnection": "The connection to the SMTP server failed.",

js/router.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var ipcRenderer = require('ipc-renderer'),
55
Backbone = require('backbone'),
66
$ = require('jquery'),
77
app = require('./App').getApp(),
8-
messageModal = require('./utils/messageModal.js'),
98
homeView = require('./views/homeVw'),
109
userPageView = require('./views/userPageVw'),
1110
settingsView = require('./views/settingsVw'),
@@ -180,10 +179,10 @@ module.exports = Backbone.Router.extend({
180179
if (callback) callback.apply(this, args);
181180
},
182181

183-
cleanup: function(){
184-
$('#loadingModal').addClass('hide'); //hide modal if it is still visible
185-
messageModal.hide();
186-
$('#obContainer').removeClass('modalOpen innerModalOpen box-borderDashed noScrollBar overflowHidden');
182+
cleanup: function() {
183+
app.loadingModal.close();
184+
app.simpleMessageModal.close();
185+
$('#obContainer').removeClass('customizeUserPage box-borderDashed noScrollBar overflowHidden');
187186
window.obEventBus.trigger('cleanNav');
188187
},
189188

@@ -221,7 +220,6 @@ module.exports = Backbone.Router.extend({
221220

222221
$('body').attr('id', options.bodyID);
223222
$('body').attr('class', options.bodyClass);
224-
$('#obContainer').removeClass('customizeUserPage'); //remove customization styling if present
225223

226224
this.pageConnectModal && this.pageConnectModal.remove();
227225
this.pageConnectModal = null;
@@ -276,6 +274,8 @@ module.exports = Backbone.Router.extend({
276274
typeof loadingConfig.promise.then === 'function') {
277275
this.launchPageConnectModal(loadingConfig).done(() => {
278276
this.view.cacheExpires && this.cacheView(this.view);
277+
}).fail(() => {
278+
this.view.remove();
279279
});
280280
} else {
281281
this.view.cacheExpires && this.cacheView(this.view);
@@ -298,7 +298,6 @@ module.exports = Backbone.Router.extend({
298298
throw new Error('At a minimum, the config must contain a config.promise.');
299299
}
300300

301-
$('#loadingModal').addClass('hide');
302301
config = __.extend({}, defaults, config);
303302

304303
this.pageConnectModal && this.pageConnectModal.remove();

0 commit comments

Comments
 (0)