Mercurial > gemma
annotate client/src/main.js @ 1673:7e3a705f520a
fix broken refac
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Mon, 24 Dec 2018 14:57:18 +0100 |
parents | 5af8c82c3d21 |
children | b38a71d1c08a |
rev | line source |
---|---|
1243
24797f66f268
Client: remove (minor) superfluous things
Bernhard Reiter <bernhard@intevation.de>
parents:
1163
diff
changeset
|
1 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
2 * without warranty, see README.md and license for details. |
1243
24797f66f268
Client: remove (minor) superfluous things
Bernhard Reiter <bernhard@intevation.de>
parents:
1163
diff
changeset
|
3 * |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
4 * SPDX-License-Identifier: AGPL-3.0-or-later |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
5 * License-Filename: LICENSES/AGPL-3.0.txt |
1243
24797f66f268
Client: remove (minor) superfluous things
Bernhard Reiter <bernhard@intevation.de>
parents:
1163
diff
changeset
|
6 * |
1363 | 7 * Copyright (C) 2018 by via donau |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
8 * – Österreichische Wasserstraßen-Gesellschaft mbH |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
9 * Software engineering by Intevation GmbH |
1243
24797f66f268
Client: remove (minor) superfluous things
Bernhard Reiter <bernhard@intevation.de>
parents:
1163
diff
changeset
|
10 * |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
11 * Author(s): |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
12 * Thomas Junk <thomas.junk@intevation.de> |
1363 | 13 * Markus Kottländer <markus@intevation.de> |
1019
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
14 */ |
ca628dce90dd
Licensing information added
Thomas Junk <thomas.junk@intevation.de>
parents:
880
diff
changeset
|
15 |
3 | 16 import Vue from "vue"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
1243
diff
changeset
|
17 import App from "./components/App.vue"; |
3 | 18 import router from "./router"; |
19 import store from "./store"; | |
141 | 20 import GetTextPlugin from "vue-gettext"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
1243
diff
changeset
|
21 import translations from "./locale/translations.json"; |
159
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
22 import locale2 from "locale2"; |
1368
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
23 import Snotify, { SnotifyPosition } from "vue-snotify"; |
159
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
24 import "../node_modules/bootstrap/dist/css/bootstrap.min.css"; |
428
d7a06b9fffc9
feat: Usability for usermanagement improved.
Thomas Junk <thomas.junk@intevation.de>
parents:
375
diff
changeset
|
25 import "../node_modules/animate.css/animate.min.css"; |
159
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
26 import "../node_modules/ol/ol.css"; |
713
badbc0207418
feat: systeminformation feature added
Thomas Junk <thomas.junk@intevation.de>
parents:
565
diff
changeset
|
27 import "../node_modules/highlight.js/styles/paraiso-dark.css"; |
1368
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
28 import "../node_modules/vue-snotify/styles/material.css"; |
1163
fb5c83d4ea1d
added copy coordinates button to fairway profile
Markus Kottlaender <markus@intevation.de>
parents:
1097
diff
changeset
|
29 import VueClipboard from "vue-clipboard2"; |
1097
874d19f32015
added fontawesome5 and implemented one example icon on login screen
Markus Kottlaender <markus@intevation.de>
parents:
1019
diff
changeset
|
30 |
1532
44e094330272
automatic imports: fields added
Thomas Junk <thomas.junk@intevation.de>
parents:
1526
diff
changeset
|
31 import ToggleButton from "vue-js-toggle-button"; |
1549
b03db5726ca5
importqueue detail view
Thomas Junk <thomas.junk@intevation.de>
parents:
1543
diff
changeset
|
32 |
1532
44e094330272
automatic imports: fields added
Thomas Junk <thomas.junk@intevation.de>
parents:
1526
diff
changeset
|
33 Vue.use(ToggleButton); |
44e094330272
automatic imports: fields added
Thomas Junk <thomas.junk@intevation.de>
parents:
1526
diff
changeset
|
34 |
1368
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
35 const options = { |
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
36 toast: { |
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
37 position: SnotifyPosition.centerBottom |
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
38 } |
295
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
159
diff
changeset
|
39 }; |
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
159
diff
changeset
|
40 |
1368
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
41 Vue.use(Snotify, options); |
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
42 |
d1d8c7bd16a1
switched from vue2-toastr to vue-snotify
Thomas Junk <thomas.junk@intevation.de>
parents:
1363
diff
changeset
|
43 Vue.use(VueClipboard); |
141 | 44 |
159
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
45 let browserLanguage = locale2; |
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
46 |
1526
4f62e2610740
Translation: improve language detection code and correct language name
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1506
diff
changeset
|
47 // planned also RS, BiH, UA |
159
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
48 const supportedLanguages = { |
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
49 en_GB: "British English", |
1456
dadf309eec51
translations: add language Solvak
Bernhard Reiter <bernhard@intevation.de>
parents:
1429
diff
changeset
|
50 de_AT: "Deutsch", |
1506
bf32ef5dfb04
Translation: add aditional languages for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1491
diff
changeset
|
51 sk_SK: "slovenčina", |
1526
4f62e2610740
Translation: improve language detection code and correct language name
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1506
diff
changeset
|
52 hu_HU: "Magyar", |
1506
bf32ef5dfb04
Translation: add aditional languages for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1491
diff
changeset
|
53 hr_HR: "Hrvatska", |
bf32ef5dfb04
Translation: add aditional languages for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1491
diff
changeset
|
54 bg_BG: "български", |
bf32ef5dfb04
Translation: add aditional languages for translation
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1491
diff
changeset
|
55 ro_RO: "Română" |
159
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
56 }; |
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
57 |
1543
240bd1db49c0
Translation: improve language detection code
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1532
diff
changeset
|
58 let isAvailableLanguage = Object.keys(supportedLanguages).filter(language => { |
240bd1db49c0
Translation: improve language detection code
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1532
diff
changeset
|
59 return browserLanguage.replace("-", "_") === language; |
1526
4f62e2610740
Translation: improve language detection code and correct language name
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1506
diff
changeset
|
60 }); |
1456
dadf309eec51
translations: add language Solvak
Bernhard Reiter <bernhard@intevation.de>
parents:
1429
diff
changeset
|
61 |
1543
240bd1db49c0
Translation: improve language detection code
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1532
diff
changeset
|
62 if (isAvailableLanguage.length === 0) { |
240bd1db49c0
Translation: improve language detection code
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1532
diff
changeset
|
63 isAvailableLanguage = Object.keys(supportedLanguages).filter(language => { |
240bd1db49c0
Translation: improve language detection code
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1532
diff
changeset
|
64 return language.substr(0, 2) === browserLanguage.substr(0, 2); |
240bd1db49c0
Translation: improve language detection code
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1532
diff
changeset
|
65 }); |
240bd1db49c0
Translation: improve language detection code
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1532
diff
changeset
|
66 } |
240bd1db49c0
Translation: improve language detection code
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1532
diff
changeset
|
67 |
1526
4f62e2610740
Translation: improve language detection code and correct language name
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1506
diff
changeset
|
68 let defaultLanguage = |
4f62e2610740
Translation: improve language detection code and correct language name
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1506
diff
changeset
|
69 isAvailableLanguage.length > 0 ? isAvailableLanguage[0] : "en_GB"; |
141 | 70 |
71 Vue.use(GetTextPlugin, { | |
72 translations: translations, | |
159
3d9341f6da4e
feat: Locale of browser determines the default language
Thomas Junk <thomas.junk@intevation.de>
parents:
141
diff
changeset
|
73 availableLanguages: supportedLanguages, |
141 | 74 defaultLanguage: defaultLanguage |
75 }); | |
76 | |
3 | 77 Vue.config.productionTip = false; |
1672
5af8c82c3d21
refac: improved bundle-size
Thomas Junk <thomas.junk@intevation.de>
parents:
1610
diff
changeset
|
78 let app; |
1673 | 79 import("./fontawesome").then(() => { |
1672
5af8c82c3d21
refac: improved bundle-size
Thomas Junk <thomas.junk@intevation.de>
parents:
1610
diff
changeset
|
80 app = new Vue({ |
5af8c82c3d21
refac: improved bundle-size
Thomas Junk <thomas.junk@intevation.de>
parents:
1610
diff
changeset
|
81 router, |
5af8c82c3d21
refac: improved bundle-size
Thomas Junk <thomas.junk@intevation.de>
parents:
1610
diff
changeset
|
82 store, |
5af8c82c3d21
refac: improved bundle-size
Thomas Junk <thomas.junk@intevation.de>
parents:
1610
diff
changeset
|
83 render: h => h(App) |
5af8c82c3d21
refac: improved bundle-size
Thomas Junk <thomas.junk@intevation.de>
parents:
1610
diff
changeset
|
84 }).$mount("#app"); |
5af8c82c3d21
refac: improved bundle-size
Thomas Junk <thomas.junk@intevation.de>
parents:
1610
diff
changeset
|
85 }); |
295
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
159
diff
changeset
|
86 |
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
159
diff
changeset
|
87 export default app; |