Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 2.3 into 2.4 #4913

Merged
merged 20 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions examples/offline.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#map {
width: 600px;
height: 400px;
position: relative;
}
ngeo-offline div {
z-index: 1;
}
ngeo-offline .main-button {
position: absolute;
right: 1rem;
bottom: 5rem;
cursor: pointer;
}
ngeo-offline .main-button .no-data {
color: black;
}
ngeo-offline .main-button .with-data {
color: red;
}
ngeo-offline .main-button .no-data,
ngeo-offline .main-button .with-data {
background-color: white;
text-align: center;
font-size: 2.5rem;
line-height: 2rem;
border-radius: 2rem;
font-family: FontAwesome;
}

ngeo-offline .validate-extent {
position: absolute;
bottom: 0.5rem;
width: 10rem;
left: calc(50% - 5rem);
}
ngeo-offline .in-progress {
position: absolute;
left: calc(50% - 3.3rem);
top: calc(50% - 3rem);
color: white;
font-weight: bold;
background-color: #337ab7;
padding: 2rem 2rem;
border-radius: 1rem;
}
ngeo-offline .modal-content {
width: 30rem;
}
ngeo-offline .modal-body button {
display: block;
margin: 0.5rem auto;
width: 25rem;
}
.offline-msg {
display: none;
}
.offline .offline-msg {
display: block;
}
1 change: 0 additions & 1 deletion examples/offline.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<meta name="viewport"
content="initial-scale=1.0, user-scalable=no, width=device-width">
<meta name="mobile-web-app-capable" content="yes">
<script src="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.7.3/localforage.min.js"></script>
</head>
<body ng-controller="MainController as ctrl" ng-class="{offline: ctrl.ngeoNetworkStatus.isDisconnected()}">
<div class="offline-msg alert-danger" translate>You are currently offline.</div>
Expand Down
8 changes: 2 additions & 6 deletions examples/offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/
const exports = {};

import './offline.less';
import '@fortawesome/fontawesome-free/css/fontawesome.min.css';
import './offline.css';
import './common_dependencies.js';
import olMap from 'ol/Map.js';

Expand All @@ -17,11 +18,6 @@ import NgeoOfflineServiceManager from 'ngeo/offline/ServiceManager.js';
import angular from 'angular';


// Useful to work on example - remove me later
import 'bootstrap/js/modal.js';
import 'jquery-ui/ui/widgets/resizable.js';
import 'jquery-ui/ui/widgets/draggable.js';

/** @type {!angular.IModule} **/
exports.module = angular.module('app', [
'gettext',
Expand Down
74 changes: 0 additions & 74 deletions examples/offline.less

This file was deleted.

17 changes: 9 additions & 8 deletions src/offline/NetworkStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ const Service = class {
});

// We catch every $.ajax request errors or (canceled request).
this.$document_.ajaxError((evt, jqxhr, settings, thrownError) => {
// Filter out canceled requests
if (!/^(canceled|abort)$/.test(thrownError)) {
this.check(2000);
}
});

if (this.$document_['ajaxError']) {
this.$document_['ajaxError']((evt, jqxhr, settings, thrownError) => {
// Filter out canceled requests
if (!/^(canceled|abort)$/.test(thrownError)) {
this.check(2000);
}
});
}
}

/**
Expand Down Expand Up @@ -173,7 +174,7 @@ Service.module.service(name, Service);
/**
* @ngInject
* @param {angular.IQService} $q The Angular $q service.
* @param {ngeoMiscDebounce} ngeoDebounce ngeo debounce service.
* @param {import("ngeo/misc/debounce.js").miscDebounce<function()>} ngeoDebounce ngeo debounce service.
* @param {Service} ngeoNetworkStatus ngeo network status service.
* @return {angular.IHttpInterceptor} the interceptor
*/
Expand Down
2 changes: 1 addition & 1 deletion src/offline/ServiceManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ServiceManager {
}

ServiceManager.module = angular.module('ngeoOfflineServiceManager', []);
ServiceManager.module.service('ngeoOfflineServiceManager', exports);
ServiceManager.module.service('ngeoOfflineServiceManager', ServiceManager);


export default ServiceManager;
4 changes: 2 additions & 2 deletions src/offline/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ module.value('ngeoOfflineTemplateUrl',
});

module.run(/* @ngInject */ ($templateCache) => {
const html = require('./component.html');
$templateCache.put('ngeo/offline/component.html', html);
// @ts-ignore: webpack
$templateCache.put('ngeo/offline/component.html', require('../offline/'));
gberaudo marked this conversation as resolved.
Show resolved Hide resolved
});

/**
Expand Down
2 changes: 0 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,3 @@ export function extentToRectangle(extent) {
];
return result;
}

export default exports;