Skip to content

Commit

Permalink
#91 Refactoring Page-figures
Browse files Browse the repository at this point in the history
  • Loading branch information
oodies committed Apr 17, 2018
1 parent 2ba5eeb commit 76f29a3
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 69 deletions.
3 changes: 2 additions & 1 deletion app/Resources/views/layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<meta name="robots" content="none, nofollow"/>
<link rel="stylesheet" href="{{ asset('css/bootstrap.min.css') }}">
<link rel="stylesheet" href="{{ asset('css/font-awesome/css/font-awesome.min.css') }}">
<link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet">
<link rel="stylesheet" href="{{ asset('build/global.css') }}">
<script src="{{ asset('js/jquery.min.js') }}"></script>
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
Expand All @@ -34,7 +35,7 @@
</div>
</main>
<footer>
<div class="i-container">
<div class="i-container">
{{ include('layout.footer.html.twig') }}
</div>
</footer>
Expand Down
55 changes: 41 additions & 14 deletions assets/css/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ html {

body {
display: grid;
grid-template-rows: 56px 1fr 60px;
grid-template-rows: 56px 1fr 1px;
grid-template-areas: "header" "main" "footer";
min-height: 100%;
width: 100%;
Expand All @@ -33,8 +33,14 @@ footer {
grid-row-start: 3;
grid-row-end: 4;
> .i-container {
padding: 15px;
vertical-align: bottom;
background-color: #343e40;
> .container {
padding: 15px;
vertical-align: bottom;
}
}
a {
color: #343e40;
}
}

Expand Down Expand Up @@ -273,9 +279,10 @@ section#form {
#infiniteScroll {
> a {
display: inline-block;
text-decoration: none;
> span {
display: block;
text-align: center;
display: inline-block;
vertical-align: middle;
}
}
}
Expand Down Expand Up @@ -342,6 +349,7 @@ section#form {
section {
display: grid;
width: 100%;
height: 100%;
grid-template-rows: 1fr 70px;
grid-template-areas: 'content' 'gutter';
> .content {
Expand All @@ -350,17 +358,36 @@ section#form {
> .gutter {
grid-area: gutter;
display: flex;
justify-content: center;
align-items: flex-start;
justify-content: flex-end;
align-items: center;
padding-right: 1rem;
}
a {
color: #343a40;
}
}

section#head {
background: url("../images/wintry.jpg") no-repeat;
background-color: #66afe9;
background-origin: border-box;
background-position: center center;
background-size: cover;
background: url("../images/wintry.jpg") no-repeat;
background-color: #cdcdcd;
background-origin: border-box;
background-position: center center;
background-size: cover;
height: 100%;
h2 {
font-family: 'Lobster', cursive;
font-size: 4rem;
color: chocolate;
}
}

#nav-up {
position: fixed;
bottom: 0;
right: 0;
z-index: 1030;
padding-right: 1rem;
padding-bottom: 1rem;
}

// Override
Expand Down Expand Up @@ -394,7 +421,7 @@ section#form {
*/
#page-resetting {
main {
background-color: rgba(205, 205, 205, 0.73);
background-color: #f7f7f7;
}
.segment {
max-width: 360px;
Expand All @@ -406,6 +433,6 @@ section#form {
*/
#page-registration {
main {
background-color: rgba(205, 205, 205, 0.73);
background-color: #f7f7f7;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ menu_admin:
## Type : Page
homepage:
title : "Snowtricks"
head-title: "Bienvenue sur \n Snow Tricks !"

## ************************************
## Title : Snowtricks admin
Expand Down
96 changes: 50 additions & 46 deletions src/Ood/BlogBundle/Resources/views/Post/list.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,57 +10,61 @@

{% trans_default_domain 'application' %}
{% block main %}
<section id="head">
<div class="content d-flex justify-content-center align-items-center text-center">
<h2>{{ 'homepage.head-title'|trans|nl2br }}</h2>
</div>
<div class="gutter">
<a href="#figures">
<i class="fa fa-arrow-down fa-3x"></i>
</a>
</div>
</section>

<section id="head">
<div class="content">
</div>
<div class="gutter">
<a href="#figures">
<i class="fa fa-angle-down fa-4x"></i>
</a>
</div>
</section>

<section id="figures" class="medias">
<div class="content">
{% if posts == false %}
{# View with nothing posts #}
<div id="msgNoResult">Aucun résultat</div>
{% else %}
{# View with posts list #}
<div class="postsListContainer p-2">
<form id="searchPostsForm" action="{{ path(vURL) }}">
<input type="hidden" value="{{ paginator.current_page }}" name="page" id="searchPostsForm_page">
</form>
<div class="cards postsList d-flex flex-wrap justify-content-center justify-content-md-start">
<section id="figures" class="medias" style="display: none;">
<div class="content">
{% if posts == false %}
{# View with nothing posts #}
<div id="msgNoResult">Aucun résultat</div>
{% else %}
{# View with posts list #}
<div class="postsListContainer p-2">
<form id="searchPostsForm" action="{{ path(vURL) }}">
<input type="hidden" value="{{ paginator.current_page }}" name="page" id="searchPostsForm_page">
</form>
<div class="cards postsList d-flex flex-wrap justify-content-center justify-content-md-start">
{{ include ('@OodBlog/Post/list_content.html.twig') }}
</div>
</div>
{% endif %}
</div>
<div class="gutter">
{# view Button + Arrow infinite scroll #}
<div id="infiniteScroll" class="d-flex justify-content-around w-100">
<a href="#head">
<i class="fa fa-4x fa-angle-up"></i>
</a>
{% if paginator.remaining_results > 0 %}
<a class="js-infiniteScroll" href="{{ path(vURL) }}"
data-restof="{{ paginator.remaining_results }}"
data-total="{{ paginator.nb_results }}"
data-item-by-page="{{ paginator.max_per_page }}">
<i class="fa fa-4x fa-angle-down"></i>
</a>
</div>
{% endif %}
</div>
</div>
</section>
<script>
$(document).ready(function() {
infinite_scroll.init();
post_remove.init();
});
</script>
<div class="gutter">
{# view Button + Arrow infinite scroll #}
<div id="infiniteScroll" class="d-flex justify-content-around w-100">
{% if paginator.remaining_results > 0 %}
<a class="js-infiniteScroll border p-2 m-2" href="{{ path(vURL) }}"
data-restof="{{ paginator.remaining_results }}"
data-total="{{ paginator.nb_results }}"
data-item-by-page="{{ paginator.max_per_page }}">
<span><i class="fa fa-2x fa-spinner"></i></span>
<span>Load more</span>
</a>
{% endif %}
</div>
</div>
</section>
<nav id="nav-up" style="display: none;">
<a href="#head">
<i class="fa fa-arrow-up fa-3x text-secondary"></i>
</a>
</nav>
<script>
$(document).ready(function () {
swap_head_figures.init()
infinite_scroll.init()
post_remove.init()
})
</script>
{% endblock main %}

{% block title %}{{ 'posts_list.page_title'|trans }}{% endblock title %}
Expand Down
47 changes: 39 additions & 8 deletions web/build/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ html {

body {
display: grid;
grid-template-rows: 56px 1fr 60px;
grid-template-rows: 56px 1fr 1px;
grid-template-areas: "header" "main" "footer";
min-height: 100%;
width: 100%;
Expand All @@ -47,10 +47,18 @@ footer {
}

footer > .i-container {
background-color: #343e40;
}

footer > .i-container > .container {
padding: 15px;
vertical-align: bottom;
}

footer a {
color: #343e40;
}

:root {
--input-padding-x: .75rem;
--input-padding-y: .75rem;
Expand Down Expand Up @@ -310,11 +318,12 @@ section#form {

#infiniteScroll > a {
display: inline-block;
text-decoration: none;
}

#infiniteScroll > a > span {
display: block;
text-align: center;
display: inline-block;
vertical-align: middle;
}

/** ***********************************
Expand Down Expand Up @@ -384,6 +393,7 @@ section#form {
#page-figures section {
display: grid;
width: 100%;
height: 100%;
grid-template-rows: 1fr 70px;
grid-template-areas: 'content' 'gutter';
}
Expand All @@ -395,16 +405,37 @@ section#form {
#page-figures section > .gutter {
grid-area: gutter;
display: flex;
justify-content: center;
align-items: flex-start;
justify-content: flex-end;
align-items: center;
padding-right: 1rem;
}

#page-figures section a {
color: #343a40;
}

#page-figures section#head {
background: url(../img/wintry.jpg) no-repeat;
background-color: #66afe9;
background-color: #cdcdcd;
background-origin: border-box;
background-position: center center;
background-size: cover;
height: 100%;
}

#page-figures section#head h2 {
font-family: 'Lobster', cursive;
font-size: 4rem;
color: chocolate;
}

#page-figures #nav-up {
position: fixed;
bottom: 0;
right: 0;
z-index: 1030;
padding-right: 1rem;
padding-bottom: 1rem;
}

#page-figures .st_card img {
Expand Down Expand Up @@ -434,7 +465,7 @@ section#form {
*/

#page-resetting main {
background-color: rgba(205, 205, 205, 0.73);
background-color: #f7f7f7;
}

#page-resetting .segment {
Expand All @@ -446,5 +477,5 @@ section#form {
*/

#page-registration main {
background-color: rgba(205, 205, 205, 0.73);
background-color: #f7f7f7;
}
34 changes: 34 additions & 0 deletions web/js/application.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
/* ####################################
* SWAP HEAD / FIGURES HOMEPAGE
*/
var swap_head_figures = swap_head_figures || {};
(function (publics) {
'use strict';

/**
* Privates function
*/
var privates = {};

privates.onClickFigures = function () {
$("a[href='#figures']").click( function (event) {
$("#head").hide();
$("#figures").show();
$("a[href='#head']").parent('nav').show();
});
}

privates.onClickHead = function () {
$("a[href='#head']").click( function (event) {
$("#head").show();
$("#figures").hide();
$(this).parent('nav').hide();
});
}

publics.init = function () {
privates.onClickFigures();
privates.onClickHead();
}
} (swap_head_figures) );

/* ####################################
* IMAGE AND VIDEO UPLOAD
*/
Expand Down

0 comments on commit 76f29a3

Please sign in to comment.