README.md 2.06 KB
Newer Older
Tomas Pettersson's avatar
Tomas Pettersson committed
1
# leaflet-navigation
Tomas Pettersson's avatar
Tomas Pettersson committed
2
3
4


## Description
Tomas Pettersson's avatar
Tomas Pettersson committed
5
A component used for navigation. Built with uikit.
Tomas Pettersson's avatar
Tomas Pettersson committed
6
7
8
9
10
11
12
13
14

![](image.png)


## Installation

You will need node.js, npm and bower for demo

### bower
Tomas Pettersson's avatar
Tomas Pettersson committed
15
`bower install https://git.smhi.se/stw/leaflet-navigation.git --save`
Tomas Pettersson's avatar
Tomas Pettersson committed
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

## Demo

Go to demo folder and install package.json

	> npm install

Start server in demo folder

	> node server.js
	Server started on http://localhost:8080...

Open browser on http://localhost:8080/demo

## Usage example


Tomas Pettersson's avatar
Tomas Pettersson committed
33
34
35
36
37
38
39
40
		var map = L.map('map').setView([ 58.5, 19.0 ], 5);
		L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
			maxZoom : 18,
			attribution : '&copy; <a href="http://www.openstreetmap.org/copyright" target="_blank">OpenStreetMap</a> contributors</a>'
		}).addTo(map);

		var hash = new L.Hash(map);

Tomas Pettersson's avatar
Tomas Pettersson committed
41
42
43
		var language = 'en';

        var navLangData = {
Tomas Pettersson's avatar
Tomas Pettersson committed
44
45
46
        	"tTitle": "Navigation",
					"tLogin" : "Login",
					"tLogout" : "Logout"
Tomas Pettersson's avatar
Tomas Pettersson committed
47
48
        };

Pettersson Tomas's avatar
help    
Pettersson Tomas committed
49
        var navControl = new Navigation("navigation", {
Tomas Pettersson's avatar
Tomas Pettersson committed
50
			"user" : {
Tomas Pettersson's avatar
Tomas Pettersson committed
51
52
				"url" : "/demo", 
				"access" : "test"
Tomas Pettersson's avatar
Tomas Pettersson committed
53
54
55
56
57
58
			},
			"navigation": {
				"Link1" : "path",
				"Link2" : "path",
				"Link3" : "path"
			},
Tomas Pettersson's avatar
Tomas Pettersson committed
59
60
61
62
63
64
65
			"position": {
				"map" : map
			},
			"title" : {true,
			"search" : {
				"url" : "search"
			},
Tomas Pettersson's avatar
help    
Tomas Pettersson committed
66
			"help" : {
Tomas Pettersson's avatar
Tomas Pettersson committed
67
68
69
				"classic" : {
					"id" : "introduction"
				},
Tomas Pettersson's avatar
help    
Tomas Pettersson committed
70
				"guide" : false,
Tomas Pettersson's avatar
Tomas Pettersson committed
71
72
73
				"indepth" : {
					"id" : "kde" 
				}
Tomas Pettersson's avatar
Tomas Pettersson committed
74
75
			},
			"language" : true,
Tomas Pettersson's avatar
Tomas Pettersson committed
76
   			"lang" : language,
Tomas Pettersson's avatar
Tomas Pettersson committed
77
   			"langdata" : navLangData
Tomas Pettersson's avatar
Tomas Pettersson committed
78
        });;
Tomas Pettersson's avatar
Tomas Pettersson committed
79

Tomas Pettersson's avatar
Tomas Pettersson committed
80
81
82

### Options

Tomas Pettersson's avatar
Tomas Pettersson committed
83
84
85
86
87
88
89
90
91
| Option       | Default    | Description |
| -------------|------------|-------------|
| `user`  | false   | activates the user link |
| `help`  | false   | activates the help link |
| `title`  | true   | shows a title |
| `language`  | false   | activates the language link |
| `search`  | null   | activates the search link |
| `position`  | null   | activates the position link |
| `navigation`  | null   | activates the navigation link |
Tomas Pettersson's avatar
Tomas Pettersson committed
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

## Copyright and License

## Contact information

Tomas Pettersson tomas.pettersson@smhi.se


## Credits and acknowledgements


## Known bugs

## Troubleshooting

## Changelog