Mercurial > kallithea
annotate rhodecode/templates/files/files_source.html @ 2943:c40a7185837a beta
fixed issue with file history for new added files
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 20 Oct 2012 13:48:13 +0200 |
parents | 4c7cc3a4c330 |
children | 37c7abd34d44 |
rev | line source |
---|---|
362
558eb7c5028f
version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents:
278
diff
changeset
|
1 <dl> |
2456
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
2 <dt class="file_history">${_('History')}</dt> |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 <dd> |
2456
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
4 <div> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
5 <div style="float:left"> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
6 ${h.form(h.url('files_diff_home',repo_name=c.repo_name,f_path=c.f_path),method='get')} |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
7 ${h.hidden('diff2',c.file_changeset.raw_id)} |
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
8 ${h.select('diff1',c.file_changeset.raw_id,c.file_history)} |
2456
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
9 ${h.submit('diff',_('diff to revision'),class_="ui-btn")} |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
10 ${h.submit('show_rev',_('show at revision'),class_="ui-btn")} |
2931
4c7cc3a4c330
fixed issue with show at revision button. Some JS were not properly loaded due to ajaxified files view.
Marcin Kuzminski <marcin@python-works.com>
parents:
2930
diff
changeset
|
11 ${h.hidden('annotate', c.annotate)} |
2456
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
12 ${h.end_form()} |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
13 </div> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
14 <div class="file_author"> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
15 <div class="item">${h.literal(ungettext(u'%s author',u'%s authors',len(c.authors)) % ('<b>%s</b>' % len(c.authors))) }</div> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
16 %for email, user in c.authors: |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
17 <div class="contributor tooltip" style="float:left" title="${h.tooltip(user)}"> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
18 <div class="gravatar" style="margin:1px"><img alt="gravatar" src="${h.gravatar_url(email, 20)}"/> </div> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
19 </div> |
2461
015a42e970a6
whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2456
diff
changeset
|
20 %endfor |
2456
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
21 </div> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
22 </div> |
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
23 <div style="clear:both"></div> |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 </dd> |
2456
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
25 |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
26 </dl> |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
27 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 <div id="body" class="codeblock"> |
144
ea89ac73bef8
Update css +file browsing and diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
129
diff
changeset
|
29 <div class="code-header"> |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
30 <div class="stats"> |
2029
14d8cfb96c17
urlify the commit message in file block + small css fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1983
diff
changeset
|
31 <div class="left img"><img src="${h.url('/images/icons/file.png')}"/></div> |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
32 <div class="left item"><pre class="tooltip" title="${h.tooltip(h.fmt_date(c.file_changeset.date))}">${h.link_to("r%s:%s" % (c.file_changeset.revision,h.short_id(c.file_changeset.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id))}</pre></div> |
2029
14d8cfb96c17
urlify the commit message in file block + small css fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1983
diff
changeset
|
33 <div class="left item"><pre>${h.format_byte_size(c.file.size,binary=True)}</pre></div> |
14d8cfb96c17
urlify the commit message in file block + small css fixes
Marcin Kuzminski <marcin@python-works.com>
parents:
1983
diff
changeset
|
34 <div class="left item last"><pre>${c.file.mimetype}</pre></div> |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
35 <div class="buttons"> |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
36 %if c.annotate: |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
37 ${h.link_to(_('show source'), h.url('files_home', repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
38 %else: |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
39 ${h.link_to(_('show annotation'),h.url('files_annotate_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
40 %endif |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
41 ${h.link_to(_('show as raw'),h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} |
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
42 ${h.link_to(_('download as raw'),h.url('files_rawfile_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
43 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
44 % if not c.file.is_binary: |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
45 ${h.link_to(_('edit'),h.url('files_edit_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path),class_="ui-btn")} |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
46 % endif |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
47 % endif |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
48 </div> |
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
49 </div> |
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
50 <div class="author"> |
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
51 <div class="gravatar"> |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
52 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.file_changeset.author),16)}"/> |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
53 </div> |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
54 <div title="${c.file_changeset.author}" class="user">${h.person(c.file_changeset.author)}</div> |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
55 </div> |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
56 <div class="commit">${h.urlify_commit(c.file_changeset.message,c.repo_name)}</div> |
144
ea89ac73bef8
Update css +file browsing and diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
129
diff
changeset
|
57 </div> |
ea89ac73bef8
Update css +file browsing and diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
129
diff
changeset
|
58 <div class="code-body"> |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
59 %if c.file.is_binary: |
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
60 ${_('Binary file (%s)') % c.file.mimetype} |
1043
6ec53c16c744
fixed binary file issues
Marcin Kuzminski <marcin@python-works.com>
parents:
1035
diff
changeset
|
61 %else: |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
62 % if c.file.size < c.cut_off_limit: |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
63 %if c.annotate: |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
64 ${h.pygmentize_annotation(c.repo_name,c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
65 %else: |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
66 ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
67 %endif |
485
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
413
diff
changeset
|
68 %else: |
1472
aaec08ad9daf
Added pt_BR localization, added i18n wrappers on some places missing, fixed css in settings screen for longer labels.
Augusto Herrmann <augusto.herrmann@planejamento.gov.br>
parents:
1322
diff
changeset
|
69 ${_('File is too big to display')} ${h.link_to(_('show as raw'), |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
70 h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path))} |
485
9836541b0509
added limit for showing pygemntized source codes larger than 250kb.
Marcin Kuzminski <marcin@python-works.com>
parents:
413
diff
changeset
|
71 %endif |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
72 %endif |
144
ea89ac73bef8
Update css +file browsing and diffs
Marcin Kuzminski <marcin@python-works.com>
parents:
129
diff
changeset
|
73 </div> |
413
0ebec9b88d13
added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
410
diff
changeset
|
74 </div> |
0ebec9b88d13
added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
410
diff
changeset
|
75 |
0ebec9b88d13
added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
410
diff
changeset
|
76 <script type="text/javascript"> |
1320
09c3fb460fcb
Fixed problem with anchor link positioning when passed in ranges.
Marcin Kuzminski <marcin@python-works.com>
parents:
1313
diff
changeset
|
77 YUE.onDOMReady(function(){ |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
78 function highlight_lines(lines){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
79 for(pos in lines){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
80 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE'); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
81 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
82 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
83 page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L'); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
84 if (page_highlights.length == 2){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
85 highlight_ranges = page_highlights[1].split(","); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
86 |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
87 var h_lines = []; |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
88 for (pos in highlight_ranges){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
89 var _range = highlight_ranges[pos].split('-'); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
90 if(_range.length == 2){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
91 var start = parseInt(_range[0]); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
92 var end = parseInt(_range[1]); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
93 if (start < end){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
94 for(var i=start;i<=end;i++){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
95 h_lines.push(i); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
96 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
97 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
98 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
99 else{ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
100 h_lines.push(parseInt(highlight_ranges[pos])); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
101 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
102 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
103 highlight_lines(h_lines); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
104 |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
105 //remember original location |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
106 var old_hash = location.href.substring(location.href.indexOf('#')); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
107 |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
108 // this makes a jump to anchor moved by 3 posstions for padding |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
109 window.location.hash = '#L'+Math.max(parseInt(h_lines[0])-3,1); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
110 |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
111 //sets old anchor |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
112 window.location.hash = old_hash; |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
113 |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
114 } |
2931
4c7cc3a4c330
fixed issue with show at revision button. Some JS were not properly loaded due to ajaxified files view.
Marcin Kuzminski <marcin@python-works.com>
parents:
2930
diff
changeset
|
115 |
1699
623b228cf325
cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents:
1472
diff
changeset
|
116 YUE.on('hlcode','mouseup',getSelectionLink("${_('Selection link')}")) |
413
0ebec9b88d13
added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
410
diff
changeset
|
117 }); |
1472
aaec08ad9daf
Added pt_BR localization, added i18n wrappers on some places missing, fixed css in settings screen for longer labels.
Augusto Herrmann <augusto.herrmann@planejamento.gov.br>
parents:
1322
diff
changeset
|
118 </script> |