Skip to content

Commit 3c36c32

Browse files
authored
Merge pull request #9454 from camptocamp/template-GSNGEO-13
Update AngularJS partials importation, Remove SVG build-time modifications
2 parents 8a91bb7 + c1c5c5a commit 3c36c32

File tree

149 files changed

+17129
-10732
lines changed

Some content is hidden

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

149 files changed

+17129
-10732
lines changed

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
*.min.js
22
contribs/gmf/apps/*/index.html.ejs
3-
src/bootstrap-custom.css
43
# New line brake the i18n
54
src/query/panelComponent.html

buildtools/svg-viewbox-loader.js renamed to buildtools/svg-viewbox-cmd.js

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,21 @@
2020
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2121

2222
/**
23-
* Webpack loader to be used after `svg-inline-loader`.
24-
*
2523
* It will:
2624
* - Fill the `viewBox` if it's missing (to be able to change the `width` and the `height`).
2725
* - Fill the `width` and `height` (required by OpenLayers).
2826
* - Allows to change the `width` and `height` (with `width` or `height` arguments).
2927
* - Remove the unneeded `x` and `y` property.
30-
*
31-
* See also the `svg` example.
3228
*/
3329

3430
const simpleHTMLTokenizer = require('simple-html-tokenizer');
3531
const querystring = require('querystring');
3632
const generate = require('./generate-xml-from-tokens.js');
3733
const parseUnit = require('parse-absolute-css-unit');
34+
const {program} = require('commander');
35+
const fs = require('fs');
3836

39-
module.exports = function (source) {
40-
this.cacheable(true);
37+
function process(source, resourceQuery) {
4138
let tokens = simpleHTMLTokenizer.tokenize(source);
4239

4340
tokens = tokens.map((tag) => {
@@ -86,9 +83,7 @@ module.exports = function (source) {
8683
if (viewBox === undefined) {
8784
tag.attributes.push(['viewBox', `0 0 ${width} ${height}`, true]);
8885
}
89-
const queryString = this.resourceQuery.startsWith('?')
90-
? this.resourceQuery.substring(1)
91-
: this.resourceQuery;
86+
const queryString = resourceQuery.startsWith('?') ? resourceQuery.substring(1) : resourceQuery;
9287
const query = querystring.decode(queryString);
9388
if (query.width !== undefined) {
9489
const parsed = query.width.match(/^([0-9]+)([a-z]*)$/);
@@ -108,4 +103,20 @@ module.exports = function (source) {
108103
});
109104

110105
return generate(tokens);
111-
};
106+
}
107+
108+
function main(args) {
109+
const uri = args[0];
110+
const resourceQuery = args[1];
111+
const source = fs.readFileSync(uri, 'utf-8');
112+
const result = process(source, resourceQuery);
113+
fs.writeFileSync(uri, result, 'utf-8');
114+
}
115+
116+
// If running this module directly then call the main function.
117+
if (require.main === module) {
118+
program.parse(process.argv);
119+
main(program.args);
120+
}
121+
122+
module.exports = main;

buildtools/webpack.commons.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,6 @@ module.exports = function (config) {
223223
if (file.endsWith('node_modules/@fortawesome/fontawesome-free/css/all.min.css')) {
224224
return false;
225225
}
226-
if (file.endsWith('src/bootstrap-custom.css')) {
227-
return false;
228-
}
229226
if (file.endsWith('/src/css/reset.css')) {
230227
return false;
231228
}

buildtools/webpack.dev.js

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -38,44 +38,15 @@ const resourcesRule = {
3838

3939
const svgRule = {
4040
test: /\.svg$/,
41-
oneOf: [
42-
{
43-
resourceQuery: /url/,
44-
use: [
45-
{
46-
loader: 'file-loader',
47-
options: {
48-
esModule: false,
49-
name: '[name].[ext]',
50-
},
51-
},
52-
'svgo-loader',
53-
],
54-
},
55-
{
56-
resourceQuery: /viewbox/,
57-
use: [
58-
{
59-
loader: 'svg-inline-loader',
60-
options: {
61-
removeSVGTagAttrs: false,
62-
},
63-
},
64-
'./buildtools/svg-viewbox-loader',
65-
'svgo-loader',
66-
],
67-
},
41+
use: [
6842
{
69-
use: [
70-
{
71-
loader: 'svg-inline-loader',
72-
options: {
73-
removeSVGTagAttrs: false,
74-
},
75-
},
76-
'svgo-loader',
77-
],
43+
loader: 'file-loader',
44+
options: {
45+
esModule: false,
46+
name: '[name].[ext]',
47+
},
7848
},
49+
'svgo-loader',
7950
],
8051
};
8152

buildtools/webpack.prod.js

Lines changed: 7 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -37,44 +37,15 @@ const resourcesRule = {
3737

3838
const svgRule = {
3939
test: /\.svg$/,
40-
oneOf: [
41-
{
42-
resourceQuery: /url/,
43-
use: [
44-
{
45-
loader: 'file-loader',
46-
options: {
47-
esModule: false,
48-
name: '[name].[hash:6].[ext]',
49-
},
50-
},
51-
'svgo-loader',
52-
],
53-
},
54-
{
55-
resourceQuery: /viewbox/,
56-
use: [
57-
{
58-
loader: 'svg-inline-loader',
59-
options: {
60-
removeSVGTagAttrs: false,
61-
},
62-
},
63-
'./buildtools/svg-viewbox-loader',
64-
'svgo-loader',
65-
],
66-
},
40+
use: [
6741
{
68-
use: [
69-
{
70-
loader: 'svg-inline-loader',
71-
options: {
72-
removeSVGTagAttrs: false,
73-
},
74-
},
75-
'svgo-loader',
76-
],
42+
loader: 'file-loader',
43+
options: {
44+
esModule: false,
45+
name: '[name].[hash:6].[ext]',
46+
},
7747
},
48+
'svgo-loader',
7849
],
7950
};
8051

contribs/gmf/apps/desktop/index.html.ejs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
</head>
1414
<body ng-class="{'gmf-profile-chart-active': !!profileChartActive, 'gmf-query-grid-active': !!mainCtrl.queryGridActive}" ng-keydown="mainCtrl.onKeydown($event)" tabindex="0">
1515
<div ng-show="mainCtrl.loading" class="loading-mask">
16-
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask">
17-
<%=require('gmf/icons/spinner.svg?viewbox&height=1em')%>
18-
</i>
16+
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="1em" height="1em"><circle cx="256" cy="48" r="48" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="109.17" cy="108.313" r="43" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="46.537" cy="257.328" r="38" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="108.028" cy="403.972" r="33" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="255.794" cy="463.935" r="28" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="402.894" cy="402.936" r="23" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="463.623" cy="256.106" r="18" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></svg></i>
1917
</div>
2018
<gmf-header gmf-header-template-url="desktop/header.html"></gmf-header>
2119
<main>

contribs/gmf/apps/desktop_alt/index.html.ejs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
</head>
1414
<body ng-keydown="mainCtrl.onKeydown($event)" tabindex="0">
1515
<div ng-show="mainCtrl.loading" class="loading-mask">
16-
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask">
17-
<%=require('gmf/icons/spinner.svg?viewbox&height=1em')%>
18-
</i>
16+
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="1em" height="1em"><circle cx="256" cy="48" r="48" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="109.17" cy="108.313" r="43" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="46.537" cy="257.328" r="38" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="108.028" cy="403.972" r="33" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="255.794" cy="463.935" r="28" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="402.894" cy="402.936" r="23" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="463.623" cy="256.106" r="18" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></svg></i>
1917
</div>
2018
<gmf-desktop-canvas>
2119
<div slot="header" class="logo">
@@ -240,7 +238,7 @@
240238
<div class="gmf-app-tools-content-heading">
241239
{{ 'Selection' | translate }}
242240
</div>
243-
<ngeo-query-panel></ngeo-query-panel class="pointer-events-auto">
241+
<ngeo-query-panel></ngeo-query-panel>
244242
</div>
245243
</div>
246244

contribs/gmf/apps/iframe_api/index.html.ejs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
</head>
1414
<body>
1515
<div ng-show="mainCtrl.loading" class="loading-mask">
16-
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask">
17-
<%=require('gmf/icons/spinner.svg?viewbox&height=1em')%>
18-
</i>
16+
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="1em" height="1em"><circle cx="256" cy="48" r="48" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="109.17" cy="108.313" r="43" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="46.537" cy="257.328" r="38" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="108.028" cy="403.972" r="33" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="255.794" cy="463.935" r="28" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="402.894" cy="402.936" r="23" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="463.623" cy="256.106" r="18" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></svg></i>
1917
</div>
2018
<main>
2119
<div class="gmf-app-map-container" ng-class="{'gmf-app-infobar-active': mainCtrl.options.showInfobar}">

contribs/gmf/apps/mobile/index.html.ejs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
'gmf-mobile-nav-left-is-visible': mainCtrl.leftNavVisible,
1919
'gmf-mobile-nav-right-is-visible': mainCtrl.rightNavVisible}">
2020
<div ng-show="mainCtrl.loading" class="loading-mask">
21-
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask">
22-
<%=require('gmf/icons/spinner.svg?viewbox&height=1em')%>
23-
</i>
21+
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="1em" height="1em"><circle cx="256" cy="48" r="48" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="109.17" cy="108.313" r="43" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="46.537" cy="257.328" r="38" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="108.028" cy="403.972" r="33" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="255.794" cy="463.935" r="28" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="402.894" cy="402.936" r="23" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="463.623" cy="256.106" r="18" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></svg></i>
2422
</div>
2523
<main ng-class="{'gmf-search-is-active': mainCtrl.searchOverlayVisible}">
2624
<gmf-map
@@ -56,9 +54,7 @@
5654
gmf-mobile-measurepoint-map="::mainCtrl.map">
5755
</div>
5856
<button class="gmf-mobile-nav-trigger gmf-mobile-nav-left-trigger"
59-
ng-click="mainCtrl.toggleLeftNavVisibility()">
60-
<%=require('gmf/icons/layers.svg')%>
61-
</button>
57+
ng-click="mainCtrl.toggleLeftNavVisibility()"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M19.984 6.256 10 1.264.016 6.256 10 11.248zM10 2.921l6.67 3.335L10 9.591 3.33 6.256zM17.984 9l2 .999L10 14.992.016 10l2-1L10 12.992Zm0 3.743 2 1L10 18.736.016 13.744l2-1L10 16.736Z"/></svg></button>
6258
<gmf-search gmf-search-map="::mainCtrl.map"
6359
gmf-search-listeners="::mainCtrl.searchListeners">
6460
</gmf-search>

contribs/gmf/apps/mobile_alt/index.html.ejs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
'gmf-mobile-nav-left-is-visible': mainCtrl.leftNavVisible,
1919
'gmf-mobile-nav-right-is-visible': mainCtrl.rightNavVisible}">
2020
<div ng-show="mainCtrl.loading" class="loading-mask">
21-
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask">
22-
<%=require('gmf/icons/spinner.svg?viewbox&height=1em')%>
23-
</i>
21+
<i class="fa custom-spinner-loading fa-spin spinner-loading-mask"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="1em" height="1em"><circle cx="256" cy="48" r="48" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="109.17" cy="108.313" r="43" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="46.537" cy="257.328" r="38" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="108.028" cy="403.972" r="33" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="255.794" cy="463.935" r="28" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="402.894" cy="402.936" r="23" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><circle cx="463.623" cy="256.106" r="18" style="opacity:1;fill-opacity:1;stroke:#000;stroke-width:0;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></svg></i>
2422
</div>
2523
<main ng-class="{'gmf-search-is-active': mainCtrl.searchOverlayVisible}">
2624
<gmf-map
@@ -50,9 +48,7 @@
5048
gmf-mobile-measurepoint-map="::mainCtrl.map">
5149
</div>
5250
<button class="gmf-mobile-nav-trigger gmf-mobile-nav-left-trigger"
53-
ng-click="mainCtrl.toggleLeftNavVisibility()">
54-
<%=require('gmf/icons/layers.svg')%>
55-
</button>
51+
ng-click="mainCtrl.toggleLeftNavVisibility()"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M19.984 6.256 10 1.264.016 6.256 10 11.248zM10 2.921l6.67 3.335L10 9.591 3.33 6.256zM17.984 9l2 .999L10 14.992.016 10l2-1L10 12.992Zm0 3.743 2 1L10 18.736.016 13.744l2-1L10 16.736Z"/></svg></button>
5652
<gmf-search gmf-search-map="::mainCtrl.map"
5753
gmf-search-listeners="::mainCtrl.searchListeners">
5854
</gmf-search>

0 commit comments

Comments
 (0)