Mercurial > agora
annotate templates/snippet/snippet_details.djhtml @ 102:f872c643b056
Updates to snippet functionality (see details)
Sorry about the large commit, but it was difficult to break it up as a lot
of new functionality was introduced. Most of it is specific to the snippet
feature but there are some other changes as well.
Commit highlights:
* Added the ability to switch the syntax highlighting colour scheme when
viewing a snippet. This is currently done on a per-snippet basis only,
but eventually it will be possible to set a default in your profile to
have all the snippets you view use that colour scheme. There are currently
8 different colour schemes, all of which were taken from the default
pygments stylesheets (some were modified).
* Added a "num_views" field to the Snippet model, with the field being
incremented any time the snippet view is called (raw or regular view).
* Created a simple "explore" view that lists the recently-posted snippets.
Will implement pagination and sorting by other attributes ("popularity",
for example, based on number of views) as well.
* Added a post-save hook to the User model to ensure that a Profile is created
for every user as soon as the User itself is created. This alleviates the
need for a get_profile method that checks if the user has a profile or not
and creates one if necessary. (The code is currently still there, will be
cleaned up soon).
* Added back the wordwrap toggling feature. Currently, if you want to enable
word-wrapping, the line numbers have to be hidden in order to ensure that
the lines and their numbers don't go out of sync. This will be fixed soon.
* History/diff view is back
* And some other minor cosmetic changes.
Note: since some existing models have been changed, you'll likely need to
delete the existing sqlite database before running syncdb. The alternative
is to determine the necessary column changes/additions and run the SQL
query yourself.
author | dellsystem <ilostwaldo@gmail.com> |
---|---|
date | Fri, 31 Aug 2012 02:53:22 -0400 |
parents | d48e8676b18f |
children | 7d753658dc0e |
rev | line source |
---|---|
44
f697817182d1
Rename .html snippets to .djhtml
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
42
diff
changeset
|
1 {% extends "snippet/base.djhtml" %} |
42
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
2 {% load mptt_tags %} |
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
3 {% load i18n %} |
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
4 |
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
5 {% block extrahead %} |
46
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
6 {% if request.session.userprefs %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
7 <style type="text/css" media="all"> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
8 .highlight { |
46
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
9 {# FIXME: Thats stupid #} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
10 {% ifnotequal request.session.userprefs.font_family "None" %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
11 font-family: {{ request.session.userprefs.font_family }} !important; |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
12 {% endifnotequal %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
13 {% ifnotequal request.session.userprefs.font_size "None" %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
14 font-size: {{ request.session.userprefs.font_size }}px !important; |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
15 {% endifnotequal %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
16 {% ifnotequal request.session.userprefs.line_height "None" %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
17 line-height: {{ request.session.userprefs.line_height }}px !important; |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
18 {% endifnotequal %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
19 } |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
20 </style> |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
21 {% endif %} |
42
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
22 {% endblock %} |
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
23 |
46
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
24 {% block title %} |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
25 Viewing snippet — {{ snippet.get_title }} |
46
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
26 {% endblock title %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
27 |
42
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
28 {% block headline %} |
46
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
29 <h1> |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
30 {% trans "Snippet" %} #{{ snippet.pk }} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
31 {% if snippet.parent_id %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
32 {% blocktrans with snippet.parent.get_absolute_url as parent_url and snippet.parent.id as parent_id %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
33 (Copy of <a href="{{ parent_url }}">snippet #{{ parent_id }}</a>) |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
34 {% endblocktrans %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
35 {% endif %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
36 <span class="date"> |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
37 {{ snippet.published|date:_("DATETIME_FORMAT") }} ({% trans "UTC" %}) |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
38 </span> |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
39 </h1> |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
40 {% endblock headline %} |
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
41 |
42
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
42 {% load snippet_tags %} |
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
43 |
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
44 {% block content %} |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
45 <div id="non-sidebar"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
46 <div id="diff"> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
47 </div> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
48 |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
49 <h1>{{ snippet.get_title }}</h1> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
50 <div class="snippet-options"> |
55
d48e8676b18f
Show snippets by user in their profile, and show 10 latest snippets on the add snippet page
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
52
diff
changeset
|
51 <abbr title="{% trans "Time to live" %}" |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
52 >TTL: |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
53 </abbr> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
54 {{ snippet.expires|timeuntil }} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
55 — |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
56 {% if snippet.pk|in_list:request.session.snippet_list %} |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
57 <a onclick="return confirm('{% trans "Really delete this snippet?" %}')" |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
58 href="{% url snippet_delete snippet.secret_id %}"> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
59 Delete this snippet |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
60 </a> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
61 — |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
62 {% endif %} |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
63 <a id="toggle-wordwrap" href="#">{% trans "Toggle wordwrap" %}</a> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
64 — |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
65 Syntax highlighting style: |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
66 <select id="change-highlighting" |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
67 data-default="{{ default_style }}"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
68 {% for pygments_style in pygments_styles %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
69 <option name="{{ pygments_style }}"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
70 {{ pygments_style }} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
71 {% if pygments_style == default_style %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
72 (default) |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
73 {% endif %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
74 </option> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
75 {% endfor %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
76 </select> |
52
349162d0ce19
Fundamental fixes in snippet templates
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
48
diff
changeset
|
77 <div> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
78 Author: |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
79 {% if snippet.author %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
80 <a href="{% url agora.apps.profile.views.showprofile snippet.author %}"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
81 {{ snippet.author }} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
82 </a> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
83 {% else %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
84 anonymous |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
85 {% endif %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
86 — |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
87 Language: {{language}} |
52
349162d0ce19
Fundamental fixes in snippet templates
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
48
diff
changeset
|
88 </div> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
89 </div> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
90 <br /> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
91 <div class="snippet"> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
92 <table> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
93 <tr> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
94 <th id="line-numbers"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
95 {# this has to look like this due to the pre tags #} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
96 <pre class="numbers">{% for l in lines %}<a href="#l{{ forloop.counter }}" id="l{{ forloop.counter }}">{{ forloop.counter }}</a> |
47
139e4b8ffb17
Fix display of js code and copy-pastability of displayed code
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
46
diff
changeset
|
97 {% endfor %}</pre> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
98 </th> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
99 <td> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
100 {# this has to look like this due to the pre tags #} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
101 <pre class="highlight {{ default_style }}">{% for line in snippet.content_splitted %}<span class="line" id="l{{ forloop.counter }}">{% if line %}{{ line|safe }}{% else %} {% endif %}</span> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
102 {% endfor %}</pre> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
103 </td> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
104 </tr> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
105 </table> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
106 </div> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
107 |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
108 <br /> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
109 |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
110 <h2 id="revise">{% trans "Revise this snippet" %}</h2> |
42
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
111 |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
112 {% include "snippet/snippet_form.djhtml" %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
113 </div><div id="sidebar"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
114 <h2>{% trans "History" %}</h2> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
115 {% if no_descendants %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
116 <p>{% trans "This snippet has no children!" %}</p> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
117 <p> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
118 <a href="#revise"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
119 {% trans "Make one" %} » |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
120 </a> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
121 </p> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
122 {% else %} |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
123 <form method="get" id="diffform" action="{% url snippet_diff %}"> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
124 <div class="tree"> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
125 {% for tree_item,structure in tree|tree_info %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
126 {% if structure.new_level %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
127 <ul> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
128 <li> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
129 {% else %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
130 </li> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
131 <li> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
132 {% endif %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
133 <div> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
134 <span class="diff"> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
135 <input type="radio" name="a" |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
136 value="{{ tree_item.id }}" |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
137 {% ifequal tree_item.id snippet.parent_id %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
138 checked="checked" |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
139 {% endifequal %}/> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
140 <input type="radio" |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
141 name="b" |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
142 value="{{ tree_item.id }}" |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
143 {% ifequal snippet tree_item %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
144 checked="checked" |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
145 {% endifequal %}/> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
146 </span> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
147 {% ifequal snippet tree_item %} |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
148 <strong>{{ tree_item.get_title }}</strong> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
149 {% else %} |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
150 <a href="{{ tree_item.get_absolute_url }}"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
151 {{ tree_item.get_title }} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
152 </a> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
153 {% endifequal %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
154 </div> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
155 {% for level in structure.closed_levels %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
156 </li> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
157 </ul> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
158 {% endfor %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
159 {% endfor %} |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
160 <div class="submit"> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
161 <input type="submit" value="{% trans "Compare" %}"/> |
42
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
162 </div> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
163 </div> |
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
164 </form> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
165 {% endif %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
166 <br /> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
167 <h2>{% trans "Options" %}</h2> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
168 <a href="{% url snippet_details_raw snippet.secret_id %}"> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
169 {% trans "View raw" %} |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
170 </a> |
48
329a9d17be88
Implement/fix js for snippets and make whiteboxes all same width
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
47
diff
changeset
|
171 </div> |
102
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
172 </div> |
f872c643b056
Updates to snippet functionality (see details)
dellsystem <ilostwaldo@gmail.com>
parents:
55
diff
changeset
|
173 {% endblock %} |
42
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
174 |
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
175 {% block script_footer %} |
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
176 <script type="text/javascript"> |
47
139e4b8ffb17
Fix display of js code and copy-pastability of displayed code
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
46
diff
changeset
|
177 {%include "snippet/snippet_details.js" %} |
42
ab608f27ecd5
Copy preliminary django-paste code for snippets along with mptt. Works clunkily. Still need to adapt it for Agora.
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
diff
changeset
|
178 </script> |
46
b7c1c22fdfe8
Format code for 80 columns, add some js to static/ dir
Jordi Gutiérrez Hermoso <jordigh@gmail.com>
parents:
44
diff
changeset
|
179 {% endblock script_footer %} |