瀏覽代碼

fix merge

Arnar Tumi Þorsteinsson 8 年之前
父節點
當前提交
313eba154f

+ 2 - 1
Procfile

@@ -1 +1,2 @@
-web: uwsgi --http :$PORT --module bakerydemo.wsgi --master --offload-threads 1
+release: yes "yes" | python manage.py migrate
+web: uwsgi --http :$PORT --module bakerydemo.heroku_wsgi --master --offload-threads 1

+ 16 - 0
app.json

@@ -0,0 +1,16 @@
+{
+  "name": "WagtailBakeryDemo",
+  "description": "WagtailBakeryDemo",
+  "repository": "https://github.com/wagtail/bakerydemo",
+  "logo": "http://wagtail.io/static/wagtailsite/images/navlogo2.png",
+  "keywords": ["wagtail", "django"],
+  "env": {
+    "DJANGO_SETTINGS_MODULE": "bakerydemo.settings.heroku"
+  },
+  "scripts": {
+    "postdeploy": "django-admin.py migrate && django-admin.py load_initial_data && echo 'from wagtail.wagtailimages.models import Rendition; Rendition.objects.all().delete()' | django-admin.py shell"
+  },
+  "addons": [
+    "heroku-postgresql:hobby-dev"
+  ]
+}

+ 16 - 0
bakerydemo/base/migrations/0005_merge_20170210_1551.py

@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.5 on 2017-02-10 15:51
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('base', '0004_auto_20170210_1420'),
+        ('base', '0004_auto_20170210_1445'),
+    ]
+
+    operations = [
+    ]

+ 6 - 0
bakerydemo/heroku_wsgi.py

@@ -0,0 +1,6 @@
+from whitenoise.django import DjangoWhiteNoise
+
+from .wsgi import application as _application
+
+
+application = DjangoWhiteNoise(_application)

+ 24 - 0
bakerydemo/settings/heroku.py

@@ -0,0 +1,24 @@
+import dj_database_url
+
+from .base import *
+
+
+DEBUG = True
+
+# Accept all hostnames, since we don't know in advance which hostname will be used for any given Heroku instance.
+# IMPORTANT: Set this to a real hostname when using this in production!
+# See https://docs.djangoproject.com/en/1.10/ref/settings/#allowed-hosts
+ALLOWED_HOSTS = ['*', 'wagtailbakerydemo.herokuapp.com']
+
+EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
+
+# BASE_URL required for notification emails
+BASE_URL = 'http://localhost:8000'
+
+DATABASES = {'default': dj_database_url.config(default='postgres://postgres@localhost:5432/wagtaildemo')}
+
+
+try:
+    from .local import *
+except ImportError:
+    pass

+ 163 - 27
bakerydemo/static/css/main.css

@@ -4,6 +4,13 @@ body {
   padding-bottom: 0;
   font-size: 19px;
   font-family: 'Alegreya', serif;
+  /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffffff+0,ffffff+50,e9e4dd+100 */
+  background: rgb(255,255,255); /* Old browsers */
+  background: -moz-linear-gradient(-45deg,  rgba(255,255,255,1) 0%, rgba(255,255,255,1) 50%, rgba(233,228,221,1) 100%); /* FF3.6-15 */
+  background: -webkit-linear-gradient(-45deg,  rgba(255,255,255,1) 0%,rgba(255,255,255,1) 50%,rgba(233,228,221,1) 100%); /* Chrome10-25,Safari5.1-6 */
+  background: linear-gradient(135deg,  rgba(255,255,255,1) 0%,rgba(255,255,255,1) 50%,rgba(233,228,221,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
+  filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e9e4dd',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
+
 }
 
 @media (min-width: 768px) {
@@ -13,14 +20,21 @@ body {
 }
 
 h1 {
+  color: white;
   font-weight: 900;
   font-family: 'Lato', sans-serif;
-  color: #63210d;
+  position: relative;
 }
 
-.hero h1 {
-  color: white;
-}
+/*h1:before {
+  position: absolute;
+  top: -40px;
+  left: -100px;
+  width: 200px;
+  height: 1px;
+  background-color: #d4566b;
+  content: '';
+}*/
 
 h2 {
   font-weight: 900;
@@ -38,10 +52,12 @@ h4 {
   font-weight: 600;
   font-family: 'Lato', sans-serif;
   color: #63210d;
+  font-size: 22px;
 }
 
 a, a:focus, a:visited {
   color: #d4566b;
+  text-decoration: none;
 }
 
 a:hover {
@@ -49,6 +65,31 @@ a:hover {
   color: #eb7400;
 }
 
+a.btn {
+  display: inline-block;
+  background-color: #d4566b;
+  color: white;
+  font-family: 'Lato', sans-serif;
+  padding: 15px 20px;
+  font-size: 16px;
+  text-transform: uppercase;
+  letter-spacing: 0.15em;
+  font-weight: 300;
+}
+
+a.btn:hover {
+  background-color: #eb7400;
+  color: white;
+}
+
+input {
+  border-radius: 3px;
+  border: none;
+  font-size: 18px;
+  padding: 10px;
+  width: 100%;
+}
+
 p {
   margin: 0 0 30px;
   color: #444;
@@ -58,6 +99,7 @@ p {
   font-family: 'Lato', sans-serif;
   font-weight: 300;
   margin: 0 0 40px;
+  font-size: 22px;
 }
 
 .stand-first {
@@ -66,6 +108,7 @@ p {
 }
 
 
+
 /* queries for type */
 @media (min-width: 768px) {
 
@@ -88,52 +131,145 @@ p {
 
 }
 
-img {
-  display: block;
-  width: 100%;
+ul {
   margin: 0 0 30px;
 }
+
 @media (min-width: 768px) {
-  img {
+  ul {
     margin: 0 0 50px;
   }
 }
 
-.nav {
+figure {
+  margin: 0 0 30px;
+  position: relative;
+}
+@media (min-width: 768px) {
+  figure {
+    margin: 0 0 50px;
+  }
+}
+
+figcaption {
+  background-color: rgba(99,33,13,0.8);
+  position: absolute;
+  width: 75%;
+  left: 0;
+  bottom: 0;
+  padding: 10px;
   color: white;
   font-family: 'Lato', sans-serif;
   font-size: 16px;
+  font-weight: 300;
+}
+
+img {
+  display: block;
+  width: 100%;
+}
+
+.search {
+  margin: 15px 0 0 0;
+  display: none;
+  position: relative;
+}
+@media (min-width: 768px) {
+  .search {
+    float: right;
+    margin: 0 0 0 30px;
+    display: inline-block;
+  }
+}
+
+.search-icon {
+  position: absolute;
+  display: block;
+  width: 20px;
+  height: 20px;
+  top: 10px;
+  right: 10px;
+  display: inline-block;
+}
+
+.search-icon svg {
+  fill: #d4566b;
+  width: 20px;
+  height: 20px;
+}
+
+nav {
+  margin: 15px 0 5px;
+  display: none;
+}
+
+@media (min-width: 768px) {
+  nav {
+    margin: 15px 0 0 0;
+    border-top: 1px solid rgba(255,255,255,0.1);
+    display: block;
+  }
+}
+
+.nav-pills>li+li {
+    margin-left: 0;
 }
 
-.nav a {
+.nav-pills>li>a {
+  color: white;
+  border-top: 1px solid transparent;
+  border-radius: 0;
+  text-transform: uppercase;
+  letter-spacing: 0.15em;
+  font-weight: 300;
+  padding: 10px 10px;
+  font-size: 11px;
   color: white;
+  font-family: 'Lato', sans-serif;
+  margin-top: -1px;
+}
+
+@media (min-width: 768px) {
+  .nav-pills>li>a {
+    padding: 10px 20px;
+    font-size: 14px;
+  }
 }
 
 .nav-pills>li.active>a, .nav-pills>li.active>a:focus, .nav-pills>li.active>a:hover {
-  color: #fff;
-  background-color: #d4566b;
+  color: #d4566b;
+  background-color: transparent;
+  border-top: 1px solid #d4566b;
+  font-weight: 600;
+}
+
+.nav>li>a:focus, .nav>li>a:hover {
+  text-decoration: none;
+  background-color: transparent;
+  border-top: 1px solid #d4566b;
+  color: #d4566b;
 }
 
 /* Everything but the jumbotron gets side spacing for mobile first views */
 .footer {
   font-size: 16px;
   font-family: 'Lato', sans-serif;
-  background-color: #63210d;
   padding: 20px 0;
   margin: 40px 0 0;
+  font-weight: 300;
+  background-color: white;
 }
 
 .footer p {
-  color: rgba(255,255,255,0.7);
   margin: 0;
 }
 
 /* Custom page header */
 .header {
-  padding-bottom: 20px;
-  position: absolute;
+  padding: 15px 0 15px;
+/*  position: absolute;*/
   width: 100%;
-  background-color: rgba(0,0,0,0.3);
+  background-color: rgba(25,17,18,1);
   z-index: 10;
 }
 /* Make the masthead heading the same height as the navigation */
@@ -147,7 +283,6 @@ img {
 .footer {
   padding-top: 19px;
   color: #777;
-  border-top: 1px solid #e5e5e5;
 }
 
 .container {
@@ -188,7 +323,9 @@ img {
 
 /* Article title and hero image */
 .hero {
+  background-image: url("img/3.jpg");
   background-size: cover;
+  background-position: center;
   padding: 200px 0 30px 0;
   position: relative;
   margin: 0 0 30px;
@@ -203,6 +340,8 @@ img {
 
 }
 
+
+
 .hero-gradient-mask {
   position: absolute;
   width: 100%;
@@ -216,18 +355,17 @@ img {
 
 /* Logo */
 .logo, .logo:visited, .logo:focus {
-  display: block;
-  width: 100%;
+  display: inline-block;
   padding: 0;
   color: white;
   font-size: 30px;
   font-weight: 300;
-  margin: 10px 0 10px;
+  margin: 0 0 0;
 }
 
 
 .logo:hover {
-  color: white;
+  color: #d4566b;
   text-decoration: none;
 }
 
@@ -248,6 +386,7 @@ cite {
   color: #888;
   font-size: 12px;
   font-style: normal;
+  letter-spacing: 0.15em;
 }
 
 /* Responsive: Portrait tablets and up */
@@ -259,10 +398,6 @@ cite {
     padding-right: 0;
     padding-left: 0;
   }
-  /* Space out the masthead */
-  .header {
-    margin-bottom: 30px;
-  }
   /* Remove the bottom border on the jumbotron for visual effect */
   .jumbotron {
     border-bottom: 0;
@@ -271,6 +406,7 @@ cite {
 
 /* Responsive: Portrait tablets and up */
 @media screen and (min-width: 1024px) {
+
 }
 
 /* Menu dropdown hack */
@@ -281,7 +417,7 @@ li.has-submenu a.allow-toggle {
 .caret-custom {
     float: right;
     display: inline-block!important;
-    padding: 15px 10px 15px 5px!important;
+    padding: 10px 10px 15px 5px!important;
 }
 .caret-custom:after {
     content: "▼"!important;

+ 26 - 27
bakerydemo/templates/base.html

@@ -51,24 +51,35 @@
 
     {% wagtailuserbar %}
 
-    <div class="container">
+    <div class="header clearfix">
+      <div class="container">
         <div class="row">
-            <div class="site-title col-lg-7 col-lg-offset-2">
-            <div class="col-lg-8">
-                <div class="navbar-header page-scroll">
-                    <h1><a class="title" href="/">Wagtail Bakery Demo 🍞</a></h1>
-                </div>
-            </div>
-            <form class="col-lg-4 navbar-form navbar-right">
-                <div class="form-group">
-                  <input type="text" class="form-control" placeholder="Search">
-                </div>
-                <button type="submit" class="btn btn-default">
-                    <span class="glyphicon glyphicon-search"></span>
-                </button>
+          <div class="col-lg-12">
+            <a href="#" class="logo">The Wagtail Bakery 🍞</a>
+            <form action="/search" method="get" class="search" _lpchecked="1">
+              <input name="q" type="text" placeholder="Search the site" id="" aria-label="Search the site" autocomplete="off">
+              <a href="#" class="search-icon">
+                <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 451 451"><path d="M447.05 428l-109.6-109.6c29.4-33.8 47.2-77.9 47.2-126.1C384.65 86.2 298.35 0 192.35 0 86.25 0 .05 86.3.05 192.3s86.3 192.3 192.3 192.3c48.2 0 92.3-17.8 126.1-47.2L428.05 447c2.6 2.6 6.1 4 9.5 4s6.9-1.3 9.5-4c5.2-5.2 5.2-13.8 0-19zM26.95 192.3c0-91.2 74.2-165.3 165.3-165.3 91.2 0 165.3 74.2 165.3 165.3s-74.1 165.4-165.3 165.4c-91.1 0-165.3-74.2-165.3-165.4z"></path></svg>
+              </a>
             </form>
-            </div>
+            {% block main_navigation %}
+            <nav>
+              <ul class="nav nav-pills">
+                {% get_site_root as site_root %}
+                {% top_menu parent=site_root calling_page=self %}
+                {# main_menu is defined in base/templatetags/navigation_tags.py #}
+                {% comment %}
+                <li role="presentation" class="active"><a href="#">Bread</a></li>
+                <li role="presentation"><a href="#">Blog</a></li>
+                <li role="presentation"><a href="#">About</a></li>
+                <li role="presentation"><a href="#">Contact</a></li>
+                {% endcomment %}
+              </ul>
+            </nav>
+          </div>
         </div>
+      </div>
+      {% endblock %}
     </div>
 
     {% if messages %}
@@ -81,18 +92,6 @@
     </div>
     {% endif %}
 
-    <div class="container">
-        <div class="row">
-            <div class="col-lg-7 col-lg-offset-2">
-                {% block main_navigation %}
-                {% get_site_root as site_root %}
-                {% top_menu parent=site_root calling_page=self %}
-                {# main_menu is defined in base/templatetags/navigation_tags.py #}
-                {% endblock %}
-            </div>
-        </div>
-    </div>
-
     {% block breadcrumbs %}
         {% breadcrumbs %}
     {# breadcrumbs is defined in base/templatetags/navigation_tags.py #}

+ 11 - 18
bakerydemo/templates/tags/top_menu.html

@@ -1,21 +1,14 @@
 {% load navigation_tags wagtailcore_tags %}
 {% get_site_root as site_root %}
 
-<nav class="navbar navbar-default navbar-custom">
-    <div class="container-fluid">
-        <ul class="nav navbar-nav">
-          {% for menuitem in menuitems %}
-            <li class="{% if menuitem.show_dropdown %}has-submenu{% endif %} {% if menuitem.active %}current{% endif %}">
-                {% if menuitem.show_dropdown %}
-                    <a href="{% pageurl menuitem %}" class="allow-toggle">{{ menuitem.title }} <span><a class="caret-custom dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a></span></a>
-                        {% top_menu_children parent=menuitem %}
-                        {# Used to display child menu items #}
-                {% else %}
-                    <a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>
-                {% endif %}
-            </li>
-          {% endfor %}
-        </ul>
-      </div>
-    </div>
-</nav>
+{% for menuitem in menuitems %}
+  <li class="presentation {% if menuitem.show_dropdown %}has-submenu{% endif %} {% if menuitem.active %}active{% endif %}">
+      {% if menuitem.show_dropdown %}
+          <a href="{% pageurl menuitem %}" class="allow-toggle">{{ menuitem.title }} <span><a class="caret-custom dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a></span></a>
+              {% top_menu_children parent=menuitem %}
+              {# Used to display child menu items #}
+      {% else %}
+          <a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>
+      {% endif %}
+  </li>
+{% endfor %}

+ 0 - 1
bin/post_compile

@@ -1 +0,0 @@
-python manage.py compress --settings bakerydemo.settings.production

+ 2 - 0
readme.md

@@ -1,3 +1,5 @@
+[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/wagtail/bakerydemo)
+
 Wagtail demo project
 =======================
 

+ 5 - 0
requirements.txt

@@ -3,3 +3,8 @@ elasticsearch
 wagtail
 wagtailfontawesome
 Pillow
+
+# Dependencies for Heroku deployment
+dj-database-url==0.3.0
+whitenoise>=3.1,<4.0
+uwsgi>=2.0,<2.1