Mercurial > kallithea
annotate rhodecode/templates/files/files_source.html @ 3988:072a37c44f58
templates: drop context_bar, use repo_context_bar directly
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 12 Jun 2013 01:36:35 +0200 |
parents | 3563bb7b4b82 |
children | ffd45b185016 |
rev | line source |
---|---|
3001
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
1 <div id="node_history"> |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
2 %if c.load_full_history: |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
3 <%include file='files_history_box.html'/> |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
4 %else: |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
5 <div style="padding-bottom:10px"> |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
6 <span id="load_node_history" class="ui-btn">${_('Load file history')}</span> |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
7 </div> |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
8 %endif |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
9 </div> |
2456
51b203e44202
Add authors into file view
Marcin Kuzminski <marcin@python-works.com>
parents:
2455
diff
changeset
|
10 |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
11 |
128
9deb6f1d5b90
Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 <div id="body" class="codeblock"> |
3197 | 13 <div class="code-header"> |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
14 <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
|
15 <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
|
16 <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
|
17 <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
|
18 <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
|
19 <div class="buttons"> |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
20 %if c.annotate: |
3654
ec6354949623
Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents:
3625
diff
changeset
|
21 ${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
|
22 %else: |
3654
ec6354949623
Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents:
3625
diff
changeset
|
23 ${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
|
24 %endif |
3654
ec6354949623
Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents:
3625
diff
changeset
|
25 ${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")} |
ec6354949623
Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents:
3625
diff
changeset
|
26 ${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
|
27 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name): |
3625
260a7a01b054
follow Python conventions for boolean values
Mads Kiilerich <madski@unity3d.com>
parents:
3453
diff
changeset
|
28 % if c.on_branch_head and c.changeset.branch and not c.file.is_binary: |
3654
ec6354949623
Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents:
3625
diff
changeset
|
29 ${h.link_to(_('Edit on branch:%s') % c.changeset.branch,h.url('files_edit_home',repo_name=c.repo_name,revision=c.changeset.branch,f_path=c.f_path),class_="ui-btn")} |
3237
f5dd76e2a7af
disable file editing when not on branch head fixes issue #462
Marcin Kuzminski <marcin@python-works.com>
parents:
3197
diff
changeset
|
30 %else: |
3654
ec6354949623
Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents:
3625
diff
changeset
|
31 ${h.link_to(_('Edit on branch:?'), '#', class_="ui-btn disabled tooltip", title=_('Editing files allowed only when on branch head revision'))} |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
32 % endif |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
33 % endif |
1737
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
34 </div> |
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
35 </div> |
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
36 <div class="author"> |
61eda8bf70d0
new files views
Marcin Kuzminski <marcin@python-works.com>
parents:
1699
diff
changeset
|
37 <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
|
38 <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
|
39 </div> |
2930
a01c5994015c
smarter calculation of showed associated changeset in file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2732
diff
changeset
|
40 <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
|
41 </div> |
3197 | 42 <div class="commit">${h.urlify_commit(c.file_changeset.message,c.repo_name)}</div> |
43 </div> | |
44 <div class="code-body"> | |
45 %if c.file.is_binary: | |
46 ${_('Binary file (%s)') % c.file.mimetype} | |
47 %else: | |
48 % 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
|
49 %if c.annotate: |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
50 ${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
|
51 %else: |
3197 | 52 ${h.pygmentize(c.file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")} |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
53 %endif |
3197 | 54 %else: |
3654
ec6354949623
Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents:
3625
diff
changeset
|
55 ${_('File is too big to display')} ${h.link_to(_('Show as raw'), |
3197 | 56 h.url('files_raw_home',repo_name=c.repo_name,revision=c.file_changeset.raw_id,f_path=c.f_path))} |
57 %endif | |
1888
f91d3f9b7230
White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
1789
diff
changeset
|
58 %endif |
3197 | 59 </div> |
413
0ebec9b88d13
added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
410
diff
changeset
|
60 </div> |
0ebec9b88d13
added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
410
diff
changeset
|
61 |
0ebec9b88d13
added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
410
diff
changeset
|
62 <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
|
63 YUE.onDOMReady(function(){ |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
64 function highlight_lines(lines){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
65 for(pos in lines){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
66 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
|
67 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
68 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
69 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
|
70 if (page_highlights.length == 2){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
71 highlight_ranges = page_highlights[1].split(","); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
72 |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
73 var h_lines = []; |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
74 for (pos in highlight_ranges){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
75 var _range = highlight_ranges[pos].split('-'); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
76 if(_range.length == 2){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
77 var start = parseInt(_range[0]); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
78 var end = parseInt(_range[1]); |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
79 if (start < end){ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
80 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
|
81 h_lines.push(i); |
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 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
84 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
85 else{ |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
86 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
|
87 } |
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
88 } |
3453 | 89 highlight_lines(h_lines); |
90 var _first_line= YUD.get('L'+h_lines[0]); | |
91 if(_first_line){ | |
92 _first_line.scrollIntoView() | |
93 } | |
2177
ee07357d9265
unified annotation view with file source view
Marcin Kuzminski <marcin@python-works.com>
parents:
2084
diff
changeset
|
94 } |
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
|
95 |
3001
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
96 // select code link event |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
97 YUE.on('hlcode', 'mouseup', getSelectionLink); |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
98 |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
99 //load history of file |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
100 YUE.on('load_node_history', 'click', function(e){ |
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
101 var _url = node_history_url.replace('__REV__','${c.file_changeset.raw_id}').replace('__FPATH__', '${c.f_path}'); |
3003
adf8ee7b8f2a
fire tooltips after loading the history
Marcin Kuzminski <marcin@python-works.com>
parents:
3001
diff
changeset
|
102 ypjax(_url, 'node_history', function(o){ |
3197 | 103 tooltip_activate(); |
3003
adf8ee7b8f2a
fire tooltips after loading the history
Marcin Kuzminski <marcin@python-works.com>
parents:
3001
diff
changeset
|
104 }) |
3029
685ebc84c2e9
White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
3003
diff
changeset
|
105 }); |
3001
37c7abd34d44
implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents:
2931
diff
changeset
|
106 |
413
0ebec9b88d13
added jump to revision from file history.
Marcin Kuzminski <marcin@python-works.com>
parents:
410
diff
changeset
|
107 }); |
3029
685ebc84c2e9
White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
3003
diff
changeset
|
108 |
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
|
109 </script> |