Projet

Général

Profil

0001-backoffice-display-demands-as-coloured-circle-marker.patch

Serghei Mihai, 10 avril 2017 19:14

Télécharger (3,5 ko)

Voir les différences:

Subject: [PATCH] backoffice: display demands as coloured circle markers on map
 view (#15533)

 tests/test_backoffice_pages.py      |  2 ++
 wcs/backoffice/management.py        |  1 +
 wcs/qommon/static/css/dc2/admin.css |  7 +++++++
 wcs/qommon/static/js/qommon.map.js  | 20 +++++++++++++++++++-
 4 files changed, 29 insertions(+), 1 deletion(-)
tests/test_backoffice_pages.py
928 928
    resp = app.get('/backoffice/management/form-title/geojson')
929 929
    assert len(resp.json['features']) == 1
930 930
    assert resp.json['features'][0]['geometry']['coordinates'] == [2.32, 48.83]
931
    assert 'status_colour' in resp.json['features'][0]['properties']
932
    assert resp.json['features'][0]['properties']['status_colour'] == '#66FF00'
931 933

  
932 934
    resp = app.get('/backoffice/management/form-title/geojson?filter=pending&filter-status=on')
933 935
    assert len(resp.json['features']) == 1
wcs/backoffice/management.py
73 73
            'properties': {
74 74
                'name':  formdata.get_display_name(),
75 75
                'url': formdata.get_url(backoffice=True),
76
                'status_colour': '#%s' % formdata.get_status().colour,
76 77
            },
77 78
            'geometry': {
78 79
                'type': 'Point',
wcs/qommon/static/css/dc2/admin.css
939 939
	stroke-width: 2px;
940 940
}
941 941

  
942
/* Styling for Leaflet's circle markers */
943

  
944
.leaflet-map-pane svg {
945
    width: auto;
946
    height: auto;
947
}
948

  
942 949
.foldable {
943 950
	cursor: pointer;
944 951
}
wcs/qommon/static/js/qommon.map.js
88 88
               window.location = feature.properties.url;
89 89
               return false;
90 90
             });
91
           }
91
           },
92
           pointToLayer: function (feature, latlng) {
93
             return L.circleMarker(latlng, {
94
               radius: 9,
95
               fillColor: feature.properties.status_colour,
96
               color: "#000",
97
               weight: 1,
98
               opacity: 1,
99
               fillOpacity: 0.7});
100
             }
92 101
         });
93 102
         map.fitBounds(geo_json.getBounds());
94 103
         geo_json.addTo(map);
......
110 119
                 window.location = feature.properties.url;
111 120
                 return false;
112 121
               });
122
         },
123
         pointToLayer: function (feature, latlng) {
124
             return L.circleMarker(latlng, {
125
               radius: 9,
126
               fillColor: feature.properties.status_colour,
127
               color: "#000",
128
               weight: 1,
129
               opacity: 1,
130
               fillOpacity: 0.7});
113 131
             }
114 132
           });
115 133
           map.fitBounds(geo_json.getBounds());
116
-