Merge pull request #19 from tmslav/master

home added and assigned right template, fixed up blog for digitalglarus
This commit is contained in:
tmslav 2016-04-09 09:12:03 +02:00
commit f7f838bc62
12 changed files with 156 additions and 42 deletions

View file

@ -0,0 +1,99 @@
{% extends "base_glarus.html" %}
{% load staticfiles cms_tags %}
{% block content %}
<div class="row">
<div class="box">
<div class="col-lg-12 text-center">
<div id="carousel-example-generic" class="carousel slide">
<!-- Indicators --><!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img class="img-responsive img-full" src="{% static 'digitalglarus/img/slide-1.jpg' %}" alt="">
</div>
<div class="item">
<img class="img-responsive img-full" src="{% static 'digitalglarus/img/slide-2.jpg' %}" alt="">
</div>
<div class="item">
<img class="img-responsive img-full" src="{% static 'digitalglarus/img/slide-3.jpg' %}" alt="">
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="icon-prev"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="icon-next"></span>
</a>
</div>
<h2 class="brand-before">
<small>WELCOME TO</small>
</h2>
<h1 class="brand-name">Digital Glarus</h1>
<hr class="tagline-divider">
<h2>
<small>By
<strong><a href="http://ungleich.ch">ungleich gmbh</a></strong>
</small>
</h2>
</div>
</div>
</div>
<div class="row">
<div class="box">
<div class="col-lg-12">
<hr>
<h2 class="intro-text text-center">
{% placeholder 'digital_glarus_build_a_tech_valley' %}
</h2>
<hr>
<img class="img-responsive img-border img-left" src="{% static 'digitalglarus/img/intro-pic.jpg' %}" alt="">
<hr class="visible-xs">
{% placeholder 'digital_glarus_build_a_tech_valley_content' %}
<p>&nbsp;</p>
</div>
</div>
</div>
<div class="row">
<div class="box">
<div class="col-lg-12">
<hr>
<h2 class="intro-text text-center">
{% placeholder 'digital_glarus_a_new_area' %}
</h2>
<hr>
{% placeholder 'digital_glarus_a_new_area_content' %}
</div>
</div>
</div>
<div class="row">
<div class="box">
<div class="col-lg-12">
<hr>
<h2 class="intro-text text-center">
{% placeholder 'digital_glarus_why_be_interested' %}
</h2>
<hr>
{% placeholder 'digital_glarus_why_be_interested_content' %}
</div>
</div>
</div>
<div class="row">
<div class="box">
<div class="col-lg-12">
<hr>
<h2 class="intro-text text-center">
{% placeholder 'digital_glarus_where_we_are' %}
</h2>
<hr>
{% placeholder 'digital_glarus_where_we_are_content' %}
<p>&nbsp;</p>
</div>
</div>
</div>
{% endblock %}

View file

@ -80,11 +80,18 @@
<!-- 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 %}
{# <pre> {% filter force_escape %} {% debug %} {% endfilter %} </pre>#}
{# {% show_menu 0 0 0 1 %}#}
<li>
<a href="{% url 'pages-root' %}">Home</a>
</li>
{% 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 -->

View file

@ -3,13 +3,14 @@
{% if post.main_image %}
<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" />
<img src="{{ post.main_image.url }}" alt="{{ post.main_image.default_alt_text }}"
class="img-responsive img-full"/>
</div>
{% endif %}
<header>
<hr></hr>
<hr>
<h2 class="text-center intro-text">
<a href="{% url 'djangocms_blog:post-detail' post.slug %}" class="post-title center-block">
<a href="{{ post.slug }}" class="post-title center-block">
<b>{{ post.title }}</b>
</a>
<small>
@ -17,9 +18,9 @@
</small>
</h2>
<hr></hr>
{% block blog_meta %}
{# include "glarus_blog/includes/blog_meta.html" #}
{% endblock %}
{# {% block blog_meta %}#}
{# {% include "glarus_blog/includes/blog_meta.html" %}#}
{# {% endblock %}#}
</header>
<div class="blog-lead text-center blog-abstract center-block">
<p>
@ -27,6 +28,7 @@
</p>
</div>
<div class="read-more">
<a class="lead" href="{% url 'djangocms_blog:post-detail' post.slug %}">{% trans "read more" %} &raquo;</a>
<a class="lead"
href="{% url 'digitalglarus:blog-detail' post.slug %}">{% trans "read more" %} &raquo;</a>
</div>
</article>

View file

@ -1,4 +1,4 @@
{% extends "base_glarus.html" %}
{% extends "base.html" %}
{% load i18n thumbnail cms_tags %}
{% block meta_description %}{{ post.meta_description }}{% endblock meta_description %}

View file

@ -1,4 +1,4 @@
{% extends "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 %}

View file

@ -6,6 +6,6 @@ urlpatterns = [
url(r'old_contact$', views.contact, name='contact'),
url(r'supporters/$', views.supporters, name='supporters'),
# 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'),
url(r'blog/$',views.blog,name='blog'),
]

View file

@ -70,11 +70,14 @@ def blog(request):
def blog_detail(request, slug):
post = Post.objects.filter_by_language(get_language()).filter(slug=slug).first()
# post = Post.objects.filter_by_language(get_language()).filter(slug=slug).first()
language = 'en-us' # currently nothing is translated to german so we give then en
post = Post.objects.translated(language, slug=slug).first()
context = {
'post': post,
}
return render(request, 'post_detail.html', context)
return render(request, 'glarus_blog/post_detail.html', context)
def supporters(request):

View file

@ -27,9 +27,6 @@ PROJECT_DIR = os.path.abspath(
# load .env file
dotenv.read_dotenv("{0}/.env".format(PROJECT_DIR))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
SITE_ID = 1
APP_ROOT_ENDPOINT = "/"
@ -165,7 +162,7 @@ CMS_TEMPLATES = (
('two_columns.html', gettext('3 Column')),
('about.html', gettext('DG.About')),
('contact.html', gettext('DG.Contact')),
('index.html', gettext('DG.Home')),
('home_digitalglarus.html', gettext('DG.Home')),
('letscowork.html', gettext('DG.CoWork')),
# ('detail.html', gettext('DG.Detail')),
('one_column.html', gettext('DG.OneColumn')),

View file

@ -18,7 +18,7 @@ urlpatterns = [
# note the django CMS URLs included via i18n_patterns
urlpatterns += i18n_patterns('',
url(r'^$',include('ungleich.urls')),
# url(r'^$',include('ungleich.urls')),
url(r'^blog/',include('ungleich.urls',namespace='ungleich')),
url(r'^login/',include(membership_urls)),
url(r'^admin/', include(admin.site.urls)),

View file

@ -1,3 +1,3 @@
{% extends "base_ungleich.html" %}
{% extends "base_glarus.html" %}
{% block base_content %}
{% endblock %}

View file

@ -5,4 +5,5 @@ urlpatterns = [
url(r'^$',views.PostListViewUngleich.as_view()),
# url(r'^$',views.PostListView.as_view()),
url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<slug>\w[-\w]*)/$',views.details)
]

View file

@ -42,6 +42,11 @@ class PostListViewUngleich(PostListView):
def details(request, year, month, day, slug):
post = Post.objects.translated(get_language(), slug=slug).first()
#should be this way
language = get_language()
#but currently the posts are not trasnlated
# language = 'en-us'
post = Post.objects.translated(language, slug=slug).first()
context = {'post': post}
return render(request, 'ungleich/djangocms_blog/post_detail.html', context=context)