Projet

Général

Profil

0001-maps-use-scss-to-handle-list-of-marker-icons-21289.patch

Frédéric Péters, 21 janvier 2018 11:05

Télécharger (10,3 ko)

Voir les différences:

Subject: [PATCH 1/2] maps: use scss to handle list of marker icons (#21289)

 MANIFEST.in                               |   2 +-
 combo/apps/maps/static/css/combo.map.css  | 173 ------------------------------
 combo/apps/maps/static/css/combo.map.scss |  94 ++++++++++++++++
 debian/control                            |   2 +-
 setup.py                                  |  35 +++++-
 5 files changed, 130 insertions(+), 176 deletions(-)
 delete mode 100644 combo/apps/maps/static/css/combo.map.css
 create mode 100644 combo/apps/maps/static/css/combo.map.scss
MANIFEST.in
6 6
recursive-include combo/apps/lingo/static *.css *.js *.ico *.gif *.png *.jpg
7 7
recursive-include combo/apps/dataviz/static *.css *.js *.ico *.gif *.png *.jpg
8 8
recursive-include combo/apps/dashboard/static *.js
9
recursive-include combo/apps/maps/static *.css *.js
9
recursive-include combo/apps/maps/static *.css *.scss *.js
10 10
recursive-include combo/manager/static *.css *.js *.ico *.gif *.png *.jpg
11 11
recursive-include combo/public/static *.css *.js *.ico *.gif *.png *.jpg
12 12
recursive-include data/themes *.css *.js  *.gif *.png *.jpg *.jpeg *.html
combo/apps/maps/static/css/combo.map.css
1
div.combo-cell-map.leaflet-container {
2
    height: 60vh;
3
    font: inherit;
4
}
5

  
6
/* leaflet styles */
7

  
8
div.leaflet-marker-icon {
9
    border: none;
10
    background: transparent;
11
}
12

  
13
div.leaflet-div-icon span {
14
    width: 2.3em;
15
    height: 2.3em;
16
    display: block;
17
    left: -1.15em; /* 2.3 / 2 */
18
    top: -3em; /* 2.3 * 1.2 */
19
    position: relative;
20
    border-radius: 11em 6em 0.8em;
21
    transform: scale(1, 1.3) rotate(45deg);
22
    box-sizing: border-box;
23
}
24

  
25
div.leaflet-div-icon span {
26
    border: 1px solid white;
27
    box-shadow: 0 0 0 1px #aaa;
28
}
29

  
30
div.leaflet-div-icon span i {
31
    display: block;
32
    width: 100%;
33
    text-align: center;
34
    transform: translateY(50%) rotate(-45deg);
35
    height: 50%;
36
}
37

  
38
div.leaflet-popup-content span.field-value {
39
    font-weight: bold;
40
}
41

  
42
div.leaflet-div-icon span i:before {
43
    display: inline-block;
44
    background: white;
45
    border-radius: 100%;
46
    padding: 0.5ex;
47
    transform: scale(1.3, 1);
48
    margin-top: -0.3ex;
49
}
50

  
51
/* leaflet markers icons */
52

  
53
.layers a::before,
54
select#id_icon option::before,
55
i.leaflet-marker-icon {
56
    font: normal normal normal 1em/1 FontAwesome;
57
}
58

  
59
.layers a::before,
60
select#id_icon option::before {
61
    padding-right: 1ex;
62
    display: inline-block;
63
    width: 3ex;
64
    text-align: center;
65
}
66

  
67
a.layer-icon-house::before,
68
select#id_icon option[value=house]::before,
69
i.leaflet-marker-icon.house::before {
70
    content: "\f015"; /* home */
71
}
72

  
73
a.layer-icon-building::before,
74
select#id_icon option[value=building]::before,
75
i.leaflet-marker-icon.building::before {
76
    content: "\f0f7"; /* building */
77
}
78

  
79
a.layer-icon-hospital::before,
80
select#id_icon option[value=hospital]::before,
81
i.leaflet-marker-icon.hospital::before {
82
    content: "\f0f8"; /* hospital */
83
}
84

  
85
a.layer-icon-ambulance::before,
86
select#id_icon option[value=ambulance]::before,
87
i.leaflet-marker-icon.ambulance::before {
88
    content: "\f0f9"; /* ambulance */
89
}
90

  
91
a.layer-icon-taxi::before,
92
select#id_icon option[value=taxi]::before,
93
i.leaflet-marker-icon.taxi::before {
94
    content: "\f1ba"; /* taxi */
95
}
96

  
97
a.layer-icon-subway::before,
98
select#id_icon option[value=subway]::before,
99
i.leaflet-marker-icon.subway::before {
100
    content: "\f239"; /* subway */
101
}
102

  
103
a.layer-icon-wheelchair::before,
104
select#id_icon option[value=wheelchair]::before,
105
i.leaflet-marker-icon.wheelchair::before {
106
    content: "\f193"; /* wheelchair */
107
}
108

  
109
a.layer-icon-bicycle::before,
110
select#id_icon option[value=bicycle]::before,
111
i.leaflet-marker-icon.bicycle::before {
112
    content: "\f206"; /* bicycle */
113
}
114

  
115
a.layer-icon-car::before,
116
select#id_icon option[value=car]::before,
117
i.leaflet-marker-icon.car::before {
118
    content: "\f1b9"; /* car */
119
}
120

  
121
a.layer-icon-train::before,
122
select#id_icon option[value=train]::before,
123
i.leaflet-marker-icon.train::before {
124
    content: "\f238"; /* train */
125
}
126

  
127
a.layer-icon-bus::before,
128
select#id_icon option[value=bus]::before,
129
i.leaflet-marker-icon.bus::before {
130
    content: "\f207"; /* bus */
131
}
132

  
133
a.layer-icon-motorcycle::before,
134
select#id_icon option[value=motorcycle]::before,
135
i.leaflet-marker-icon.motorcycle::before {
136
    content: "\f21c"; /* motorcycle */
137
}
138

  
139
a.layer-icon-truck::before,
140
select#id_icon option[value=truck]::before,
141
i.leaflet-marker-icon.truck::before {
142
    content: "\f0d1"; /* truck */
143
}
144

  
145
a.layer-icon-book::before,
146
select#id_icon option[value=book]::before,
147
i.leaflet-marker-icon.book::before {
148
    content: "\f02d"; /* book */
149
}
150

  
151
a.layer-icon-shower::before,
152
select#id_icon option[value=shower]::before,
153
i.leaflet-marker-icon.shower::before {
154
    content: "\f2cc"; /* shower */
155
}
156

  
157
a.layer-icon-trash::before,
158
select#id_icon option[value=trash]::before,
159
i.leaflet-marker-icon.trash::before {
160
    content: "\f1f8"; /* trash */
161
}
162

  
163
a.layer-icon-recycle::before,
164
select#id_icon option[value=recycle]::before,
165
i.leaflet-marker-icon.recycle::before {
166
    content: "\f1b8"; /* recycle */
167
}
168

  
169
a.layer-icon-university::before,
170
select#id_icon option[value=university]::before,
171
i.leaflet-marker-icon.university::before {
172
    content: "\f19c"; /* university */
173
}
combo/apps/maps/static/css/combo.map.scss
1
$marker_icons: (
2
	(ambulance, "\f0f9"),
3
	(bicycle, "\f206"),
4
	(book, "\f02d"),
5
	(building, "\f0f7"),
6
	(bus, "\f207"),
7
	(car, "\f1b9"),
8
	(hospital, "\f0f8"),
9
	(house, "\f015"),
10
	(motorcycle, "\f21c"),
11
	(recycle, "\f1b8"),
12
	(shower, "\f2cc"),
13
	(subway, "\f239"),
14
	(taxi, "\f1ba"),
15
	(train, "\f238"),
16
	(trash, "\f1f8"),
17
	(truck, "\f9d1"),
18
	(university, "\f19c"),
19
	(wheelchair, "\f193"),
20
);
21

  
22
div.combo-cell-map.leaflet-container {
23
    height: 60vh;
24
    font: inherit;
25
}
26

  
27
/* leaflet styles */
28

  
29
div.leaflet-marker-icon {
30
    border: none;
31
    background: transparent;
32
}
33

  
34
div.leaflet-div-icon span {
35
    width: 2.3em;
36
    height: 2.3em;
37
    display: block;
38
    left: -1.15em; /* 2.3 / 2 */
39
    top: -3em; /* 2.3 * 1.2 */
40
    position: relative;
41
    border-radius: 11em 6em 0.8em;
42
    transform: scale(1, 1.3) rotate(45deg);
43
    box-sizing: border-box;
44
}
45

  
46
div.leaflet-div-icon span {
47
    border: 1px solid white;
48
    box-shadow: 0 0 0 1px #aaa;
49
}
50

  
51
div.leaflet-div-icon span i {
52
    display: block;
53
    width: 100%;
54
    text-align: center;
55
    transform: translateY(50%) rotate(-45deg);
56
    height: 50%;
57
}
58

  
59
div.leaflet-popup-content span.field-value {
60
    font-weight: bold;
61
}
62

  
63
div.leaflet-div-icon span i:before {
64
    display: inline-block;
65
    background: white;
66
    border-radius: 100%;
67
    padding: 0.5ex;
68
    transform: scale(1.3, 1);
69
    margin-top: -0.3ex;
70
}
71

  
72
/* leaflet markers icons */
73

  
74
.layers a::before,
75
select#id_icon option::before,
76
i.leaflet-marker-icon {
77
    font: normal normal normal 1em/1 FontAwesome;
78
}
79

  
80
.layers a::before,
81
select#id_icon option::before {
82
    padding-right: 1ex;
83
    display: inline-block;
84
    width: 3ex;
85
    text-align: center;
86
}
87

  
88
@each $marker_icon_name, $marker_icon_symbol in $marker_icons {
89
	a.layer-icon-#{$marker_icon_name}::before,
90
	select#id_icon option[value=#{$marker_icon_name}]::before,
91
	i.leaflet-marker-icon.#{$marker_icon_name}::before {
92
		content: $marker_icon_symbol;
93
	}
94
}
debian/control
2 2
Maintainer: Jérôme Schneider <jschneider@entrouvert.com>
3 3
Section: python
4 4
Priority: optional
5
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7), python-django, dh-systemd
5
Build-Depends: python-setuptools (>= 0.6b3), python-all (>= 2.6.6-3), debhelper (>= 7), python-django, dh-systemd, ruby-sass
6 6
Standards-Version: 3.9.6
7 7
X-Python-Version: >= 2.7
8 8

  
setup.py
72 72
            sys.stderr.write('!!! Please install Django >= 1.4 to build translations\n')
73 73

  
74 74

  
75
class compile_scss(Command):
76
    description = 'compile scss files into css files'
77
    user_options = []
78

  
79
    def initialize_options(self):
80
        pass
81

  
82
    def finalize_options(self):
83
        pass
84

  
85
    def run(self):
86
        sass_bin = None
87
        for program in ('sass', 'sassc'):
88
            sass_bin = find_executable(program)
89
            if sass_bin:
90
                break
91
        if not sass_bin:
92
            raise CompileError('A sass compiler is required but none was found.  See sass-lang.com for choices.')
93

  
94
        for package in self.distribution.packages:
95
            for package_path in __import__(package).__path__:
96
                for path, dirnames, filenames in os.walk(package_path):
97
                    for filename in filenames:
98
                        if not filename.endswith('.scss'):
99
                            continue
100
                        if filename.startswith('_'):
101
                            continue
102
                        subprocess.check_call([sass_bin, '%s/%s' % (path, filename),
103
                            '%s/%s' % (path, filename.replace('.scss', '.css'))])
104

  
105

  
75 106
class build(_build):
76
    sub_commands = [('compile_translations', None)] + _build.sub_commands
107
    sub_commands = [('compile_translations', None),
108
                    ('compile_scss', None) ] + _build.sub_commands
77 109

  
78 110

  
79 111
class install_lib(_install_lib):
......
125 157
    zip_safe=False,
126 158
    cmdclass={
127 159
        'build': build,
160
        'compile_scss': compile_scss,
128 161
        'compile_translations': compile_translations,
129 162
        'install_lib': install_lib,
130 163
        'sdist': eo_sdist,
131
-