Projet

Général

Profil

0001-general-add-support-for-a-banner-with-page-picture-i.patch

Frédéric Péters, 18 juillet 2018 21:26

Télécharger (7,76 ko)

Voir les différences:

Subject: [PATCH] general: add support for a banner with page picture in all
 themes (#25352)

 help/fr/misc-scss.page                  | 11 +++++++++++
 static/amiens-metropole/_vars.scss      |  1 +
 static/grandlyon-sau/_vars.scss         |  1 +
 static/grenoble-metropole/_vars.scss    |  1 +
 static/grosboule-les-bains/_custom.scss |  8 --------
 static/grosboule-les-bains/_vars.scss   |  1 +
 static/grosboule-les-bains/extra.js     |  5 -----
 static/includes/_nav.scss               | 19 +++++++++++++++++++
 static/moselle/_vars.scss               |  1 +
 static/nancy-2017/_vars.scss            |  1 +
 static/strasbourg-2018/_vars.scss       |  1 +
 static/toodego/_vars.scss               |  1 +
 templates/combo/page_template.html      |  7 +++++++
 13 files changed, 45 insertions(+), 13 deletions(-)
help/fr/misc-scss.page
246 246
  <td><p>Style de la bordure de l'élément survolé.</p></td>
247 247
  <td><p><var>$nav-item-selected-border</var></p></td>
248 248
 </tr>
249
 <tr>
250
  <td><p><code>$nav-after-image</code></p></td>
251
  <td><p>Ajout sous la navigation d'un bandeau avec l'image associée à la page.
252
  (ne fonctionne pas avec Internet Explorer)</p></td>
253
  <td><p><var>true</var></p></td>
254
 </tr>
255
 <tr>
256
  <td><p><code>$nav-after-image-image</code></p></td>
257
  <td><p>Hauteur de l'éventuel bandeau image.</p></td>
258
  <td><p><var>300px</var></p></td>
259
 </tr>
249 260
</table>
250 261
</section>
251 262

  
static/amiens-metropole/_vars.scss
14 14
$nav-active-color: $primary-color;
15 15
$nav-item-selected-color: white;
16 16
$nav-item-hover-color: white;
17
$nav-after-image: false;
17 18
$button-background: darken($primary-color, 10%);
18 19
$title-font-family: 'AbrilFatface-Regular', Arial, Helvetica, sans-serif;
19 20
$title-background: $primary-color;
static/grandlyon-sau/_vars.scss
14 14
$nav-active-color: white;
15 15
$nav-item-selected-color: $primary-color;
16 16
$nav-menu-color: $primary-color;
17
$nav-after-image: false;
17 18
$button-background: $link-color;
18 19
$title-color: #000;
19 20
$title-font-size: 2em;
static/grenoble-metropole/_vars.scss
18 18
$nav-item-selected-border: 5px solid $primary-color;
19 19
$nav-item-hover-background: transparent;
20 20
$nav-item-hover-color: $primary-color;
21
$nav-after-image: false;
21 22
$button-background: $primary-color;
22 23
$button-color: #000;
23 24
$title-color: #000;
static/grosboule-les-bains/_custom.scss
54 54
}
55 55

  
56 56
body.has-picture {
57
	nav::after {
58
		content: "";
59
		display: block;
60
		width: 100%;
61
		height: 600px;
62
		background: white center center no-repeat;
63
		background-size: cover;
64
	}
65 57
	div#main-content-wrapper {
66 58
		padding-top: 1rem;
67 59
	}
static/grosboule-les-bains/_vars.scss
5 5
$nav-active-color: $primary-color;
6 6
$nav-item-selected-mode: bottom-border;
7 7
$nav-submenu-color: $font-color;
8
$nav-after-image-height: 600px;
8 9

  
9 10
$button-background: $primary-color;
10 11
$cell-border: 1px solid transparent;
static/grosboule-les-bains/extra.js
1 1
$(function() {
2
  /* set page picture as background */
3
  if (document.body.attributes['data-picture']) {
4
    var sheet = document.head.appendChild(document.createElement("style")).sheet;
5
    sheet.insertRule('body.has-picture nav::after { background-image: url(' + document.body.attributes['data-picture'].value + ')', 0);
6
  }
7 2
  /* add a class to body when the page got scrolled */
8 3
  $(window).on('scroll', function() {
9 4
    if ($(window).scrollTop() == 0) {
static/includes/_nav.scss
34 34
$border-radius: 0 !default;
35 35
$responsive-menu: top-to-bottom !default; /* or left-to-right */
36 36

  
37
$nav-after-image: true !default;
38
$nav-after-image-height: 300px !default;
39

  
37 40

  
38 41
@if $nav-full-width-background == true {
39 42
	div.gru-nav-wrapper {
......
321 324
	}
322 325
}
323 326
}
327

  
328
@if $nav-after-image == true {
329
	@supports (background-image: var(--page-picture)) {
330
		body.has-picture nav::after {
331
			content: "";
332
			display: block;
333
			width: 100%;
334
			height: $nav-after-image-height;
335
			background: transparent center center no-repeat;
336
			background-image: var(--page-picture);
337
			background-size: cover;
338
			position: relative;
339
			top: -0.5rem;
340
		}
341
	}
342
}
static/moselle/_vars.scss
8 8
$nav-active-color: $primary-color;
9 9
$nav-submenu-color: white;
10 10
$nav-item-hover-background: lighten($primary-color, 10%);
11
$nav-after-image: false;
11 12

  
12 13
$footer-background: white;
13 14
$footer-color: $font-color;
static/nancy-2017/_vars.scss
7 7
$font-family: "Poppins", sans-serif;
8 8
$nav-background: transparent;
9 9
$nav-active-color: transparent;
10
$nav-after-image: false;
10 11
$border-radius: 0px;
11 12
$title-background: transparent;;
12 13
$title-color: $red;
static/strasbourg-2018/_vars.scss
11 11
$button-color: white;
12 12
$cell-border: 0;
13 13
$cell-title-cover-border: false;
14
$nav-after-image: false;
static/toodego/_vars.scss
18 18
$nav-item-selected-mode: bottom-border;
19 19
$nav-item-hover-mode: bottom-border;
20 20
$nav-item-selected-border: 14px solid $red;
21
$nav-after-image: false;
21 22

  
22 23
$footer-background: black;
23 24
$footer-color: white;
templates/combo/page_template.html
6 6
<script src="{{site_base}}{% xstatic 'jquery' 'jquery.min.js' %}"></script>
7 7
{% skeleton_extra_placeholder extra-top-head %}
8 8
{% end_skeleton_extra_placeholder %}
9
{% if page.picture %}
10
<style>
11
:root {
12
  --page-picture: url("{{site_base}}{{page.picture.url}}");
13
}
14
</style>
15
{% endif %}
9 16
{% endblock %}
10 17

  
11 18
{% block extra_scripts %}
12
-