Merge pull request #8 from tmslav/blog_fix

Blog update
This commit is contained in:
tmslav 2016-03-22 01:23:02 +01:00
commit 006d49d7db
11 changed files with 164 additions and 145 deletions

View file

@ -1,5 +1,6 @@
from cms.plugin_base import CMSPluginBase from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool from cms.plugin_pool import plugin_pool
from cms.wizards import wizard_base
from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter from .models import DGGalleryPlugin, DGSupportersPlugin, Supporter
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
@ -29,5 +30,7 @@ class CMSSupportersPlugin(CMSPluginBase):
}) })
return context return context
plugin_pool.register_plugin(CMSGalleryPlugin) plugin_pool.register_plugin(CMSGalleryPlugin)
plugin_pool.register_plugin(CMSSupportersPlugin) plugin_pool.register_plugin(CMSSupportersPlugin)

View file

@ -23,8 +23,10 @@
<link href="{% static 'digitalglarus/css/business-casual.css' %}" rel="stylesheet"> <link href="{% static 'digitalglarus/css/business-casual.css' %}" rel="stylesheet">
<!-- Fonts --> <!-- Fonts -->
<link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css"> <link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800"
<link href="//fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css"> rel="stylesheet" type="text/css">
<link href="//fonts.googleapis.com/css?family=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic"
rel="stylesheet" type="text/css">
{% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %} {% render_block "css" postprocessor "compressor.contrib.sekizai.compress" %}
{% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %} {% render_block "js" postprocessor "compressor.contrib.sekizai.compress" %}
@ -36,9 +38,16 @@
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]--> <![endif]-->
<script> <script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function (i, s, o, g, r, a, m) {
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), i['GoogleAnalyticsObject'] = r;
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga'); })(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-62285904-2', 'auto'); ga('create', 'UA-62285904-2', 'auto');
@ -57,7 +66,8 @@
<div class="container"> <div class="container">
<!-- Brand and toggle get grouped for better mobile display --> <!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <button type="button" class="navbar-toggle" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span> <span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
<span class="icon-bar"></span> <span class="icon-bar"></span>
@ -73,9 +83,6 @@
{% show_menu_below_id "digital-glarus-page" 0 %} {% show_menu_below_id "digital-glarus-page" 0 %}
<li> <li>
<a href="{% url 'digitalglarus:supporters' %}">Supporters</a> <a href="{% url 'digitalglarus:supporters' %}">Supporters</a>
</li>
<li>
<a href="{% url 'digitalglarus:blog' %}">Blog</a>
</li> </li>
</ul> </ul>
</div> </div>
@ -93,7 +100,8 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-12 text-center"> <div class="col-lg-12 text-center">
<p class="text-center">Copyright &copy; <a href="http://www.ungleich.ch">ungleich GmbH 2015</a></p> <p class="text-center">Copyright &copy; <a href="http://www.ungleich.ch">ungleich GmbH
2015</a></p>
</div> </div>
</div> </div>
</div> </div>

View file

@ -10,7 +10,7 @@
<header> <header>
<hr></hr> <hr></hr>
<h2 class="text-center intro-text"> <h2 class="text-center intro-text">
<a href="{% url 'digitalglarus:blog-detail' post.slug %}" class="post-title center-block"> <a href="{% url 'djangocms_blog:post-detail' post.slug %}" class="post-title center-block">
<b>{{ post.title }}</b> <b>{{ post.title }}</b>
</a> </a>
<small> <small>
@ -28,6 +28,6 @@
</p> </p>
</div> </div>
<div class="read-more"> <div class="read-more">
<a class="lead" href="{% url 'digitalglarus:blog-detail' post.slug %}">{% trans "read more" %} &raquo;</a> <a class="lead" href="{% url 'djangocms_blog:post-detail' post.slug %}">{% trans "read more" %} &raquo;</a>
</div> </div>
</article> </article>

View file

@ -7,6 +7,7 @@
{% block title %}{{ post.get_title }}{% endblock %} {% block title %}{{ post.get_title }}{% endblock %}
{% block content_blog %}{% spaceless %} {% block content_blog %}{% spaceless %}
{% debug %}
<article id="post-{{ post.slug }}" class="post-item post-detail"> <article id="post-{{ post.slug }}" class="post-item post-detail">
{% if post.main_image_id %} {% if post.main_image_id %}
<div class="blog-visual"> <div class="blog-visual">
@ -17,7 +18,7 @@
<header class="text-center"> <header class="text-center">
<hr></hr> <hr></hr>
<h2 class="text-center intro-text"> <h2 class="text-center intro-text">
<a href="{% url 'digitalglarus:blog-detail' post.slug %}" class="post-title center-block"> <a href="{% url 'djangocms_blog:post-detail' post.slug %}" class="post-title center-block">
<b>{{ post.title }}</b> <b>{{ post.title }}</b>
</a> </a>
<small> <small>
@ -26,7 +27,7 @@
</h2> </h2>
<hr></hr> <hr></hr>
{% block blog_meta %} {% block blog_meta %}
{# include "glarus_blog/includes/blog_meta.html" #} include "glarus_blog/includes/blog_meta.html"
{% endblock %} {% endblock %}
</header> </header>
{% endspaceless %} {% endspaceless %}

View file

@ -1,5 +1,4 @@
from django.conf.urls import url,include from django.conf.urls import url
from djangocms_blog.urls import urlpatterns as blog_patterns
from . import views from . import views
@ -10,6 +9,7 @@ urlpatterns = [
url(r'old_letscowork$', views.letscowork, name='letscowork'), url(r'old_letscowork$', views.letscowork, name='letscowork'),
url(r'old_home$', views.home, name='home'), url(r'old_home$', views.home, name='home'),
url(r'supporters/$', views.supporters, name='supporters'), url(r'supporters/$', views.supporters, name='supporters'),
url(r'blog/',views.blog, name='blog'), url(r'', views.index, name='index')
url(r'^blog/(?P<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'), # url(r'blog/',views.blog,name='blog'),
# url(r'^blog/(?P<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'),
] ]

View file

@ -6,6 +6,7 @@ from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import get_language from django.utils.translation import get_language
from djangocms_blog.models import Post from djangocms_blog.models import Post
from django.core.urlresolvers import resolve
from .models import Message, Supporter from .models import Message, Supporter

View file

@ -75,23 +75,24 @@ INSTALLED_APPS = (
#2nd migrate #2nd migrate
# django-cms plugins # django-cms plugins
# 'djangocms_file', 'djangocms_file',
# 'djangocms_picture', 'djangocms_picture',
# 'djangocms_video', 'djangocms_video',
# 'djangocms_flash', 'djangocms_flash',
# 'djangocms_googlemap',
# 'djangocms_inherit',
# 'djangocms_link',
# 'djangocms_teaser',
# 'djangocms_page_meta',
# 'djangocms_text_ckeditor',
# 'djangocms_admin_style',
# 'cmsplugin_filer_file',
# 'cmsplugin_filer_folder',
# 'cmsplugin_filer_link',
# 'cmsplugin_filer_teaser',
# 'cmsplugin_filer_video',
'djangocms_googlemap',
'djangocms_inherit',
'djangocms_link',
'djangocms_teaser',
'djangocms_page_meta',
'djangocms_text_ckeditor',
'djangocms_admin_style',
'cmsplugin_filer_file',
'cmsplugin_filer_folder',
'cmsplugin_filer_link',
'cmsplugin_filer_teaser',
'cmsplugin_filer_video',
#
#blog #blog
# versioning # versioning
'reversion', 'reversion',
@ -99,6 +100,8 @@ INSTALLED_APPS = (
'ungleich', 'ungleich',
'hosting', 'hosting',
'digitalglarus', 'digitalglarus',
'django_extensions',
'debug_toolbar'
) )
MIDDLEWARE_CLASSES = ( MIDDLEWARE_CLASSES = (

View file

@ -18,5 +18,7 @@ CACHES = {
'LOCATION': 'unique-snowflake' 'LOCATION': 'unique-snowflake'
} }
} }
MIDDLEWARE_CLASSES+=("debug_toolbar.middleware.DebugToolbarMiddleware",)
DEBUG = True DEBUG = True

View file

@ -18,9 +18,6 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
{% show_menu 0 0 0 1 %} {% show_menu 0 0 0 1 %}
{% show_menu_below_id "digital-glarus-page" 0 %} {% show_menu_below_id "digital-glarus-page" 0 %}
<li>
<a href="{% url 'digitalglarus:blog' %}">Blog</a>
</li>
</ul> </ul>
</div> </div>
<!-- /.navbar-collapse --> <!-- /.navbar-collapse -->

View file

@ -1,21 +1,37 @@
{% extends "djangocms_blog/base.html" %} {% extends "glarus_blog/base.html" %}
{% load i18n thumbnail cms_tags %} {% load i18n thumbnail cms_tags %}
{% load url from future %}
{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %} {% block meta_description %}{{ post.meta_description }}{% endblock meta_description %}
{% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %} {% block meta_keywords %}{{ post.meta_keywords }}{% endblock meta_keywords %}
{% block canonical_url %}<link rel="canonical" href="{{ SITE.domain }}{{ view.get_view_url }}"/>{% endblock canonical_url %} {% block canonical_url %}
{% block title %}{% page_attribute "page_title" %} - {{ post.get_title }}{% endblock %} <link rel="canonical" href="{{ SITE.domain }}{{ view.get_view_url }}"/>{% endblock canonical_url %}
<!-- page header --> {% block title %}{{ post.get_title }}{% endblock %}
{% block base_header %}
{% include "djangocms_blog/_header_post_detail.html" %} {% block content_blog %}{% spaceless %}
{% endblock %} <article id="post-{{ post.slug }}" class="post-item post-detail">
<!-- page header --> {% if post.main_image_id %}
{% block content_blog %} <div class="blog-visual">
<article> {% thumbnail post.main_image post.full_image_options.size crop=post.full_image_options.crop upscale=post.full_image_options.upscale subject_location=post.main_image.subject_location as thumb %}
{% if use_placeholder %} <img src="{{ post.main_image.url }}" alt="{{ post.main_image.default_alt_text }}"
<div class="blog-content">{% render_placeholder post.content %}</div> class="img-responsive img-full"/>
{% else %} </div>
<div class="blog-content">{% render_model post "post_text" "post_text" %}</div>
{% endif %} {% endif %}
<header class="text-center">
<hr></hr>
<h2 class="text-center intro-text">
<a href="{% url 'djangocms_blog:post-detail' post.slug %}" class="post-title center-block">
<b>{{ post.title }}</b>
</a>
<small>
{{ post.date_created }}
</small>
</h2>
<hr></hr>
{# {% block blog_meta %}#}
{# include "glarus_blog/includes/blog_meta.html"#}
{# {% endblock %}#}
</header>
{% endspaceless %}
<div class="digitalglarus-blog-content">{{ post.abstract| safe }}</div>
</article> </article>
{% endblock content_blog %} {% endblock content_blog %}

View file

@ -1,4 +1,4 @@
{% extends "djangocms_blog/base.html" %} {% extends "glarus_blog/base.html" %}
{% load i18n thumbnail %}{% spaceless %} {% load i18n thumbnail %}{% spaceless %}
{% block canonical_url %}<link rel="canonical" href="{{ SITE.domain }}{{ view.get_view_url }}"/>{% endblock canonical_url %} {% block canonical_url %}<link rel="canonical" href="{{ SITE.domain }}{{ view.get_view_url }}"/>{% endblock canonical_url %}
@ -7,40 +7,28 @@
<section class="blog-list"> <section class="blog-list">
{% block blog_title %} {% block blog_title %}
<header> <header>
<h2>
{% if author %}{% trans "Articles by" %} {{ author.get_full_name }}
{% elif archive_date %}{% trans "Archive" %} &ndash; {% if month %}{{ archive_date|date:'F' }} {% endif %}{{ year }}
{% elif tagged_entries %}{% trans "Tag" %} &ndash; {{ tagged_entries|capfirst }}
{% elif category %}{% trans "Category" %} &ndash; {{ category }}{% endif %}
</h2>
</header> </header>
{% endblock %} {% endblock %}
{% for post in post_list %} {% for post in post_list %}
{% include "djangocms_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %} {% include "glarus_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %}
{% empty %} {% empty %}
<p class="blog-empty">{% trans "No article found." %}</p> <p class="blog-empty text-center lead">{% trans "No article found." %}</p>
{% endfor %} {% endfor %}
{% if author or archive_date or tagged_entries %} {% if author or archive_date or tagged_entries %}
<p class="blog-back"><a href="{% url 'djangocms_blog:posts-latest' %}">{% trans "Back" %}</a></p> <p class="blog-back"><a href="{% url 'djangocms_blog:posts-latest' %}">{% trans "Back" %}</a></p>
{% endif %} {% endif %}
{% if is_paginated %} {% if is_paginated %}
<!-- Pager --> <nav class="{% firstof css_grid instance.css_grid %} pagination">
<ul class="pager">
{% if page_obj.has_previous %} {% if page_obj.has_previous %}
<li class="previous"> <a href="?{{ view.page_kwarg }}={{ page_obj.previous_page_number }}">&laquo; {% trans "previous" %}</a>
<a href="?{{ view.page_kwarg }}={{ page_obj.previous_page_number }}">
&laquo; {% trans "Newer Posts" %}
</a>
</li>
{% endif %} {% endif %}
<span class="current">
{% trans "Page" %} {{ page_obj.number }} {% trans "of" %} {{ paginator.num_pages }}
</span>
{% if page_obj.has_next %} {% if page_obj.has_next %}
<li class="next"> <a href="?{{ view.page_kwarg }}={{ page_obj.next_page_number }}">{% trans "next" %} &raquo;</a>
<a href="?{{ view.page_kwarg }}={{ page_obj.next_page_number }}">
{% trans "Older Posts" %} &rarr;
</a>
</li>
{% endif %} {% endif %}
</ul> </nav>
{% endif %} {% endif %}
</section> </section>
{% endblock %} {% endblock %}