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_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" %}
@ -35,83 +37,89 @@
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<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)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
<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)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-62285904-2', 'auto');
ga('send', 'pageview');
ga('create', 'UA-62285904-2', 'auto');
ga('send', 'pageview');
</script>
</script>
</head>
<body>
{% cms_toolbar %}
<div class="brand">Digital Glarus</div>
<div class="address-bar">The Swiss IT Valley | Schwanden, 8762 GL Switzerland | From 2015.10.13</div>
<!-- Navigation -->
<nav class="navbar navbar-default" role="navigation">
<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">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
<a class="navbar-brand" href="index.html">Digital Glarus</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
{% show_menu 0 0 0 1 %}
{% 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>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
{% cms_toolbar %}
<div class="brand">Digital Glarus</div>
<div class="address-bar">The Swiss IT Valley | Schwanden, 8762 GL Switzerland | From 2015.10.13</div>
<!-- Navigation -->
<nav class="navbar navbar-default" role="navigation">
<div class="container">
{% block content %} {% endblock %}
<!-- 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">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- navbar-brand is hidden on larger screens, but visible when the menu is collapsed -->
<a class="navbar-brand" href="index.html">Digital Glarus</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
{% show_menu 0 0 0 1 %}
{% show_menu_below_id "digital-glarus-page" 0 %}
<li>
<a href="{% url 'digitalglarus:supporters' %}">Supporters</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<footer>
<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>
</div>
</div>
</div>
</footer>
<div class="container">
{% block content %} {% endblock %}
</div>
<!-- /.container -->
<!-- jQuery -->
<script src="{% static 'digitalglarus/js/jquery.js' %}"></script>
<footer>
<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>
</div>
</div>
</div>
</footer>
<!-- Bootstrap Core JavaScript -->
<script src="{% static 'digitalglarus/js/bootstrap.min.js' %}"></script>
<script src="{% static 'digitalglarus/js/digital.glarus.js' %}"></script>
<!-- jQuery -->
<script src="{% static 'digitalglarus/js/jquery.js' %}"></script>
<!-- Script to Activate the Carousel -->
<script>
<!-- Bootstrap Core JavaScript -->
<script src="{% static 'digitalglarus/js/bootstrap.min.js' %}"></script>
<script src="{% static 'digitalglarus/js/digital.glarus.js' %}"></script>
<!-- Script to Activate the Carousel -->
<script>
$('.carousel').carousel({
interval: 5000 //changes the speed
interval: 5000 //changes the speed
})
</script>
</script>
</body>

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

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>
{% endif %}
{% 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 %}
{% endblock content_blog %}

View file

@ -1,47 +1,35 @@
{% 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 %}
{% block content_blog %}
<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 %}
{% empty %}
<p class="blog-empty">{% 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">
{% if page_obj.has_previous %}
<li class="previous">
<a href="?{{ view.page_kwarg }}={{ page_obj.previous_page_number }}">
&laquo; {% trans "Newer Posts" %}
</a>
</li>
{% block blog_title %}
<header>
</header>
{% endblock %}
{% for post in post_list %}
{% include "glarus_blog/includes/blog_item.html" with post=post image="true" TRUNCWORDS_COUNT=TRUNCWORDS_COUNT %}
{% empty %}
<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 page_obj.has_next %}
<li class="next">
<a href="?{{ view.page_kwarg }}={{ page_obj.next_page_number }}">
{% trans "Older Posts" %} &rarr;
</a>
</li>
{% if is_paginated %}
<nav class="{% firstof css_grid instance.css_grid %} pagination">
{% if page_obj.has_previous %}
<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 %}
<a href="?{{ view.page_kwarg }}={{ page_obj.next_page_number }}">{% trans "next" %} &raquo;</a>
{% endif %}
</nav>
{% endif %}
</ul>
{% endif %}
</section>
{% endblock %}
{% endspaceless %}
{% endspaceless %}