changeset 1107:977e76f7f736

POTD converted to V3 design.
author Brian Neal <bgneal@gmail.com>
date Wed, 06 Jul 2016 21:41:16 -0500
parents 2315707f582d
children 7fd997285c9e
files core/templatetags/core_tags.py potd/static/css/potd.css potd/views.py sg101/templates/comments/v3/comment_form.html sg101/templates/core/v3/social_sharing_tag.html sg101/templates/potd/view.html
diffstat 6 files changed, 81 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/core/templatetags/core_tags.py	Wed Jul 06 20:46:09 2016 -0500
+++ b/core/templatetags/core_tags.py	Wed Jul 06 21:41:16 2016 -0500
@@ -62,7 +62,7 @@
 
 
 @register.simple_tag(takes_context=True)
-def social_sharing(context, title, url):
+def social_sharing(context, title, url, center=False):
     """
     Displays social media sharing buttons.
 
@@ -77,6 +77,7 @@
     with context.push():
         context['title'] = title
         context['url'] = url
+        context['center'] = center
         return t.render(context)
 
 
--- a/potd/static/css/potd.css	Wed Jul 06 20:46:09 2016 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-div.potd-details {
-    text-align: center;
-}
-div.potd-details p.caption {
-    font-weight: bold;
-}
-div.potd-details p.details {
-    font-style: italic;
-    font-size: smaller;
-}
--- a/potd/views.py	Wed Jul 06 20:46:09 2016 -0500
+++ b/potd/views.py	Wed Jul 06 21:41:16 2016 -0500
@@ -14,6 +14,7 @@
     return render(request, 'potd/view.html', {
         'potd': potd,
         'is_current': True,
+        'V3_DESIGN': True,
         })
 
 
@@ -22,4 +23,5 @@
     return render(request, 'potd/view.html', {
         'potd': photo,
         'is_current': False,
+        'V3_DESIGN': True,
         })
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sg101/templates/comments/v3/comment_form.html	Wed Jul 06 21:41:16 2016 -0500
@@ -0,0 +1,16 @@
+{% load core_tags %}
+{% if user.is_authenticated %}
+   <form action="{% url 'comments-post' %}" method="post" id="comment-form">{% csrf_token %}
+      {{ form.non_field_errors }}
+      {% post_box form.comment %}
+      {{ form.content_type }}
+      {{ form.object_pk }}
+      <input type="submit" name="post" value="Post Comment" id="comment-form-post" class="primary button"/>
+   </form>
+   {% include 'core/v3/post_box_modals.html' %}
+{% else %}
+   <div class="callout">
+      Please <a href="{% url 'accounts-login' %}">login</a> or
+      <a href="{% url 'accounts-register' %}">register</a> to leave a comment.
+   </div>
+{% endif %}
--- a/sg101/templates/core/v3/social_sharing_tag.html	Wed Jul 06 20:46:09 2016 -0500
+++ b/sg101/templates/core/v3/social_sharing_tag.html	Wed Jul 06 21:41:16 2016 -0500
@@ -1,4 +1,7 @@
 {% load static from staticfiles %}
+{% if center %}
+<div class="menu-centered">
+{% endif %}
 <ul class="menu">
    <li>
       <a href="https://twitter.com/intent/tweet?text={{ title|urlencode }}&amp;url={{ url|urlencode }}&amp;via=SurfGuitar101">
@@ -16,3 +19,6 @@
       </a>
    </li>
 </ul>
+{% if center %}
+</div>
+{% endif %}
--- a/sg101/templates/potd/view.html	Wed Jul 06 20:46:09 2016 -0500
+++ b/sg101/templates/potd/view.html	Wed Jul 06 21:41:16 2016 -0500
@@ -1,4 +1,4 @@
-{% extends 'base.html' %}
+{% extends 'v3/base.html' %}
 {% load static from staticfiles %}
 {% load bio_tags %}
 {% load core_tags %}
@@ -9,13 +9,8 @@
 {% open_graph_meta_tags potd %}
 {% endblock %}
 {% block custom_css %}
-<link rel="stylesheet" type="text/css" href="{% static "css/potd.css" %}" />
 <link rel="stylesheet" type="text/css" href="{% static "css/comments.css" %}" />
 {% endblock %}
-{% block custom_js %}
-{% script_tags "markitup jquery-ui" %}
-<script type="text/javascript" src="{% static "js/comments.js" %}"></script>
-{% endblock %}
 {% block content %}
 {% if is_current %}
 <h2>Photo Of The Day</h2>
@@ -24,29 +19,61 @@
 <h2>Photo Of The Day Archives</h2>
 {% endif %}
 {% if potd %}
-<div class="potd-details">
-<img src="{{ potd.photo.url }}" alt="{{ potd.caption }}" title="{{ potd.caption }}" />
-<p class="caption">{{ potd.caption }}</p>
-<p class="details">
-Submitted by 
-{% profile_link potd.user.username %} on {{ potd.date_added|date:"d F Y" }}.<br />
-This photo has been Photo of the Day {{ potd.potd_count }} time{{ potd.potd_count|pluralize }}.
-</p>
-<div class="description">{{ potd.description|safe }}</div>
-<p class="details">
-If you would like us to feature your photo, send it along with your username, a title, and 
-short description to <a href="mailto:admin@surfguitar101.com">admin@surfguitar101.com</a>.
-</p>
-{% social_sharing potd.caption potd.get_absolute_url %}
+<div class="row">
+   <div class="columns">
+      <div class="text-center">
+         <img src="{{ potd.photo.url }}" alt="{{ potd.caption }}" title="{{ potd.caption }}" />
+      </div>
+   </div>
+</div>
+<div class="row">
+   <div class="columns">
+      <div class="text-center">
+         <p><strong>{{ potd.caption }}</strong></p>
+         <p class="quiet">
+            <em>
+            Submitted by
+            {% profile_link potd.user.username %} on {{ potd.date_added|date:"d F Y" }}.<br />
+            This photo has been Photo of the Day {{ potd.potd_count }} time{{ potd.potd_count|pluralize }}.
+            </em>
+         </p>
+      </div>
+   </div>
+</div>
+<div class="row">
+   <div class="columns">
+      <div class="text-center"><p>{{ potd.description|safe }}</p></div>
+   </div>
+</div>
+<div class="row">
+   <div class="columns">
+      <div class="text-center quiet">
+         <p>
+         If you would like us to feature your photo, send it along with your username, a title, and 
+         short description to <a href="mailto:admin@surfguitar101.com">admin@surfguitar101.com</a>.
+         </p>
+      </div>
+   </div>
+</div>
+{% social_sharing potd.caption potd.get_absolute_url center=True %}
 {% get_comment_count for potd as comment_count %}
-<p>This photo has <span id="comment-count">{{ comment_count }}</span> comment{{ comment_count|pluralize }}.</p>
+<div class="row">
+   <div class="columns">
+      <div class="text-center quiet">
+         <em>
+         This photo has <span id="comment-count">{{ comment_count }}</span> comment{{ comment_count|pluralize }}.
+         </em>
+      </div>
+   </div>
+</div>
+
 <hr />
-</div>
+
 {% render_comment_list potd %}
+<br>
 {% if potd.can_comment_on %}
 <p>Leave a comment?</p>
-{% render_comment_form user potd %}
-<br />
+{% render_comment_form_v3 user potd %}
 {% else %}
 <p>Comments are allowed only on today's photo of the day. If you'd like to share your thoughts on this photo 
 with the site staff, you can <a href="{% url 'contact-form' %}">contact us directly</a>.</p>
@@ -55,3 +82,7 @@
 <p>We're sorry, there doesn't seem to be a photo of the day right now.</p>
 {% endif %}
 {% endblock %}
+{% block custom_js %}
+   <script src="{% static "js/comments.js" %}"></script>
+   <script src="{% static "js/v3/post_box.js" %}"></script>
+{% endblock %}