Skip to content
Permalink
Browse files

added dark theme

  • Loading branch information...
guigur committed Nov 19, 2018
1 parent 3ee7ceb commit c91829e9af23bbc06d8864ecbe05521e14f9d1c7

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,5 +1,5 @@
<div class="card mb-4">
<img class="card-img-top" src="https://placehold.it/750x300" alt="Card image cap">
<img class="card-img-top" src="{{ asset("img/article_default.png") }}">
<div class="card-body">
<h3 class="card-title">Post Title&nbsp;<span class="badge badge-warning">Work in Progress</span></h3>
<p class="card-text">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reiciendis aliquid atque, nulla? Quos cum ex quis soluta, a laboriosam. Dicta expedita corporis animi vero voluptate voluptatibus possimus, veniam magni quis!</p>
@@ -5,15 +5,23 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="guigur's website">
<meta name="author" content="guigur">
<meta name="theme-color" content="#1b8e51">


<title>Guigur.com</title>

<link rel="icon" type="image/png" href="{{ asset('img/favicons/guigur_32.png') }}" sizes="32x32">
<link rel="icon" type="image/png" href="{{ asset('img/favicons/guigur_48.png') }}" sizes="48x48">
<link rel="icon" type="image/png" href="{{ asset('img/favicons/guigur_64.png') }}" sizes="64x64">
<link rel="icon" type="image/png" href="{{ asset('img/favicons/guigur_96.png') }}" sizes="96x96">
<script src="{{ asset('js/jquery-3.3.1.min.js')}}"></script>
<script src="{{ asset('js/js.cookie.min.js') }}"></script>

<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
{% if app.request.cookies.get('dark') == "true" %}
<link href="{{ asset('css/bootstrap_dark.css') }}" rel="stylesheet">
{% else %}
<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
{% endif %}
<link href="{{ asset('css/foundation-icons.css') }}" rel="stylesheet">
<link href="{{ asset('css/custom.css') }}" rel="stylesheet">

@@ -81,6 +89,13 @@
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="#">S'inscrire</a>
<a class="dropdown-item" href="#">Se connecter</a>
<span class="dropdown-item" href="#">
Mode nuit
<label class="switch">
<input type="checkbox" id="darkSwitch" >
<span class="slider round"></span>
</label>
</span>
</div>
</li>

@@ -104,7 +119,6 @@
</div>
</div>
</div>

{% block body %}
{% endblock body %}
</div>
@@ -130,12 +144,33 @@
</div>
</footer>

<script>
var isDark = Cookies.get('dark');
if (isDark === "true")
$("#darkSwitch").prop('checked', true);
var darkChecker = function() {
var darkCheckbox = $("#darkSwitch:checked").prop('checked');
<script src="{{ asset('js/jquery.js') }}"></script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
console.log(darkCheckbox);
if (darkCheckbox === true && isDark !== "true")
{
Cookies.set("dark", true);
location.reload();
}
else if (darkCheckbox !== true && isDark === "true")
{
Cookies.set("dark", false);
location.reload();
}
};
darkChecker();
$("#darkSwitch").on( "click", darkChecker);
</script>
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
{% block js %}{% endblock %}
</body>
</html>
@@ -49,7 +49,7 @@ public function indexAction()
->findByIsEnabled(1);
$ProjectsNumbers = count($ProjectsNumbers);
$projects = $this->get('guigur.projects')->defaultImage($projects);
$projects = $this->get('guigur.projects')->defaultImages($projects);
$catchPhrase = $this->get('guigur.catchphrase')->requestCatchPhrase('projects');
return $this->render('GuigurFrontBundle:Default:index.html.twig', array("pastVisits" => $pastVisit, "Catchphrase" => $catchPhrase, "Projects" => $projects, "ProjectsCategories" => $ProjectsCategories, "ProjectsNumbers" => $ProjectsNumbers));
}
@@ -33,7 +33,7 @@ public function indexAction($nameOfProject = null)
->getRepository('GuigurFrontBundle:ProjectsCategories')
->findBy(array(), array('category' => 'ASC'));
$projects = $this->get('guigur.projects')->defaultImage($projects);
$projects = $this->get('guigur.projects')->defaultImages($projects);
$catchPhrase = $this->get('guigur.catchphrase')->requestCatchPhrase('projects');
$page['header'] = "Les Projets";
return $this->render('GuigurFrontBundle:Default:projects.html.twig', array("Page" => $page, "Catchphrase" => $catchPhrase, "Projects" => $projects, "Categories" => $Categories, "ProjectsCategories" => $ProjectsCategories));
@@ -46,8 +46,14 @@
</div>

<div class="card my-4">
<a class="twitter-timeline" href="https://twitter.com/guigur_com?ref_src=twsrc%5Etfw" data-height="1000">Tweets by guigur.com</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<a class="twitter-timeline"
href="https://twitter.com/guigur_com"
data-height="1000"
{% if app.request.cookies.get('dark') == "true" %} data-theme=dark {% endif %}
data-chrome="nofooter"
data-background-color="#FF0000">
Tweets by @guigur_com
</a>
</div>
</div>
</div>
@@ -17,27 +17,26 @@ public function __construct(EntityManager $entityManager, Container $container)
$this->container = $container;
}
public function defaultImage($projects)
public function defaultImages($projects)
{
if (!is_array($projects))
{
$projects = $this->defaultImageProject($projects);
}
else
{
foreach ($projects as $project)
foreach ($projects as $project) //page avec plusieurs projets
{
$this->defaultImageProject($project);
}
}
return ($projects);
}
public function defaultImage($project)
{
$this->defaultImageProject($project);
return ($project);
}
private function defaultImageProject($project)
{
if (!file_exists($project->getImgMiniature()) && $project->getImgMiniature() != "")
if (!file_exists($project->getImgMiniature()) || $project->getImgMiniature() == "")
$project->setImgMiniature("img/template_miniature.png");
if (!file_exists($project->getImgProject()) && $project->getImgProject() != "")
if (!file_exists($project->getImgProject()) || $project->getImgProject() == "")
$project->setImgProject("img/template_img_project.png");
return ($project);
}
Oops, something went wrong.

0 comments on commit c91829e

Please sign in to comment.
You can’t perform that action at this time.