Skip to content

Commit b12fd8a

Browse files
committed
Added shadow icon in configuration.
1 parent 7912d85 commit b12fd8a

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

users/config.py.prod

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,11 @@ MAIL_ADMIN = ('InaSAFE User Map Administrator', MAIL_CONFIG['MAIL_USERNAME'])
3333

3434
# USER ICONS: All icon paths that are used.
3535
# For now, there are only 3 icons that should be configured: user, trainer,
36-
# developer. Next time, we can be more flexible about this (the role)
36+
# developer. And used the same shadow for all of the icons. Next time,
37+
# we can be more flexible about this (the role)
3738
USER_ICONS = dict(
3839
user='/static/img/user-icon.png',
3940
trainer='/static/img/trainer-icon.png',
40-
developer='/static/img/developer-icon.png'
41+
developer='/static/img/developer-icon.png',
42+
shadow='/static/img/shadow-icon.png'
4143
)

users/config.py.test

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ MAIL_ADMIN = ('InaSAFE User Map Administrator', MAIL_CONFIG['MAIL_USERNAME'])
3434

3535
# USER ICONS: All icon paths that are used.
3636
# For now, there are only 3 icons that should be configured: user, trainer,
37-
# developer. Next time, we can be more flexible about this (the role)
37+
# developer. And used the same shadow for all of the icons. Next time,
38+
# we can be more flexible about this (the role)
3839
USER_ICONS = dict(
3940
user='/static/img/user-icon.png',
4041
trainer='/static/img/trainer-icon.png',
41-
developer='/static/img/developer-icon.png'
42+
developer='/static/img/developer-icon.png',
43+
shadow='/static/img/shadow-icon.png'
4244
)

users/static/js/user-map-component.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ function createBasemap() {
2323

2424
/**
2525
* Create IconMarkerBase that will be used for icon marker.
26+
* @param {string} shadow_icon_path The path to shadow icon.
2627
* @returns {object} IconMarkerBase
2728
* @property Icon
2829
*/
29-
function createIconMarkerBase() {
30+
function createIconMarkerBase(shadow_icon_path) {
3031
var IconMarkerBase;
3132
IconMarkerBase = L.Icon.extend({
3233
options: {
33-
shadowUrl: '/static/img/shadow-icon.png',
34+
shadowUrl: shadow_icon_path,
3435
iconSize: [19, 32],
3536
shadowSize: [42, 35],
3637
iconAnchor: [12, 32],
@@ -46,10 +47,11 @@ function createIconMarkerBase() {
4647
* @param {string} user_icon_path The icon path for user role.
4748
* @param {string} trainer_icon_path The icon path for trainer role.
4849
* @param {string} developer_icon_path The icon path for developer role.
50+
* @param {string} shadow_icon_path The shadow for all icons.
4951
* @returns {{user_icon: IconMarkerBase, trainer_icon: IconMarkerBase, developer_icon: IconMarkerBase}}
5052
*/
51-
function createAllIcons(user_icon_path, trainer_icon_path, developer_icon_path) {
52-
var IconMarkerBase = createIconMarkerBase();
53+
function createAllIcons(user_icon_path, trainer_icon_path, developer_icon_path, shadow_icon_path) {
54+
var IconMarkerBase = createIconMarkerBase(shadow_icon_path);
5355
var user_icon = new IconMarkerBase({iconUrl: user_icon_path});
5456
var trainer_icon = new IconMarkerBase({iconUrl: trainer_icon_path});
5557
var developer_icon = new IconMarkerBase({iconUrl: developer_icon_path});
@@ -246,7 +248,7 @@ function onMapClick(e) {
246248
var user = {
247249
'latitude': markerLocation.lat.toFixed(8),
248250
'longitude': markerLocation.lng.toFixed(8)
249-
}
251+
};
250252
var popup = getUserFormPopup(user, ADD_USER_MODE);
251253
marker_new_user.bindPopup(popup).openPopup()
252254
}

users/templates/html/base.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@
7272
var icons = createAllIcons(
7373
'{{ user_icons.user }}',
7474
'{{ user_icons.trainer }}',
75-
'{{ user_icons.developer }}'
75+
'{{ user_icons.developer }}',
76+
'{{ user_icons.shadow }}'
7677
);
7778
user_icon = icons.user_icon;
7879
trainer_icon = icons.trainer_icon;

0 commit comments

Comments
 (0)