globalstream.html 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. {% extends "socialnetwork/base.html" %}
  2. {% block title %}
  3. Your global stream
  4. {% endblock %}
  5. {% block header1 %}
  6. <div class="right">
  7. <a href="{% url 'logout' %}" class="btn waves-effect waves-teal lighten-3">LOGOUT</a>
  8. </div>
  9. {% endblock %}
  10. {% block header2 %}
  11. <div class="left">
  12. <a href="{% url 'edit_profile' %}" class="btn waves-effect waves-light red lighten-2">EDIT PROFILE</a>
  13. </div>
  14. <div class="right">
  15. <a href="{% url 'followerstream' %}" class="btn waves-light red lighten-2">FOLLOWER STREAM</a>
  16. </div>
  17. {% endblock %}
  18. {% block content %}
  19. <form action="{% url 'add_post' %}" method="post">
  20. <div class="container">
  21. <br>
  22. Welcome to your page, <span> {{user.username}}</span>!
  23. {%for error in errors %}
  24. <p style="color:red" class="center-align">
  25. <b>{{error}}</b>
  26. </p>
  27. {% endfor %}
  28. <div class="row">
  29. <br>
  30. <div class="card-panel col l12 offset-l9 m12 offset-m0 s8 z-depth z-depth-2" id="add-posts">
  31. {{addpost_form}}
  32. <button class="btn waves-effect waves-light red lighten-2" type="submit" name="action">SUBMIT
  33. <i class="mdi-content-send right"></i>
  34. </button>
  35. </div>
  36. </div>
  37. </div>
  38. {% csrf_token %}
  39. </form>
  40. <br><br>
  41. <p class="center-align"> This is your global stream: </p>
  42. <div class="container">
  43. <div class="row" id="attachhere">
  44. <input type="hidden" id="finalpost" name="finalpost" value="{{finalpost}}">
  45. {% for post in posts %}
  46. <form class="postsform" data-pid="{{post.id}}">
  47. <div class="card-panel col l12 offset-l9 m12 offset-m0 s8 z-depth-1" id="global-stream">
  48. {% for profile in profiles %}
  49. {% if post.user.id == profile.user.id %}
  50. {% if profile.picture_url %}
  51. <div class="left">
  52. <img src={{profile.picture_url}} alt="{{post.user.text}}" width="50px" height="auto">
  53. </div>
  54. {% else %}
  55. <div class="left">
  56. {% load staticfiles %}
  57. <img src={% static 'socialnetwork/default_avatar.jpg' %} width="50px" height="auto">
  58. }
  59. </div>
  60. {% endif %}
  61. {% endif %}
  62. {% endfor %}
  63. <div> <a href="{% url 'profile' post.user.id %}" + id>{{post.user}}</a></div>
  64. <div> {{post.date_time}} </div>
  65. <div> {{post.post_content}} </div>
  66. <input type="text" placeholder="Comment" id="comment" class="addcommenttext">
  67. <input type="submit" value="submit" class="addcommentpost" data-pid="{{post.id}}"> <br>
  68. <br>
  69. <br>
  70. <hr>
  71. <div class = "commentsection grey lighten-2" id="commentsection-{{post.id}}">
  72. {% for comment in comments %}
  73. {% if comment.comment_post.id == post.id %}
  74. <div class="row">
  75. {% if comment.comment_by.picture_url %}
  76. <div class="left">
  77. <img src={{comment.comment_by.picture_url}} width="30px" height="auto">
  78. </div>
  79. {% else %}
  80. <div class="left">
  81. {% load staticfiles %}
  82. <img src={% static 'socialnetwork/default_avatar.jpg' %} width="30px" height="auto">
  83. </div>
  84. {% endif %}
  85. <div> {{comment.comment_by.user}}
  86. <div class="right">{{comment.comment_datetime}}</div>
  87. </div>
  88. {{comment.comment_text}}
  89. </div>
  90. {% endif %}
  91. {% endfor %}
  92. </div>
  93. </div>
  94. {% csrf_token %}
  95. </form>
  96. {% endfor %}
  97. </div>
  98. </div>
  99. {% load staticfiles %}
  100. <script src="{% static 'js/jquery-2.1.3.min.js' %}"></script>
  101. <script src="{% static 'js/todo.js' %}" type="text/javascript"></script>
  102. {% endblock %}