Advertisement
BondokBE

templates/post.html

Feb 10th, 2019
513
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 11.32 KB | None | 0 0
  1. {% extends 'base.html' %}
  2.  
  3. {% load static %}
  4. {% load markdown_deux_tags %}
  5. {% load crispy_forms_tags %}
  6.  
  7.  
  8.     {% block head_title %}
  9.     {{ post.title }} | {{ block.super }}
  10.     {% endblock head_title %}
  11.        
  12.     {% block content %}
  13.  
  14.         <!--============ site content ==============================-->
  15.  
  16.         <div class="site_content">
  17.             <div class="container">
  18.                 <div class="row">
  19.                    
  20.                     <!-- Post Content C-8 -->
  21.                     <div class="col-lg-8 main_post">
  22.  
  23.                         <div class="post_content">
  24.  
  25.                             <!-- title -->
  26.                             <h2 class="card-text">{{ post.title }}</h2>
  27.                             <hr>
  28.  
  29.                             <!-- Date/Time -->
  30.                             <i class="fa fa-calendar-alt"></i>&nbsp; <span>Posted: {{ post.publish }}</span>&nbsp;
  31.                             <span class="time_reading">| <i class="far fa-clock"></i>&nbsp; {{ read_time }} Minute Read</span>
  32.                             <br>
  33.                             <!-- {% if post.user.get_full_name %} -->
  34.                             <span><i class="fa fa-user"></i>&nbsp; By: {{ post.user.get_full_name }}</span>
  35.                             <!-- {% endif %} -->
  36.                             <hr>
  37.                            
  38.                            
  39.                             {% if post.draft %}
  40.                             <div class="btn btn-warning">Draft! {{ post.publish }}</div><br>
  41.                             <hr>
  42.                             {% endif %}
  43.                                
  44.                                
  45.                             <!-- Preview Image -->
  46.                             {% if post.image %}
  47.                                 <img class="img-fluid rounded post_img" src="{{ post.image.url }}" alt="">
  48.                             {% endif %}
  49.                             <hr>
  50.                
  51.                             <!-- Post Content -->
  52.                            
  53.                             <!-- path: {% url 'posts:post' id=post.id %} <br>  -->
  54.                             <!--it will giv you the path -->
  55.        
  56.                             <div class="card-text" id="content_markdown">{{ post.get_markdown }}</div>
  57.                             <hr>
  58.                             <p class="card-text">Last Update: {{ post.updated | timesince }} ago</p>
  59.                             <hr>
  60.                             <!-- edit post -->
  61.                             {% if request.user.is_authenticated and request.user.is_superuser %}
  62.                             <div style="margin-bottom: 20px;">
  63.                                 <a href="{{ post.edit_url }}" class="btn btn-primary">Edit Post</a>
  64.                             </div>
  65.                             {% endif %}
  66.                             <!-- delete post -->
  67.                             {% if request.user.is_authenticated and request.user.is_superuser %}
  68.                                 <button class="btn btn-primary" id="delete_button">Delete Post</button>
  69.                                 <br>
  70.                                 <br>
  71.  
  72.  
  73.                                 <div class="card p-2" id="delete_post" style="margin-bottom: 20px;">
  74.                                     <div class="card-header">Are you sure to delete post?</div><br>
  75.                                     <a href="{{ post.delete_url }}" class="btn btn-danger m-2">Delete Post</a>
  76.                                 </div>
  77.                                 <hr>
  78.                             {% endif %}
  79.                                
  80.                            
  81.                             <div class="share_links">
  82.                                 <span class="lead">Share post:</span>
  83.                                 <div class="s_link">
  84.                                     <a href="https://www.facebook.com/sharer/sharer.php?u={{ request.build_absolute_uri }}" target="_blank">
  85.                                         <img src="{% static 'img/facebook.png' %}">
  86.                                     </a>
  87.                                 </div>
  88.                                 <div class="s_link">
  89.                                     <a href="https://twitter.com/home?status={{ share_string }}%20{{ request.build_absolute_uri }}" target="_blank">
  90.                                         <img src="{% static 'img/twitter.png' %}">
  91.                                     </a>
  92.                                 </div>
  93.                                 <div class="s_link">
  94.                                     <a href="https://www.linkedin.com/shareArticle?mini=true&url={{ request.build_absolute_uri }}&title={{ post.title }}&summary={{ share_string }}&source={{ request.build_absolute_uri }}" target="_blank">
  95.                                         <img src="{% static 'img/linkedin.png' %}">
  96.                                     </a>
  97.                                 </div>
  98.                             </div><!-- share links -->
  99.  
  100.                         </div><!-- post_content -->
  101.                            
  102.                        
  103.                         <hr>
  104.                         <br>
  105.                         <div class="comment_section">
  106.  
  107.                             {% if user.is_authenticated %}
  108.                             <!-- Comments Form -->
  109.                             <div class="card my-4">
  110.                                 <div class="card-header">    
  111.                                     <h5>Leave a Comment:</h5>
  112.                                     <small>Code must be tabbed!. You can use marked content </small>
  113.                                 </div>
  114.                                 <div class="card-body">
  115.                                     <form method="POST" action="." class="main_comment">
  116.                                         {% csrf_token %}
  117.                                         {{ comment_form | crispy }}
  118.                                         <input type="submit" class="btn btn-primary" value="Post Comment">
  119.                                     </form>
  120.                                 </div>
  121.                             </div>
  122.                             <hr>
  123.                             {% endif %}
  124.                            
  125.                             {% if comments.count > 0 %}
  126.                             <span class="badge badge-warning" style="margin-bottom: 20px; font-size: 16px;">Comments: {{ comments.count }}</span>
  127.                             {% endif %}
  128.  
  129.                             <!-- show comments -->
  130.                                
  131.                             {% for comment in comments %}
  132.                                 <!-- Single Comment -->
  133.                                 <hr>
  134.                                 <div class="media mb-4">
  135.                                     <hr>
  136.                                     <img class="d-flex mr-3 rounded" src="http://placehold.it/35x35" alt="">
  137.                                     <div class="media-body">
  138.                                         <h5 class="mt-0">{{ comment.user }}:</h5>
  139.                                         <div class="content">
  140.                                             <p class="lead">{{ comment.content | markdown }}</p>
  141.                                         </div>
  142.                                        
  143.                                         <div class="links">
  144.                                             <!-- <a href="#" class="badge badge-primary" id="like">like</a>&nbsp;&nbsp; -->
  145.                                            
  146.                                             {% if user.is_authenticated %}
  147.                                             <a href="#" class="badge badge-primary" id="reply_comment">Reply</a>&nbsp;&nbsp;
  148.                                             <a href="{{ comment.get_absolute_url }}" class="badge badge-info" target="_blank">Comment Thread</a>&nbsp;&nbsp;
  149.                                             {% endif %}
  150.                                                
  151.                                             <i class="fa fa-angle-right"></i>&nbsp;
  152.                                             <small>{{ comment.time_stamp }}</small>
  153.                                             &nbsp;
  154.                                             {% if comment.children.count > 0 %}
  155.                                             <span class="badge badge-warning">replies: {{ comment.children.count }}</span>
  156.                                             {% endif %}
  157.                                                
  158.                                         </div>
  159.  
  160.                                         <!-- reply form -->
  161.  
  162.                                         <form method="POST" action="." id="reply_form">
  163.                                             {% csrf_token %}
  164.                                             {{ comment_form | crispy }}
  165.                                             <input type="hidden" name="parent_id" value='{{ comment.id }}'>
  166.                                             <input type="submit" class="btn btn-primary" value="Post Reply">
  167.                                         </form><!-- reply_form -->
  168.                                        
  169.                                         <hr>
  170.                                        
  171.                                         <!-- reply content -->
  172.  
  173.                                         {% for child_comment in comment.children %}
  174.                                             <div class="media mt-4 replay_cont">
  175.                                                 <img class="d-flex mr-3 rounded" src="http://placehold.it/35x35" alt="">
  176.                                                 <div class="media-body">
  177.                                                     <h5 class="mt-0">{{ child_comment.user }}</h5>
  178.                                                     <div class="content">
  179.                                                         <p class="lead">{{ child_comment.content | markdown }}</p>
  180.                                                     </div>
  181.                                                     <div class="links">
  182.                                                         <!-- <a href="#" class="badge badge-primary" id="like">like</a>&nbsp;&nbsp; -->
  183.                                                         <i class="fa fa-angle-right"></i>&nbsp;
  184.                                                         <small>{{ child_comment.time_stamp }}</small>
  185.                                                     </div>
  186.  
  187.                                                 </div>
  188.                                             </div>
  189.                                         {% endfor %}
  190.  
  191.                                     </div><!-- media-body -->
  192.                                 </div><!-- media -->
  193.                             {% endfor %}
  194.  
  195.                         </div><!-- comment_section -->
  196.  
  197.                     </div><!-- main_post col-8 -->                  
  198.                    
  199.                     <!-- Sidebar Widgets C-3 -->
  200.                     <div class="col-md-3 side_bar">
  201.  
  202.                         <!-- including side bar -->
  203.                         {% include 'side_bar.html' %}
  204.  
  205.                     </div><!-- side bar -->
  206.  
  207.                 </div><!-- row -->
  208.             </div><!-- container -->
  209.         </div><!-- site content -->
  210.  
  211.     {% endblock content %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement