Skip to content
Snippets Groups Projects
Commit 76597f79 authored by jan.bednarik's avatar jan.bednarik
Browse files

home: app with index page

parent 0ad2a1da
Branches
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ Maják je CMS pro Pirátské weby. Postavený je na [Wagtail](https://wagtail.io
[![code style: Black](https://img.shields.io/badge/code%20style-Black-000000)](https://github.com/psf/black)
[![powered by: Wagtail](https://img.shields.io/badge/powered%20by-Wagtail-43b1b0)](https://wagtail.io)
[![powered by: Django](https://img.shields.io/badge/powered%20by-Django-0C4B33)](https://www.djangoproject.com)
[![licence AGPLv3](https://img.shields.io/badge/licence-AGPLv3-brightgreen)](LICENSE)
## Pod pokličkou
......@@ -21,6 +22,18 @@ Pár užitečných odkazů:
A za zmínku stojí [Awesome Wagtail](https://github.com/springload/awesome-wagtail)
jako přehled pluginů a rozšíření pro Wagtail.
### Struktura projektu
.
├── home = app na web úvodní stránky Majáku
├── majak = Django projekt s konfigurací Majáku
├── search = app pro fulltext search (default, asi se k ničemu nepoužívá)
├── senat_campaign = app na weby kandidátů na senátory
└── users = app s custom user modelem a SSO, apod.
Appky v sobě mají modely pro stránky a statické soubory a templaty. Momentálně se
mezi weby nic z toho nesdílí.
## Deployment
### Konfigurace
......
from django.apps import AppConfig
class HomeConfig(AppConfig):
name = "home"
# Generated by Django 3.0.6 on 2020-05-14 11:00
import django.db.models.deletion
import wagtail.core.fields
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
("wagtailcore", "0045_assign_unlock_grouppagepermission"),
]
operations = [
migrations.CreateModel(
name="HomeIndexPage",
fields=[
(
"page_ptr",
models.OneToOneField(
auto_created=True,
on_delete=django.db.models.deletion.CASCADE,
parent_link=True,
primary_key=True,
serialize=False,
to="wagtailcore.Page",
),
),
("body", wagtail.core.fields.RichTextField(verbose_name="obsah")),
],
options={"verbose_name": "Maják homepage",},
bases=("wagtailcore.page",),
),
]
from wagtail.admin.edit_handlers import FieldPanel
from wagtail.core.fields import RichTextField
from wagtail.core.models import Page
class HomeIndexPage(Page):
body = RichTextField("obsah")
content_panels = Page.content_panels + [
FieldPanel("body"),
]
class Meta:
verbose_name = f"Maják homepage"
/*
*
* Custom styling for Piráti senate candidate website
* Author: Daniel Hlavacek
* Author's website: https://danielhlavacek.cz/
*
*/
/* GENERAL */
body {
font-size: 16px;
/*padding-top: 79px;*/
font-family: "Roboto Condensed", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
a:hover {
color: #757575;
}
/* HEADINGS */
h1, h1.lead {
font-size: 3.6rem;
}
h2, h2.lead {
font-size: 2.8rem;
}
h3, h3.lead {
font-size: 2.1rem;
}
h4, h4.lead {
font-size: 1.65rem;
}
h5, h5.lead {
font-size: 1.3rem;
}
h6, h6.lead {
font-size: 1rem;
}
@media screen and (max-width: 500px) {
h1, h1.lead {
font-size: 3rem;
}
h2, h2.lead {
font-size: 2.4rem;
}
h3, h3.lead {
font-size: 1.85rem;
}
h4, h4.lead {
font-size: 1.4rem;
}
h5, h5.lead {
font-size: 1.2rem;
}
h6, h6.lead {
font-size: 1rem;
}
}
h1.lead, h2.lead, h3.lead, h4.lead, h5.lead, h6.lead {
font-family: "Bebas Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
line-height: 1;
text-transform: uppercase;
}
h1.homepage-heading {
font-size: 6rem;
}
h1.heading {
font-size: 4rem;
}
h2.page-subheading {
font-size: 4rem;
}
h3.page-subheading {
font-size: 3.8rem;
}
@media screen and (max-width: 1200px) {
h1.homepage-heading {
font-size: 5.4rem;
}
h1.heading {
font-size: 4rem;
}
h2.page-subheading {
font-size: 4rem;
}
h3.page-subheading {
font-size: 3.6rem;
}
}
@media screen and (max-width: 991px) {
h1.homepage-heading {
font-size: 4.4rem;
}
h1.heading {
font-size: 3.7rem;
}
h2.page-subheading {
font-size: 3.7rem;
}
h3.page-subheading {
font-size: 3.2rem;
}
}
@media screen and (max-width: 440px) {
h1.homepage-heading {
font-size: 3.8rem;
}
h1.heading {
font-size: 3.4rem;
}
h2.page-subheading {
font-size: 3.4rem;
}
h3.page-subheading {
font-size: 3rem;
}
}
@media screen and (max-width: 370px) {
h1.homepage-heading {
font-size: 3.6rem;
}
h2.page-subheading {
font-size: 3rem;
}
h3.page-subheading {
font-size: 2.6rem;
}
}
@media screen and (max-width: 330px) {
h1.homepage-heading {
font-size: 3rem;
}
h2.page-subheading {
font-size: 2.8rem;
}
h3.page-subheading {
font-size: 2.3rem;
}
}
/* BUTTONS */
.btn-dark {
background: black;
}
.btn {
border-radius: 0;
padding: 0.7rem 1.6rem;
}
.btn {
font-family: "Roboto Condensed", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}
.btn-lg {
border-radius: 0;
padding: 0.7rem 3rem;
}
/* TOOLS AND FIXES */
.lazyload, .lazyloading {
opacity: 0;
}
.lazyloaded {
opacity: 1;
transition: opacity .5s;
}
/* SECTIONS */
.section--primary {
background: #ffffff;
color: #000000;
}
.section--alternate {
background: #f7f7f7;
color: #000000;
}
.section--black {
background: #000000;
color: #ffffff;
}
/* SECTION SIZING */
section {
padding: 4rem 0rem;
}
.section--lead {
padding: 6rem 0rem;
}
.section--no-bottom-padding {
padding-bottom: 0rem;
}
@media screen and (max-width: 991px) {
section {
padding: 3.5rem 0rem;
}
.section--lead {
padding: 4rem 0rem;
}
}
@media screen and (max-width: 768px) {
section {
padding: 3rem 0rem;
}
.section--lead {
padding: 3.5rem 0rem;
}
}
@media screen and (max-width: 575px) {
section {
padding: 2.5rem 0rem;
}
.section--lead {
padding: 3rem 0rem;
}
}
/* HEADER */
.navbar {
background: #212121;
}
.navbar-dark .navbar-toggler-icon {
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgb(255, 255, 255)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
.navbar-dark .navbar-toggler {
color: #ffffff;
border: none;
margin-right: -1rem;
}
.navbar.sticky-top {
top: -1px;
}
.nav-link {
display: block;
padding: .5rem 1rem;
text-transform: uppercase;
font-family: "Roboto Condensed", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1.2rem;
}
.navbar-brand {
font-family: "Bebas Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 2.2rem;
text-transform: uppercase;
}
@media screen and (max-width: 420px) {
.navbar-brand {
font-size: 2rem;
}
}
@media screen and (max-width: 390px) {
.navbar-brand {
font-size: 1.8rem;
}
}
@media screen and (max-width: 350px) {
.navbar-brand {
font-size: 1.6rem;
}
}
.navbar-brand--alt {
display: none;
}
@media screen and (max-width: 330px) {
.navbar-brand--alt {
display: block;
}
.navbar-brand--primary {
display: none;
}
}
.brand-wrapper {
height: 64px;
display: flex;
align-items: center;
justify-content: flex-start;
}
@media screen and (min-width: 1200px) {
.navbar-expand-lg .navbar-nav .nav-link {
padding-right: 0.8rem;
padding-left: 0.8rem;
}
}
@media screen and (min-width: 576px) and (max-width: 1199.99px) {
.navbar .navbar-collapse .navbar-nav {
margin-top: 1rem;
margin-bottom: 1rem;
}
}
.header__socials {
display: flex;
margin-left: -0.5rem;
}
.header__socials a {
padding: 0.5rem;
}
.header__socials a i {
font-size: 1rem;
color: white;
}
.header__socials.header__socials--mobile {
margin-left: -0.7rem;
padding-top: 0.4rem;
}
.header__socials.header__socials--mobile a {
padding: 0.7rem;
}
.header__socials.header__socials--mobile a i {
font-size: 1.3rem;
color: rgba(255,255,255,.5);
}
.support_button {
color: #fff;
background-color: #5bb85d;
border-color: #5bb85d;
}
/*--/ Hamburger Navbar /--*/
.navbar-toggler {
position: relative;
}
.navbar-toggler:focus,
.navbar-toggler:active {
outline: 0;
}
.navbar-toggler span {
display: block;
background-color: #ffffff;
height: 2px;
width: 30px;
margin-top: 8px;
margin-bottom: 8px;
-webkit-transform: rotate(0deg);
transform: rotate(0deg);
left: 0;
opacity: 1;
}
.navbar-toggler span:nth-child(1),
.navbar-toggler span:nth-child(3) {
transition: -webkit-transform .35s ease-in-out;
transition: transform .35s ease-in-out;
transition: transform .35s ease-in-out, -webkit-transform .35s ease-in-out;
}
.navbar-toggler:not(.collapsed) span:nth-child(1) {
position: absolute;
left: 12px;
top: 10px;
-webkit-transform: rotate(135deg);
transform: rotate(135deg);
opacity: 0.9;
}
.navbar-toggler:not(.collapsed) span:nth-child(2) {
height: 12px;
visibility: hidden;
background-color: transparent;
}
.navbar-toggler:not(.collapsed) span:nth-child(3) {
position: absolute;
left: 12px;
top: 10px;
-webkit-transform: rotate(-135deg);
transform: rotate(-135deg);
opacity: 0.9;
}
/* FOOTER */
.footer__top {
background: #212121;
}
.footer__bottom {
background: #000000;
}
footer {
color: #8a8a8a;
}
footer a {
color: #8a8a8a;
}
footer a:hover {
color: #ffffff;
text-decoration: none;
}
footer h1, footer h2, footer h3, footer h4, footer h5, footer h6 {
color: #ffffff;
}
.footer__top {
padding: 4rem 0rem;
}
@media screen and (max-width: 991px) {
.footer__top {
padding: 3.5rem 0rem;
}
}
@media screen and (max-width: 768px) {
.footer__top {
padding: 3rem 0rem;
}
}
@media screen and (max-width: 575px) {
.footer__top {
padding: 2.5rem 0rem;
}
}
.footer__bottom {
padding: 2rem 0rem;
}
.footer__bottom a {
border-bottom: 1px dotted;
}
.footer__bottom a:hover {
border-bottom: none;
text-decoration: none;
color: #8a8a8a;
}
.footer__list-heading {
text-transform: uppercase;
margin-bottom: 1.6rem;
}
This diff is collapsed.
This diff is collapsed.
{% load static wagtailuserbar wagtailcore_tags %}
<!doctype html>
<html lang="cs">
<head>
<!-- Font loader -->
<script type="text/javascript">
WebFontConfig = {
google: { families: ['Roboto+Condensed:300,300i,400,400i,700,700i:latin-ext', 'Bebas+Neue'] }
};
(function () {
var wf = document.createElement('script');
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);
})();
</script>
<!-- Meta -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="{{ page.search_description }}">
<meta name="author" content="Piráti">
<title>{{ page.title }}</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="{% static "home/vendor/bootstrap-4.4.1/css/bootstrap.min.css" %}">
<!-- Styles -->
<link href="{% static "home/css/style.css" %}" rel="stylesheet">
</head>
<body>
{% wagtailuserbar %}
<!-- HEADER -->
<nav class="navbar navbar-expand-xl navbar-dark sticky-top">
<div class="container">
<div class="brand-wrapper">
<a class="navbar-brand navbar-brand--primary" href="/">{{ page.title }}</a>
</div>
</div><!-- /container -->
</nav>
<!-- /HEADER -->
{% block content %}{% endblock %}
<!-- FOOTER -->
<footer id="kontakt">
<div class="footer__bottom">
<div class="container">
<div class="row">
<div class="col-12">
<p class="mb-0">
{% now "Y" %} <a href="https://pirati.cz">Piráti</a> |
spravuje <a href="https://wiki.pirati.cz/to">Technický odbor</a> |
zdrojové kódy na <a href="https://gitlab.pirati.cz/to/majak">gitlab.pirati.cz/to/majak</a> |
postaveno na <a href="https://wagtail.io">Wagtail</a> a <a href="https://www.djangoproject.com">Django</a>
</p>
</div><!-- /column -->
</div><!-- /row -->
</div><!-- /container -->
</div><!-- /footer_bottom -->
</footer>
<!-- /FOOTER -->
</body>
</html>
{% extends "home/base.html" %}
{% load wagtailcore_tags %}
{% block content %}
<!-- CONTENT -->
<main role="main">
<section class="section">
<div class="container">
<div class="row">
<div class="col-12">
<article class="article__content">
{{ page.body|richtext }}
</article>
</div><!-- /column -->
</div> <!-- /row -->
</div><!-- /container -->
</section>
</main>
<!-- /CONTENT -->
{% endblock %}
......@@ -32,6 +32,7 @@ DATABASES["default"]["ATOMIC_REQUESTS"] = True
# ------------------------------------------------------------------------------
INSTALLED_APPS = [
"senat_campaign",
"home",
"users",
"pirates",
"search",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment