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 d56bbd5eab
10 changed files with 162 additions and 145 deletions

View file

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

View file

@ -23,8 +23,10 @@
<link href="{% static 'digitalglarus/css/business-casual.css' %}" rel="stylesheet">
<!-- 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=Josefin+Slab:100,300,400,600,700,100italic,300italic,400italic,600italic,700italic" rel="stylesheet" type="text/css">
<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=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 "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>
<![endif]-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;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)
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
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');
ga('create', 'UA-62285904-2', 'auto');
@ -57,7 +66,8 @@
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<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="icon-bar"></span>
<span class="icon-bar"></span>
@ -73,9 +83,6 @@
{% show_menu_below_id "digital-glarus-page" 0 %}
<li>
<a href="{% url 'digitalglarus:supporters' %}">Supporters</a>
</li>
<li>
<a href="{% url 'digitalglarus:blog' %}">Blog</a>
</li>
</ul>
</div>
@ -93,7 +100,8 @@
<div class="container">
<div class="row">
<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>

View file

@ -10,7 +10,7 @@
<header>
<hr></hr>
<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>
</a>
<small>
@ -28,6 +28,6 @@
</p>
</div>
<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>
</article>

View file

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

View file

@ -1,5 +1,4 @@
from django.conf.urls import url,include
from djangocms_blog.urls import urlpatterns as blog_patterns
from django.conf.urls import url
from . import views
@ -10,6 +9,7 @@ urlpatterns = [
url(r'old_letscowork$', views.letscowork, name='letscowork'),
url(r'old_home$', views.home, name='home'),
url(r'supporters/$', views.supporters, name='supporters'),
url(r'blog/',views.blog, name='blog'),
url(r'^blog/(?P<slug>\w[-\w]*)/$', views.blog_detail, name='blog-detail'),
url(r'', views.index, name='index')
# 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.utils.translation import get_language
from djangocms_blog.models import Post
from django.core.urlresolvers import resolve
from .models import Message, Supporter

View file

@ -75,23 +75,24 @@ INSTALLED_APPS = (
#2nd migrate
# django-cms plugins
# 'djangocms_file',
# 'djangocms_picture',
# 'djangocms_video',
# '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_file',
'djangocms_picture',
'djangocms_video',
'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',
#
#blog
# versioning
'reversion',
@ -99,6 +100,8 @@ INSTALLED_APPS = (
'ungleich',
'hosting',
'digitalglarus',
'django_extensions',
'debug_toolbar'
)
MIDDLEWARE_CLASSES = (

View file

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

View file

@ -1,21 +1,37 @@
{% extends "djangocms_blog/base.html" %}
{% extends "glarus_blog/base.html" %}
{% load i18n thumbnail cms_tags %}
{% load url from future %}
{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %}
{% 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 title %}{% page_attribute "page_title" %} - {{ post.get_title }}{% endblock %}
<!-- page header -->
{% block base_header %}
{% include "djangocms_blog/_header_post_detail.html" %}
{% endblock %}
<!-- page header -->
{% block content_blog %}
<article>
{% if use_placeholder %}
<div class="blog-content">{% render_placeholder post.content %}</div>
{% else %}
<div class="blog-content">{% render_model post "post_text" "post_text" %}</div>
{% block canonical_url %}
<link rel="canonical" href="{{ SITE.domain }}{{ view.get_view_url }}"/>{% endblock canonical_url %}
{% block title %}{{ post.get_title }}{% endblock %}
{% block content_blog %}{% spaceless %}
<article id="post-{{ post.slug }}" class="post-item post-detail">
{% if post.main_image_id %}
<div class="blog-visual">
{% 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 %}
<img src="{{ post.main_image.url }}" alt="{{ post.main_image.default_alt_text }}"
class="img-responsive img-full"/>
</div>
{% 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>
{% endblock content_blog %}

View file

@ -1,4 +1,4 @@
{% extends "djangocms_blog/base.html" %}
{% extends "glarus_blog/base.html" %}
{% load i18n thumbnail %}{% spaceless %}
{% block canonical_url %}<link rel="canonical" href="{{ SITE.domain }}{{ view.get_view_url }}"/>{% endblock canonical_url %}
@ -7,40 +7,28 @@
<section class="blog-list">
{% block blog_title %}
<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>
{% endblock %}
{% 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 %}
<p class="blog-empty">{% trans "No article found." %}</p>
<p class="blog-empty text-center lead">{% trans "No article found." %}</p>
{% endfor %}
{% if author or archive_date or tagged_entries %}
<p class="blog-back"><a href="{% url 'djangocms_blog:posts-latest' %}">{% trans "Back" %}</a></p>
{% endif %}
{% if is_paginated %}
<!-- Pager -->
<ul class="pager">
<nav class="{% firstof css_grid instance.css_grid %} pagination">
{% if page_obj.has_previous %}
<li class="previous">
<a href="?{{ view.page_kwarg }}={{ page_obj.previous_page_number }}">
&laquo; {% trans "Newer Posts" %}
</a>
</li>
<a href="?{{ view.page_kwarg }}={{ page_obj.previous_page_number }}">&laquo; {% trans "previous" %}</a>
{% endif %}
<span class="current">
{% trans "Page" %} {{ page_obj.number }} {% trans "of" %} {{ paginator.num_pages }}
</span>
{% if page_obj.has_next %}
<li class="next">
<a href="?{{ view.page_kwarg }}={{ page_obj.next_page_number }}">
{% trans "Older Posts" %} &rarr;
</a>
</li>
<a href="?{{ view.page_kwarg }}={{ page_obj.next_page_number }}">{% trans "next" %} &raquo;</a>
{% endif %}
</ul>
</nav>
{% endif %}
</section>
{% endblock %}