Projet

Général

Profil

0001-misc-separate-endpoint-s-HTTP-method-display-logic.patch

Serghei Mihai, 20 janvier 2020 08:38

Télécharger (4,07 ko)

Voir les différences:

Subject: [PATCH 1/5] misc: separate endpoint's HTTP method display logic

 passerelle/static/css/style.css               | 67 ++++++++++---------
 .../passerelle/manage/service_view.html       |  1 -
 2 files changed, 35 insertions(+), 33 deletions(-)
passerelle/static/css/style.css
221 221
	padding-left: 1em;
222 222
}
223 223

  
224
#endpoints > div > ul {
224
div.section > div > ul.endpoints {
225 225
	padding: 0;
226 226
}
227 227

  
228
#endpoints > div > ul li {
228
.endpoints > li {
229 229
	list-style-type: none;
230 230
	margin: 0.75em 0;
231 231
	position: relative;
232 232
}
233 233

  
234
#endpoints .get-method .method-name {
235
	background: hsl(207, 85%, 38%);
234
.endpoints > li::after {
235
	color: hsl(0, 0%, 100%);
236
	display: inline-block;
237
	padding: 0.3em 0.75em;
238
	width: 4em;
239
	text-align: center;
240
	position: absolute;
241
	right: 0;
242
	top: 0;
243
	margin: -1px -1px 0 0;
236 244
}
237 245

  
238
#endpoints .get-method {
246
.endpoints .get-method {
239 247
	background: hsl(207, 85%, 95%);
240 248
	border: 1px solid hsl(207, 85%, 87%);
241 249
}
250
.endpoints .get-method::after {
251
	content: "GET";
252
	background: hsl(207, 85%, 38%);
253
}
242 254

  
243
#endpoints .post-method .method-name {
255
.endpoints .post-method::after {
256
	content: "POST";
244 257
	background: hsl(143, 82%, 35%);
245 258
}
246 259

  
247
#endpoints .post-method {
260
.endpoints .post-method {
248 261
	background: hsl(143, 82%, 95%);
249 262
	border: 1px solid hsl(143, 82%, 87%);
250 263
}
251 264

  
252
#endpoints .put-method .method-name {
265
.endpoints .put-method::after {
266
	content: "PUT";
253 267
	background: hsl(35, 64%, 47%)
254 268
}
255 269

  
256
#endpoints .put-method {
270
.endpoints .put-method {
257 271
	background: hsl(35, 64%, 95%)
258 272
	border: hsl(35, 64%, 87%)
259 273
}
260 274

  
261
#endpoints .delete-method .method-name {
275
.endpoints .delete-method::after {
276
	content: "DELETE";
262 277
	background: hsl(358, 69%, 38%);
263 278
}
264 279

  
265
#endpoints .delete-method {
280
.endpoints .delete-method {
266 281
	background: hsl(358, 69%, 95%)
267 282
	border: 1px solid hsl(358, 69%, 87%);
268 283
}
269 284

  
270
#endpoints .patch-method .method-name {
285
.endpoints .patch-method::after {
286
	content: "PATCH";
271 287
	background: hsl(14, 100%, 63%);
272 288
}
273 289

  
274
#endpoints .patch-method {
290
.endpoints .patch-method {
275 291
	background: hsl(14, 100%, 95%);
276 292
	border: 1px solid hsl(14, 100%, 87%);
277 293
}
278 294

  
279
#endpoints .method-name {
280
	color: hsl(0, 0%, 100%);
281
	padding: 0.3em 0.75em;
282
	width: 4em;
283
	display: inline-block;
284
	text-align: center;
285
	margin: -1px -1px 0 0;
286
	cursor: pointer;
287
	position: absolute;
288
	right: 0;
289
	top: 0;
290
}
291

  
292
#endpoints .description, #endpoints .long-description {
293
	margin: 0.3em 0.3em 0.3em 0.75em;
295
.endpoints .description, .endpoints .long-description {
296
	margin: 0.3em 0.3em 0.3em 0;
294 297
	display: inline-block;
295 298
	font-weight: bold;
296 299
}
297 300

  
298
#endpoints .params {
301
.endpoints .params {
299 302
	padding: 0 0.3em;
300 303
	background: hsla(0, 100%, 100%, 0.65);
301 304
	margin: 0.3em 0.75em;
302 305
}
303 306

  
304
#endpoints .params .params-title {
307
.endpoints .params .params-title {
305 308
	font-weight: bold;
306 309
}
307 310

  
308
#endpoints .params .param-name {
311
.endpoints .params .param-name {
309 312
	font-family: Monospace;
310 313
}
311 314

  
312
#endpoints .params .param-optional {
315
.endpoints .params .param-optional {
313 316
	font-style: italic;
314 317
}
passerelle/templates/passerelle/manage/service_view.html
62 62
    {% for endpoint in object.get_endpoints_infos %}
63 63
    <li class="{{ endpoint.http_method|default:"get" }}-method">{% if endpoint.description %}<span class="description">{{endpoint.description}}{% trans ':' %}</span>{% endif %}
64 64
       <a href="{{endpoint.example_url}}" class="example-url">{{ site_base_uri }}{{endpoint.example_url_as_html}}</a>
65
       <span class="method-name">{{endpoint.http_method|upper}}</span>
66 65
       <ul class="params">
67 66
       {% if endpoint.get_params %}
68 67
         <li>{% trans "Query parameters" %}
69
-