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 10:48

Télécharger (12,8 ko)

Voir les différences:

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

 MANIFEST.in                               |   2 +-
 combo/apps/maps/static/css/combo.map.css  | 214 +++++++++++++-----------------
 combo/apps/maps/static/css/combo.map.scss |  94 +++++++++++++
 debian/control                            |   2 +-
 setup.py                                  |  35 ++++-
 5 files changed, 225 insertions(+), 122 deletions(-)
 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
@charset "UTF-8";
1 2
div.combo-cell-map.leaflet-container {
2
    height: 60vh;
3
    font: inherit;
4
}
3
  height: 60vh;
4
  font: inherit; }
5 5

  
6 6
/* leaflet styles */
7

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

  
13 11
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
}
12
  width: 2.3em;
13
  height: 2.3em;
14
  display: block;
15
  left: -1.15em;
16
  /* 2.3 / 2 */
17
  top: -3em;
18
  /* 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; }
24 23

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

  
30 28
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
}
29
  display: block;
30
  width: 100%;
31
  text-align: center;
32
  transform: translateY(50%) rotate(-45deg);
33
  height: 50%; }
37 34

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

  
42 38
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
}
39
  display: inline-block;
40
  background: white;
41
  border-radius: 100%;
42
  padding: 0.5ex;
43
  transform: scale(1.3, 1);
44
  margin-top: -0.3ex; }
50 45

  
51 46
/* leaflet markers icons */
52

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

  
59 52
.layers a::before,
60 53
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
}
54
  padding-right: 1ex;
55
  display: inline-block;
56
  width: 3ex;
57
  text-align: center; }
84 58

  
85 59
a.layer-icon-ambulance::before,
86 60
select#id_icon option[value=ambulance]::before,
87 61
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
}
62
  content: ""; }
108 63

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

  
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
}
69
a.layer-icon-book::before,
70
select#id_icon option[value=book]::before,
71
i.leaflet-marker-icon.book::before {
72
  content: ""; }
120 73

  
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
}
74
a.layer-icon-building::before,
75
select#id_icon option[value=building]::before,
76
i.leaflet-marker-icon.building::before {
77
  content: ""; }
126 78

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

  
84
a.layer-icon-car::before,
85
select#id_icon option[value=car]::before,
86
i.leaflet-marker-icon.car::before {
87
  content: ""; }
88

  
89
a.layer-icon-hospital::before,
90
select#id_icon option[value=hospital]::before,
91
i.leaflet-marker-icon.hospital::before {
92
  content: ""; }
93

  
94
a.layer-icon-house::before,
95
select#id_icon option[value=house]::before,
96
i.leaflet-marker-icon.house::before {
97
  content: ""; }
132 98

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

  
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
}
104
a.layer-icon-recycle::before,
105
select#id_icon option[value=recycle]::before,
106
i.leaflet-marker-icon.recycle::before {
107
  content: ""; }
150 108

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

  
114
a.layer-icon-subway::before,
115
select#id_icon option[value=subway]::before,
116
i.leaflet-marker-icon.subway::before {
117
  content: ""; }
118

  
119
a.layer-icon-taxi::before,
120
select#id_icon option[value=taxi]::before,
121
i.leaflet-marker-icon.taxi::before {
122
  content: ""; }
123

  
124
a.layer-icon-train::before,
125
select#id_icon option[value=train]::before,
126
i.leaflet-marker-icon.train::before {
127
  content: ""; }
156 128

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

  
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
}
134
a.layer-icon-truck::before,
135
select#id_icon option[value=truck]::before,
136
i.leaflet-marker-icon.truck::before {
137
  content: "六"; }
168 138

  
169 139
a.layer-icon-university::before,
170 140
select#id_icon option[value=university]::before,
171 141
i.leaflet-marker-icon.university::before {
172
    content: "\f19c"; /* university */
173
}
142
  content: ""; }
143

  
144
a.layer-icon-wheelchair::before,
145
select#id_icon option[value=wheelchair]::before,
146
i.leaflet-marker-icon.wheelchair::before {
147
  content: ""; }
148

  
149
/*# sourceMappingURL=combo.map.css.map */
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
-