~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/templates/revision.pt

  • Committer: Francesco 'pr0gg3d' Del Degan
  • Date: 2011-08-08 20:58:09 UTC
  • mto: This revision was merged to the branch mainline in revision 454.
  • Revision ID: f.deldegan@pr0gg3d.net-20110808205809-n3eg73n80ymyd6kj
Fixes bug in annotate that occurs when file is zero-sized

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
    <head>
5
5
      <title metal:fill-slot="title"
6
6
             tal:content="string:${branch/friendly_name} : revision ${change/revno}">
7
 
        ${branch.friendly_name} : revision ${change.revno}
8
7
      </title>
9
8
 
10
 
      <metal:block fill-slot="header-extras">
 
9
      <metal:block fill-slot="header_extras">
 
10
        <link rel="stylesheet" type="text/css" media="all"
 
11
              tal:attributes="href python:branch.static_url('/static/css/diff.css')"/>
11
12
        <script type="text/javascript"
12
 
                tal:attributes="src python:tg.url('/static/javascript/collapse.js')">
13
 
        </script>
14
 
 
 
13
                tal:attributes="src python:branch.static_url('/static/javascript/diff.js')"></script>
15
14
        <script type="text/javascript">
16
 
          <!--
17
 
              function show_sbs() {
18
 
              collapseDisplay('style', 'sbs', 'table');
19
 
              collapseDisplay('style', 'unified', 'none');
20
 
              document.cookie='diff=sbs';
21
 
              }
22
 
              function show_unified() {
23
 
              collapseDisplay('style', 'unified', 'table');
24
 
              collapseDisplay('style', 'sbs', 'none');
25
 
              document.cookie='diff=unified';
26
 
              }
27
 
              function load() {
28
 
              sortCollapseElements();
29
 
              if (document.cookie.indexOf('diff=unified') >= 0) { show_unified(); }
30
 
              }
31
 
              // -->
 
15
          var link_data = <tal:b content="link_data" />;
 
16
          var specific_path = <tal:b content="json_specific_path" />;
 
17
          var path_to_id = <tal:b content="path_to_id" />;
32
18
        </script>
33
19
      </metal:block>
34
20
    </head>
35
21
 
36
22
    <body>
37
 
 
38
 
      <h1 metal:fill-slot="heading">
39
 
        <span class="branch-name" tal:content="branch/friendly_name">
40
 
          ${branch.friendly_name}
41
 
        </span>
42
 
        : revision
43
 
        <tal:revno content="change/revno">
44
 
          ${change.revno}
45
 
        </tal:revno>
46
 
        <tal:compare-to condition="python:compare_revid is not None">
47
 
          (compared to revision <tal:b content="python:history.get_revno(compare_revid)" />)
48
 
        </tal:compare-to>
49
 
      </h1>
 
23
      <tal:block metal:fill-slot="backlink">
 
24
          <tal:has-link condition="branch/branch_link">
 
25
            <div class="black-link">
 
26
                <a tal:attributes="href branch/branch_link">
 
27
                  &#8592; Back to branch summary
 
28
                </a>
 
29
            </div>
 
30
          </tal:has-link>
 
31
      </tal:block>
 
32
      <tal:block metal:fill-slot="branchname" tal:content="string:${branch/friendly_name}" />
 
33
      <tal:block metal:fill-slot="heading">
 
34
        <div id="breadcrumbs">
 
35
          <tal:has-link condition="branch/branch_link">
 
36
            <a tal:attributes="href branch/branch_link"
 
37
               tal:content="branch/friendly_name">
 
38
              nice/branch/name
 
39
            </a>
 
40
          </tal:has-link>
 
41
          <tal:no-link condition="not: branch/branch_link">
 
42
            <span metal:use-macro="breadcrumbs/directory"></span>
 
43
          </tal:no-link>
 
44
          <span class="breadcrumb">&#187; Revision
 
45
            <tal:revno condition="not:specific_path" content="change/revno"></tal:revno>
 
46
            <a tal:condition="specific_path" tal:content="change/revno"
 
47
               tal:attributes="href python:url(['/revision', change.revno])"
 
48
               title="View changes to all files"></a>
 
49
                      <tal:compare-to condition="python:compare_revid is not None">
 
50
              (compared to revision <tal:block content="python:history.get_revno(compare_revid)" />)
 
51
            </tal:compare-to>
 
52
          </span>
 
53
          <span class="breadcrumb" tal:condition="specific_path">
 
54
            : <tal:annotate content="structure python:view_link(url, change.revno, specific_path)" />
 
55
          </span>
 
56
        </div>
 
57
        <tal:branch-info replace="structure python:branchinfo(branch)" />
 
58
        <h1 tal:condition="not:specific_path">
 
59
          Viewing all changes in revision <tal:revno content="change/revno" />.
 
60
        </h1>
 
61
        <p tal:condition="specific_path">
 
62
          <a tal:attributes="href python:url(['/revision', change.revno])">
 
63
            &#xAB; back to all changes in this revision
 
64
          </a>
 
65
        </p>
 
66
        <p tal:condition="specific_path">
 
67
          Viewing changes to <tal:annotate content="structure python:view_link(url, change.revno, specific_path)" />
 
68
        </p>
 
69
        <ul id="submenuTabs">
 
70
          <li id="first"><a tal:attributes="href python:url(['/files', change.revno]);
 
71
                                            title string:browse files at revision ${change/revno}"
 
72
                            tal:content="string:browse files at revision ${change/revno}"></a></li>
 
73
          <li tal:condition="python:remember != change.revno">
 
74
            <a tal:attributes="href python:url(['/revision', change.revno], remember=change.revno, compare_revid=None);
 
75
                               title string:compare with another revision"
 
76
               tal:content="string:Compare with another revision"></a></li>
 
77
          <li tal:condition="python:(remember is not None) and (compare_revid is None) and (change.revno != remember)" >
 
78
            <a tal:attributes="href python:url(['/revision', change.revno], compare_revid=history.get_revno(remember))">
 
79
              compare with revision <tal:b content="python:history.get_revno(remember)" />
 
80
            </a>
 
81
          </li>
 
82
          <li>
 
83
            <a tal:condition="python:compare_revid is None"
 
84
               tal:attributes="href python:url(['/diff', change.revno], clear=1)">download diff</a>
 
85
            <a tal:condition="python:compare_revid is not None"
 
86
               tal:attributes="href python:url(['/diff', change.revno, history.get_revno(compare_revid)], clear=1)">download diff</a>
 
87
          </li>
 
88
          <li id="last"><a tal:attributes="href python:url(['/changes', change.revno]);
 
89
                                           title string:view history from revision ${change/revno}"
 
90
                           tal:content="string:view history from revision ${change/revno}"></a></li>
 
91
        </ul>
 
92
 
 
93
        <tal:we-are-comparing condition="python:compare_revid is not None">
 
94
          <ul id="submenuTabs">
 
95
            <li id="first">
 
96
              <a tal:attributes="href python:url([ '/revision', history.get_revno(compare_revid) ], remember=change.revno, compare_revid=change.revno)">
 
97
                reverse the comparison (<tal:b content="change/revno" /> to <tal:b content="python:history.get_revno(compare_revid)" />)
 
98
              </a>
 
99
            </li>
 
100
            <li id="last">
 
101
              <a tal:attributes="href python:url(['/revision', change.revno], remember=None, compare_revid=None)">
 
102
                stop comparing with revision <tal:b content="python:history.get_revno(compare_revid)" />
 
103
              </a>
 
104
            </li>
 
105
          </ul>
 
106
        </tal:we-are-comparing>
 
107
 
 
108
        <tal:revision-info replace="structure python:revisioninfo(url, branch, change, file_changes, specific_path, merged_in)" />
 
109
        <tal:specific-path condition="not:specific_path">
 
110
          <p class="expand show_if_js" id="expand_all"><a href="#">
 
111
              <img tal:attributes="src python:branch.static_url('/static/images/treeCollapsed.png')"
 
112
                   alt="expand all" /> expand all</a>
 
113
          </p>
 
114
          <p class="expand" id="collapse_all" style="display:none;"><a href="#">
 
115
              <img tal:attributes="src python:branch.static_url('/static/images/treeExpanded.png')"
 
116
                   alt="collapse all" /> collapse all</a>
 
117
          </p>
 
118
        </tal:specific-path>
 
119
        <!-- Table -->
 
120
        <p class="expand show_if_js"><a id="toggle_unified_sbs" href="#">Show diffs side-by-side</a></p>
 
121
        <p class="codin"><img tal:attributes="src python:branch.static_url('/static/images/newCode.gif')" alt="added" /> added</p>
 
122
        <p class="codin"><img tal:attributes="src python:branch.static_url('/static/images/deleteCode.gif')" alt="removed" /> removed</p>
 
123
        <div class="clear"><!-- --></div>
 
124
 
 
125
      </tal:block>
50
126
 
51
127
      <div metal:fill-slot="content">
52
 
        <div class="links">
53
 
          <div>
54
 
            <b>&#8594;</b>
55
 
            <a tal:attributes="href python:url(['/files', revid])">
56
 
              browse files
57
 
            </a>
58
 
          </div>
59
 
          <div>
60
 
            <b>&#8594;</b>
61
 
            <a tal:attributes="href python:url(['/changes'], start_revid=revid)">
62
 
              view branch changes
63
 
            </a>
64
 
          </div>
65
 
          <div tal:condition="python:compare_revid is None" >
66
 
            <b>&#8594;</b>
67
 
            <a tal:attributes="href python:url(['/bundle', revid, 'bundle.txt'])">
68
 
              view/download patch
69
 
            </a>
70
 
          </div>
71
 
          <div tal:condition="python:compare_revid is not None" >
72
 
            <b>&#8594;</b>
73
 
            <a tal:attributes="href python:url(['/bundle', revid, compare_revid, 'bundle.txt'])">
74
 
              view/download patch
75
 
            </a>
76
 
          </div>
77
 
          <div tal:condition="python:(remember is not None) and (compare_revid is None)" >
78
 
            <b>&#8594;</b>
79
 
            <a tal:attributes="href python:url(['/revision', revid], compare_revid=remember)">
80
 
              compare with revision <tal:b content="python:history.get_revno(remember)" />
81
 
            </a>
82
 
          </div>
83
 
          <div  tal:condition="python:remember != revid">
84
 
            <b>&#8594;</b>
85
 
            <a tal:attributes="href python:url(['/revision', revid], remember=revid, compare_revid=None)">
86
 
              compare with another revision
87
 
            </a>
88
 
          </div>
89
 
          <div tal:condition="python:compare_revid is not None">
90
 
            <b>&#8594;</b>
91
 
            <a tal:attributes="href python:url(['/revision', revid], remember=None, compare_revid=None)">
92
 
              stop comparing to revision <tal:b content="python:history.get_revno(compare_revid)" />
93
 
            </a>
94
 
          </div>
95
 
        </div>
96
 
 
97
 
        <tal:revision-info replace="structure python:revisioninfo(url, branch, change, modified_file_link_rev)" />
98
 
 
99
 
        <table class="diff-option-buttons">
100
 
          <tr>
101
 
            <td>
102
 
              <tal:b content="structure python:collapse_all_button('file', 'table-row')" />
103
 
            </td>
104
 
 
105
 
            <td class="spacey">
106
 
              <a href="javascript:show_sbs()"
107
 
                 class="hide-all collapse-style-sbs-show"
108
 
                 title="collapse">
109
 
                <img tal:attributes="src python:tg.url('/static/images/nav-small-out.gif')"
110
 
                     width="22" height="10" class="collapse-triangle" />
111
 
                show side by side
112
 
              </a>
113
 
              <a href="javascript:show_unified()"
114
 
                 class="hide-all collapse-style-unified-show"
115
 
                 title="expand">
116
 
                <img tal:attributes="src python:tg.url('/static/images/nav-small-in.gif')"
117
 
                     width="22" height="10" class="collapse-triangle" />
118
 
                show unified diff
119
 
              </a>
120
 
            </td>
121
 
 
122
 
            <td class="diff-key-block diff-insert">
123
 
            </td>
124
 
            <td class="label">
125
 
              added
126
 
            </td>
127
 
            <td class="diff-key-block diff-delete">
128
 
            </td>
129
 
            <td class="label">
130
 
              removed
131
 
            </td>
132
 
          </tr>
133
 
        </table>
134
 
 
135
 
        <div class="diff"
136
 
             tal:condition="change/changes/modified"
137
 
             tal:define="uniqs python:{}">
138
 
          <!-- ! side-by-side diff -->
139
 
          <table class="diff-block collapse-style-sbs-content">
140
 
            <tal:block repeat="item change/changes/modified">
141
 
              <tal:u define="u python:util.uniq(uniqs, item.file_id)">
142
 
                <tr>
143
 
                  <th class="filename" colspan="4">
144
 
                    <tal:b content="structure python:collapse_button('file', u, 'table-row')" />
145
 
                    <a tal:attributes="href  python:url(['/annotate', change.revid], file_id=item.file_id);
146
 
                                       name  string:${item/filename}-s;
147
 
                                       title string:Annotate ${item/filename}"
148
 
                       tal:content="item/filename">
149
 
                      ${item.filename}
150
 
                    </a>
151
 
                  </th>
152
 
                </tr>
153
 
 
154
 
                <tal:block repeat="chunk item/sbs_chunks">
155
 
                  <tr tal:attributes="class string:diff-chunk collapse-file-${u}-content">
156
 
                    <th class="lineno">
157
 
                      old
158
 
                    </th>
159
 
                    <th>
160
 
                    </th>
161
 
                    <th class="lineno">
162
 
                      new
163
 
                    </th>
164
 
                    <th>
165
 
                    </th>
166
 
                  </tr>
167
 
                  <tr tal:repeat="line chunk/diff"
168
 
                      tal:attributes="class string:diff-chunk collapse-file-${u}-content">
169
 
                    <tal:block condition="line/old_lineno">
170
 
                      <td class="lineno"
171
 
                          tal:content="line/old_lineno">
172
 
                        ${line.old_lineno}
173
 
                      </td>
174
 
                      <td tal:attributes="class string:diff-${line/old_type}"
175
 
                          tal:content="line/old_line">
176
 
                        ${line.old_line}
177
 
                      </td>
178
 
                    </tal:block>
179
 
                    <tal:block condition="not:line/old_lineno">
180
 
                      <td class="lineno-skip"
181
 
                          tal:content="line/old_lineno">
182
 
                        ${line.old_lineno}
183
 
                      </td>
184
 
                      <td tal:attributes="class string:diff-${line/old_type}-skip"
185
 
                          tal:content="line/old_line">
186
 
                        ${line.old_line}
187
 
                      </td>
188
 
                    </tal:block>
189
 
                    <tal:block condition="line/new_lineno">
190
 
                      <td class="lineno"
191
 
                          tal:content="line/new_lineno">
192
 
                        ${line.new_lineno}
193
 
                      </td>
194
 
                      <td tal:attributes="class string:diff-${line/new_type}"
195
 
                          tal:content="line/new_line">
196
 
                        ${line.new_line}
197
 
                      </td>
198
 
                    </tal:block>
199
 
                    <tal:block condition="not:line/new_lineno">
200
 
                      <td class="lineno-skip"
201
 
                          tal:content="line/new_lineno">
202
 
                        ${line.new_lineno}
203
 
                      </td>
204
 
                      <td tal:attributes="class string:diff-${line/new_type}-skip"
205
 
                          tal:content="line/new_line">
206
 
                        ${line.new_line}
207
 
                      </td>
208
 
                    </tal:block>
209
 
                  </tr>
210
 
                  <tr tal:attributes="class string:diff-chunk-spacing collapse-file-${u}-content">
211
 
                    <td colspan="4">
212
 
                      &nbsp;
213
 
                    </td>
214
 
                  </tr>
215
 
                </tal:block>
216
 
                <tr class="diff-spacing">
217
 
                  <td colspan="4">
218
 
                    &nbsp;
219
 
                  </td>
220
 
                </tr>
221
 
              </tal:u>
222
 
            </tal:block>
223
 
          </table>
224
 
 
225
 
          <!-- ! unified diff -->
226
 
          <table class="diff-block collapse-style-unified-content">
227
 
            <tal:block repeat="item change/changes/modified">
228
 
              <tal:u define="u python:util.uniq(uniqs, item.file_id)">
229
 
                <tr>
230
 
                  <th class="filename" colspan="4">
231
 
                    <tal:b content="structure python:collapse_button('file', u, 'table-row')" />
232
 
                    <a tal:attributes="href  python:url(['/annotate', change.revid], file_id=item.file_id);
233
 
                                       name  string:${item/filename}-u;
234
 
                                       title string:Annotate ${item/filename}"
235
 
                       tal:content="item/filename">
236
 
                      ${item.filename}
237
 
                    </a>
238
 
                  </th>
239
 
                </tr>
240
 
 
241
 
                <tal:block repeat="chunk item/chunks">
242
 
                  <tr tal:attributes="class string:diff-chunk collapse-file-${u}-content">
243
 
                    <th class="lineno">
244
 
                      old
245
 
                    </th>
246
 
                    <th class="lineno">
247
 
                      new
248
 
                    </th>
249
 
                    <th>
250
 
                    </th>
251
 
                    <th>
252
 
                    </th>
253
 
                  </tr>
254
 
                  <tr tal:repeat="line chunk/diff"
255
 
                      tal:attributes="class string:diff-chunk collapse-file-${u}-content">
256
 
                    <td class="lineno"
257
 
                        tal:content="line/old_lineno">
258
 
                      ${line.old_lineno}
259
 
                    </td>
260
 
                    <td class="lineno"
261
 
                        tal:content="line/new_lineno">
262
 
                      ${line.new_lineno}
263
 
                    </td>
264
 
                    <td tal:attributes="class string:diff-${line/type} text"
265
 
                        tal:content="line/line">
266
 
                      ${line.line}
267
 
                    </td>
268
 
                    <td>
269
 
                    </td>
270
 
                  </tr>
271
 
                  <tr tal:attributes="class string:diff-chunk-spacing collapse-file-${u}-content">
272
 
                    <td colspan="4">
273
 
                      &nbsp;
274
 
                    </td>
275
 
                  </tr>
276
 
                </tal:block>
277
 
                <tr class="diff-spacing">
278
 
                  <td colspan="4">
279
 
                    &nbsp;
280
 
                  </td>
281
 
                </tr>
282
 
              </tal:u>
283
 
            </tal:block>
284
 
          </table>
285
 
        </div>
286
 
 
287
 
        <div tal:condition="python:navigation.prev_page_revid or navigation.next_page_revid"
288
 
             class="bar">
289
 
          <table>
290
 
            <tr>
291
 
              <td class="buttons">
292
 
                <a tal:condition="navigation/prev_page_revid"
293
 
                   tal:attributes="href navigation/prev_page_url">
294
 
                  &lt; revision
295
 
                  <tal:r content="python:history.get_revno(navigation.prev_page_revid)" />
296
 
                </a>
297
 
              </td>
298
 
              <td class="rbuttons" align="right">
299
 
                <a tal:condition="navigation/next_page_revid"
300
 
                   tal:attributes="href navigation/next_page_url">
301
 
                  revision
302
 
                  <tal:r content="python:history.get_revno(navigation.next_page_revid)" />
303
 
                  &gt;
304
 
                </a>
305
 
              </td>
306
 
            </tr>
307
 
          </table>
308
 
        </div>
 
128
        <tal:block condition="specific_path">
 
129
          <div class="diff">
 
130
 
 
131
            <div  class="diffBox">
 
132
              <a tal:attributes="href python:url(['/revision', change.revno, specific_path], clear=1);
 
133
                                 id string:${specific_path};
 
134
                                 title string:View changes to ${specific_path} only"
 
135
                 class="the-link">
 
136
                <img tal:attributes="src python:branch.static_url('/static/images/treeExpanded.png')"
 
137
                     class="expand_diff"/>
 
138
                <tal:b content="specific_path" />
 
139
              </a>
 
140
            </div>
 
141
            <div style="overflow: hidden">
 
142
              <div class="container">
 
143
                <div class="loading" style="display:none">
 
144
                  <img tal:attributes="src python:branch.static_url('/static/images/spinner.gif')" />
 
145
                </div>
 
146
                <div class="diffinfo">
 
147
                  <div class="pseudotable unified"
 
148
                       tal:repeat="chunk diff_chunks">
 
149
 
 
150
                    <tal:block condition="not:repeat/chunk/start">
 
151
                      <div class="pseudorow context-row">
 
152
                        <div class="lineNumber separate"></div>
 
153
                        <div class="lineNumber second separate"></div>
 
154
                        <div class="code separate"></div>
 
155
                        <div class="clear"><!-- --></div>
 
156
                      </div>
 
157
                    </tal:block>
 
158
 
 
159
                    <div tal:repeat="line chunk/diff"
 
160
                         tal:attributes="class string:pseudorow ${line/type}-row">
 
161
                      <div class="lineNumber first"
 
162
                           tal:content="structure python:util.fill_div(line.old_lineno)"></div>
 
163
                      <div class="lineNumber second"
 
164
                           tal:content="structure python:util.fill_div(line.new_lineno)"></div>
 
165
                      <div tal:attributes="class string:code ${line/type}"
 
166
                           tal:content="structure python:util.fill_div(util.html_clean(line.line))"></div>
 
167
                      <div class="clear"><!-- --></div>
 
168
                    </div>
 
169
                  </div>
 
170
                </div>
 
171
              </div>
 
172
            </div>
 
173
          </div>
 
174
        </tal:block>
 
175
 
 
176
        <tal:block condition="not:specific_path">
 
177
          <div class="diff"
 
178
               tal:repeat="item file_changes/text_changes" tal:attributes="id string:diff-${item/index}">
 
179
 
 
180
            <div  class="diffBox">
 
181
              <a tal:attributes="href python:url(['/revision', change.revno, item.filename], clear=1);
 
182
                                 id string:${item/filename};
 
183
                                 title string:View changes to ${item/filename} only"
 
184
                 class="the-link">
 
185
                <img tal:attributes="src python:branch.static_url('/static/images/treeCollapsed.png')"
 
186
                     class="expand_diff" />
 
187
                <tal:b content="item/filename" />
 
188
              </a>
 
189
            </div>
 
190
            <div class="diffinfo"  style="display:none">
 
191
              <div class="loading">
 
192
                <img tal:attributes="src python:branch.static_url('/static/images/spinner.gif')" />
 
193
              </div>
 
194
            </div>
 
195
          </div>
 
196
        </tal:block>
 
197
 
 
198
        <ul tal:condition="python:navigation.prev_page_revid or navigation.next_page_revid"
 
199
            id="pages">
 
200
          <li tal:condition="navigation/prev_page_revid"
 
201
              class="previous">
 
202
            <a tal:attributes="href navigation/prev_page_url">&laquo; Newer</a>
 
203
          </li>
 
204
          <!-- FIXME: Leaving this to eventually show page numbers. Can't show all of them,
 
205
               so some magic has to be done to just show the previous and next N page numbers
 
206
 
 
207
               <li class="active">1</li>
 
208
               <tal:block tal:repeat="page_number python:range(navigation.page_count)">
 
209
                 <li><a href="#"
 
210
                        tal:content="page_number"></a></li>
 
211
               </tal:block>-->
 
212
          <li tal:condition="navigation/next_page_revid"
 
213
              class="next">
 
214
            <a tal:attributes="href navigation/next_page_url">Older &raquo;</a>
 
215
          </li>
 
216
        </ul>
 
217
 
309
218
      </div>
310
219
    </body>
311
220
  </html>