/
show_paste.html
78 lines (75 loc) · 3.02 KB
/
show_paste.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{% extends "base.html" %}
{% load extra_tags %}
{% block title %}{{ paste.title }}{% endblock %}
{% block content %}
<div class="container">
<div class="row">
<div class="col-md-12">
<!-- Include information that is visible to Javascript script(s) -->
<script>
var pastebin_char_id = "{{ paste.char_id }}";
var pastebin_paste_favorited = {% if paste_favorited %}true{% else %}false{% endif %};
var pastebin_logged_in = {% if user.is_authenticated %}true{% else %}false{% endif %};
var pastebin_csrf_token = "{{ csrf_token }}";
</script>
<br>
<div class="panel panel-info">
<div class="panel-heading">
<h1 class="panel-title">{{ paste.title }}</h1>
</div>
<div class="panel-body">
<div class="container">
<div class="col-md-3">
<p><b>SUBMITTED BY:</b> {% if paste.username %}<b><a href="{% url "users:profile" paste.username %}">{{ paste.username }}</a></b>{% else %}Guest{% endif %}</p>
<p><b>DATE:</b> {{ paste.submitted }}</p>
{% if paste.expiration_date %}
{% with timesince_seconds=paste.expiration_date|timeuntil_in_seconds %}
<p><b style="color: red;">EXPIRES IN:</b> {% seconds_to_str timesince_seconds %}</p>
{% endwith %}
{% endif %}
</div>
<div class="col-md-3">
<a class="btn btn-primary btn-sm" href="{% url "raw_paste" paste.char_id %}"><span class="glyphicon glyphicon-font"></span> Raw</a>
<a class="btn btn-primary btn-sm" href="{% url "download_paste" paste.char_id %}"><span class="glyphicon glyphicon-download"></span> Download</a>
</div>
<div class="col-md-3">
<p><b>COMMENTS: </b> 242</p>
<button type="button" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-menu-down"></span> Go to comments</button>
</div>
<div class="col-md-3">
{% if user.is_authenticated %}
{% if paste_favorited %}
<button id="favorite-button" type="button" class="btn btn-warning btn-sm"><span class='glyphicon glyphicon-remove'></span> Remove favorite</button>
{% else %}
<button id="favorite-button" type="button" class="btn btn-info btn-sm"><span class='glyphicon glyphicon-star'></span> Add to favorites</button>
{% endif %}
{% if paste.user_id == user.id %}
<a class="btn btn-danger btn-sm" href="{% url "pastes:delete_paste" paste.char_id %}"><span class="glyphicon glyphicon-remove"></span> Delete paste</a>
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
<hr>
{{ paste.text|safe }}
<!-- Comments -->
<hr>
<div class="panel panel-default">
<div class="panel-heading">
<button type="button" class="btn btn-info btn-sm">Show comments (242)</button>
</div>
<div style="display: none;" class="panel-body">
<div class="container">
<p>Placeholder</p>
</div>
</div>
</div>
</div>
</div>
</div>
{% block extra_js %}
{% load staticfiles %}
<script src="{% static 'js/pastebin-favorite.js' %}"></script>
{% endblock %}
{% endblock %}