#62 Add moar contribution types

Ouvert
alexAubin veut fusionner 1 commits à partir de alexAubin/moar-contrib-types vers FFDN/master

+ 6 - 2
wifiwithme/apps/contribmap/models.py

@@ -33,6 +33,8 @@ class ContribQuerySet(models.query.QuerySet):
 class Contrib(models.Model):
     CONTRIB_CONNECT = 'connect'
     CONTRIB_SHARE = 'share'
+    CONTRIB_ANY = 'any'
+    CONTRIB_POINTOFINTEREST = 'pointofinterest'
 
     id = models.AutoField(primary_key=True, blank=False, null=False)
     name = models.CharField(
@@ -40,9 +42,11 @@ class Contrib(models.Model):
         max_length=30)
     contrib_type = models.CharField(
         'Type de contribution',
-        max_length=10, choices=(
+        max_length=15, choices=(
             (CONTRIB_CONNECT, 'Me raccorder à internet'),
-            (CONTRIB_SHARE, 'Partager une partie de ma connexion')
+            (CONTRIB_SHARE, 'Partager une partie de ma connexion'),
+            (CONTRIB_ANY, 'Me raccorder ou partager ma connexion'),
+            (CONTRIB_POINTOFINTEREST, 'Ajouter un point qui serait stratégique (e.g. point en hauteur)')
         ), default=None)
     latitude = models.FloatField()
     longitude = models.FloatField()

+ 3 - 1
wifiwithme/apps/contribmap/templates/contribmap/map.html

@@ -15,7 +15,9 @@
 <script src="{% static 'map.js' %}" type="text/javascript"></script>
 <p>Légende : <br />
   <img src="{% static 'leaflet/images/marker-icon-red.png' %}" /> Personne souhaitant partager sa connexion Internet<br />
-  <img src="{% static 'leaflet/images/marker-icon.png' %}" /> Personne souhaitant se connecter au réseau radio
+  <img src="{% static 'leaflet/images/marker-icon.png' %}" /> Personne souhaitant se connecter au réseau radio<br />
+  <img src="{% static 'leaflet/images/marker-icon-purple.png' %}" /> Personne souhaitant se connecter ou partager sa connexion<br />
+  <img src="{% static 'leaflet/images/marker-icon-yellow.png' %}" /> Point stratégique à prospecter (e.g. point en hauteur)
 </p>
 <p>
   Télécharger le fichier <a href="{% url 'public_json' %}">GeoJSON</a>

BIN
wifiwithme/static/leaflet/images/marker-icon-purple.png


BIN
wifiwithme/static/leaflet/images/marker-icon-yellow.png


+ 21 - 2
wifiwithme/static/map.js

@@ -15,7 +15,6 @@ $( document ).ready(function() {
         popupAnchor: [0, -28]
     });
 
-
     var seederIcon = L.icon({
     iconUrl: '../assets/leaflet/images/marker-icon-red.png',
         iconSize: [25, 41],
@@ -23,6 +22,19 @@ $( document ).ready(function() {
         popupAnchor: [0, -28]
     });
 
+    var anyIcon = L.icon({
+    iconUrl: '../assets/leaflet/images/marker-icon-purple.png',
+        iconSize: [25, 41],
+        iconAnchor: [12, 41],
+        popupAnchor: [0, -28]
+    });
+
+    var pointOfInterestIcon = L.icon({
+    iconUrl: '../assets/leaflet/images/marker-icon-yellow.png',
+        iconSize: [25, 41],
+        iconAnchor: [12, 41],
+        popupAnchor: [0, -28]
+    });
 
     // Create map
     var map = L.map('map', {scrollWheelZoom: false}).setView([defaults.lat,defaults.lng], defaults.zoom);
@@ -107,9 +119,16 @@ $( document ).ready(function() {
                 var icon;
                 if (feature.properties.contrib_type == 'connect') {
                     icon = leecherIcon;
-                } else {
+                }
+                else if (feature.properties.contrib_type == 'share') {
                     icon = seederIcon;
                 }
+                else if (feature.properties.contrib_type == 'any') {
+                    icon = anyIcon;
+                }
+                else if (feature.properties.contrib_type == 'pointofinterest') {
+                    icon = pointOfInterestIcon;
+                }
                 return L.marker(latlng, {icon: icon});
             }
         }).addTo(map);