annotate rhodecode/templates/files/files.html @ 4178:9dd726706178 kallithea-2.2.5-rebrand

Complete copyright notices for web interface; change footer to link to them. The original copyright notice found in the footer was not accurate as it included only one of the many copyright holders in this project. This change creates an "about" page, which currently contains just the copyright and license information. It links to repository for additional potential copyright holders not listed on the about page. Unlisted contributors are mentioned in template comments. Html links for Kallithea is fixed and we link to Conservancy. Display of version information in the footer is improved.
author Bradley M. Kuhn <bkuhn@sfconservancy.org>
date Wed, 21 May 2014 13:35:27 -0400
parents ffd45b185016
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
128
9deb6f1d5b90 Implemented file history.
Marcin Kuzminski <marcin@python-works.com>
parents: 106
diff changeset
1 <%inherit file="/base/base.html"/>
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
2
3582
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
3 <%def name="title(*args)">
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
4 ${_('%s Files') % c.repo_name}
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
5 %if hasattr(c,'file'):
3792
63adb3d5233a fixed some unicode problems with git file path
Marcin Kuzminski <marcin@python-works.com>
parents: 3654
diff changeset
6 &middot; ${h.safe_unicode(c.file.path) or '\\'}
3582
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
7 %endif
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
8
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
9 %if c.rhodecode_name:
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
10 &middot; ${c.rhodecode_name}
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
11 %endif
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12 </%def>
362
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
13
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
14 <%def name="breadcrumbs_links()">
3532
9e677f6d34cb Fixing missing icons.
Leonardo <leo@unity3d.com>
parents: 3527
diff changeset
15 ${_('Files')}
1737
61eda8bf70d0 new files views
Marcin Kuzminski <marcin@python-works.com>
parents: 1705
diff changeset
16 %if c.file:
3582
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
17 @ ${h.show_id(c.changeset)}
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
18 %endif
362
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
19 </%def>
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
20
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
21 <%def name="page_nav()">
3603
eacd33e0c5b3 use valid options for the top menu: repositories, journal, search and admin
Mads Kiilerich <madski@unity3d.com>
parents: 3582
diff changeset
22 ${self.menu('repositories')}
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 </%def>
362
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
24
99
5b57295601b6 Updated basic files browser with, pygments
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25 <%def name="main()">
3988
072a37c44f58 templates: drop context_bar, use repo_context_bar directly
Mads Kiilerich <madski@unity3d.com>
parents: 3792
diff changeset
26 ${self.repo_context_bar('files')}
362
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
27 <div class="box">
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
28 <!-- box / title -->
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
29 <div class="title">
644
c8bd0e6cc3da some changes for #45.
Marcin Kuzminski <marcin@python-works.com>
parents: 636
diff changeset
30 ${self.breadcrumbs()}
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
31 <ul class="links">
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
32 <li>
3654
ec6354949623 Fix a lot of casings - use standard casing in most places
Mads Kiilerich <madski@unity3d.com>
parents: 3603
diff changeset
33 <span style="text-transform: uppercase;"><a href="#">${_('Branch')}: ${c.changeset.branch}</a></span>
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
34 </li>
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
35 </ul>
362
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
36 </div>
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
37 <div class="table">
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
38 <div id="files_data">
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
39 <%include file='files_ypjax.html'/>
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
40 </div>
362
558eb7c5028f version bump to 0.8
Marcin Kuzminski <marcin@python-works.com>
parents: 278
diff changeset
41 </div>
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
42 </div>
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
43
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 644
diff changeset
44 <script type="text/javascript">
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
45 var CACHE = {};
3001
37c7abd34d44 implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents: 2977
diff changeset
46 var CACHE_EXPIRE = 5*60*1000; //cache for 5*60s
2687
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
47 //used to construct links from the search list
2891
9812e617c564 fix files quick filter links
Marcin Kuzminski <marcin@python-works.com>
parents: 2867
diff changeset
48 var url_base = '${h.url("files_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}';
2687
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
49 //send the nodelist request to this url
2891
9812e617c564 fix files quick filter links
Marcin Kuzminski <marcin@python-works.com>
parents: 2867
diff changeset
50 var node_list_url = '${h.url("files_nodelist_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}';
3001
37c7abd34d44 implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents: 2977
diff changeset
51 // send the node history requst to this url
37c7abd34d44 implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents: 2977
diff changeset
52 var node_history_url = '${h.url("files_history_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}';
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
53
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
54 ## new pyroutes URLs
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
55 pyroutes.register('files_nodelist_home', "${h.url('files_nodelist_home', repo_name=c.repo_name,revision='%(revision)s',f_path='%(f_path)s')}", ['revision', 'f_path']);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
56 pyroutes.register('files_history_home', "${h.url('files_history_home', repo_name=c.repo_name,revision='%(revision)s',f_path='%(f_path)s')}", ['revision', 'f_path']);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
57 pyroutes.register('files_authors_home', "${h.url('files_authors_home', repo_name=c.repo_name,revision='%(revision)s',f_path='%(f_path)s')}", ['revision', 'f_path']);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
58
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
59 var ypjax_links = function(){
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
60 YUE.on(YUQ('.ypjax-link'), 'click',function(e){
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
61
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
62 //don't do ypjax on middle click
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
63 if(e.which == 2 || !History.enabled){
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
64 return true;
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
65 }
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
66
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
67 var el = e.currentTarget;
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
68 var url = el.href;
2691
e70be4cf96e8 fixed issues with non-ascii chars in new file browser
Marcin Kuzminski <marcin@python-works.com>
parents: 2687
diff changeset
69
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
70 var _base_url = '${h.url("files_home",repo_name=c.repo_name,revision='',f_path='')}';
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
71 _base_url = _base_url.replace('//','/')
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
72
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
73 //extract rev and the f_path from url.
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
74 parts = url.split(_base_url)
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
75 if(parts.length != 2){
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
76 return false;
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
77 }
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
78
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
79 var parts2 = parts[1].split('/');
3582
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
80 var rev = parts2.shift(); // pop the first element which is the revision
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
81 var f_path = parts2.join('/');
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
82
3582
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
83 //page title make this consistent with title() mako function on top
1f334a68d057 improved title consistency
Marcin Kuzminski <marcin@python-works.com>
parents: 3552
diff changeset
84 var title = "${_('%s Files') % c.repo_name}" + " &middot; " + (f_path || '\\') + " &middot; " + "${c.rhodecode_name}";
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
85
2891
9812e617c564 fix files quick filter links
Marcin Kuzminski <marcin@python-works.com>
parents: 2867
diff changeset
86 var _node_list_url = node_list_url.replace('__REV__',rev).replace('__FPATH__', f_path);
9812e617c564 fix files quick filter links
Marcin Kuzminski <marcin@python-works.com>
parents: 2867
diff changeset
87 var _url_base = url_base.replace('__REV__',rev);
2691
e70be4cf96e8 fixed issues with non-ascii chars in new file browser
Marcin Kuzminski <marcin@python-works.com>
parents: 2687
diff changeset
88
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
89 // Change our States and save some data for handling events
2687
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
90 var data = {url:url,title:title, url_base:_url_base,
3001
37c7abd34d44 implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents: 2977
diff changeset
91 node_list_url:_node_list_url, rev:rev, f_path:f_path};
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
92 History.pushState(data, title, url);
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
93
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
94 //now we're sure that we can do ypjax things
2977
cff9d4e1d821 Fixed issue when node didn't exists at 'tip' and we tried calculate history based on that assumption.
Marcin Kuzminski <marcin@python-works.com>
parents: 2891
diff changeset
95 YUE.preventDefault(e);
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
96 return false;
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
97 });
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
98 }
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
99
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
100 // callbacks needed to process the pjax filebrowser
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
101 var callbacks = function(State){
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
102 ypjax_links();
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
103 tooltip_activate();
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
104
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
105 if(State !== undefined){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
106 //inistially loaded stuff
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
107 var _f_path = State.data.f_path;
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
108 var _rev = State.data.rev;
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
109
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
110 fileBrowserListeners(State.url, State.data.node_list_url, State.data.url_base);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
111 // Inform Google Analytics of the change
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
112 if ( typeof window.pageTracker !== 'undefined' ) {
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
113 window.pageTracker._trackPageview(State.url);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
114 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
115 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
117 function highlight_lines(lines){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
118 for(pos in lines){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
119 YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE');
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
120 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
121 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
122 page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L');
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
123 if (page_highlights.length == 2){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
124 highlight_ranges = page_highlights[1].split(",");
3029
685ebc84c2e9 White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 3003
diff changeset
125
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
126 var h_lines = [];
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
127 for (pos in highlight_ranges){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
128 var _range = highlight_ranges[pos].split('-');
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
129 if(_range.length == 2){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
130 var start = parseInt(_range[0]);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
131 var end = parseInt(_range[1]);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
132 if (start < end){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
133 for(var i=start;i<=end;i++){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
134 h_lines.push(i);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
135 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
136 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
137 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
138 else{
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
139 h_lines.push(parseInt(highlight_ranges[pos]));
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
140 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
141 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
142 highlight_lines(h_lines);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
143 var _first_line= YUD.get('L'+h_lines[0]);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
144 if(_first_line){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
145 _first_line.scrollIntoView()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
146 }
3001
37c7abd34d44 implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents: 2977
diff changeset
147 }
4116
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
148
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
149 // select code link event
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
150 YUE.on('hlcode', 'mouseup', getSelectionLink);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
151
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
152 // history select field
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
153 var cache = {}
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
154 $("#diff1").select2({
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
155 placeholder: _TM['Select changeset'],
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
156 dropdownAutoWidth: true,
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
157 query: function(query){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
158 var key = 'cache';
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
159 var cached = cache[key] ;
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
160 if(cached) {
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
161 var data = {results: []};
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
162 //filter results
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
163 $.each(cached.results, function(){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
164 var section = this.text;
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
165 var children = [];
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
166 $.each(this.children, function(){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
167 if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
168 children.push({'id': this.id, 'text': this.text})
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
169 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
170 })
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
171 data.results.push({'text': section, 'children': children})
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
172 });
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
173 query.callback(data);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
174 }else{
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
175 $.ajax({
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
176 url: pyroutes.url('files_history_home', {'revision': _rev, 'f_path': _f_path}),
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
177 data: {},
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
178 dataType: 'json',
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
179 type: 'GET',
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
180 success: function(data) {
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
181 cache[key] = data;
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
182 query.callback({results: data.results});
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
183 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
184 })
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
185 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
186 },
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
187 });
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
188 $('#show_authors').on('click', function(){
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
189 $.ajax({
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
190 url: pyroutes.url('files_authors_home', {'revision': _rev, 'f_path': _f_path}),
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
191 success: function(data) {
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
192 $('#file_authors').html(data);
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
193 $('#file_authors').show();
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
194 tooltip_activate()
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
195 }
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
196 })
ffd45b185016 Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3988
diff changeset
197 })
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
198 }
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
199
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
200 YUE.onDOMReady(function(){
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
201 ypjax_links();
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
202 var container = 'files_data';
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
203 //Bind to StateChange Event
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
204 History.Adapter.bind(window,'statechange',function(){
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
205 var State = History.getState();
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
206 cache_key = State.url;
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
207 //check if we have this request in cache maybe ?
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
208 var _cache_obj = CACHE[cache_key];
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
209 var _cur_time = new Date().getTime();
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
210 // get from cache if it's there and not yet expired !
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
211 if(_cache_obj !== undefined && _cache_obj[0] > _cur_time){
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
212 YUD.get(container).innerHTML=_cache_obj[1];
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
213 YUD.setStyle(container,'opacity','1.0');
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
214
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
215 //callbacks after ypjax call
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
216 callbacks(State);
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
217 }
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
218 else{
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
219 ypjax(State.url,container,function(o){
3197
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
220 //callbacks after ypjax call
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
221 callbacks(State);
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
222 if (o !== undefined){
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
223 //store our request in cache
b4f401524060 html: don't use tabs
Mads Kiilerich <madski@unity3d.com>
parents: 3029
diff changeset
224 var _expire_on = new Date().getTime()+CACHE_EXPIRE;
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
225 CACHE[cache_key] = [_expire_on, o.responseText];
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
226 }
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
227 });
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
228 }
2815
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
229 });
acc05c33cc0c White space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2691
diff changeset
230
2687
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
231 // init the search filter
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
232 var _State = {
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
233 url: "${h.url.current()}",
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
234 data: {
2891
9812e617c564 fix files quick filter links
Marcin Kuzminski <marcin@python-works.com>
parents: 2867
diff changeset
235 node_list_url: node_list_url.replace('__REV__',"${c.changeset.raw_id}").replace('__FPATH__', "${h.safe_unicode(c.file.path)}"),
3001
37c7abd34d44 implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents: 2977
diff changeset
236 url_base: url_base.replace('__REV__',"${c.changeset.raw_id}"),
37c7abd34d44 implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents: 2977
diff changeset
237 rev:"${c.changeset.raw_id}",
37c7abd34d44 implements #636, lazy loading of history and authors to speed up page responsiveness.
Marcin Kuzminski <marcin@python-works.com>
parents: 2977
diff changeset
238 f_path: "${h.safe_unicode(c.file.path)}"
2687
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
239 }
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
240 }
4d7dfda32d10 Disable the html4 history mock for old browsers.
Marcin Kuzminski <marcin@python-works.com>
parents: 2686
diff changeset
241 fileBrowserListeners(_State.url, _State.data.node_list_url, _State.data.url_base);
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
242 });
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
243
1699
623b228cf325 cleaned up JS files in files templates.
Marcin Kuzminski <marcin@python-works.com>
parents: 644
diff changeset
244 </script>
2686
269c6e0b54cc Reimplemented file-browser using partial-ajax
Marcin Kuzminski <marcin@python-works.com>
parents: 2492
diff changeset
245
1888
f91d3f9b7230 White-space cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 1749
diff changeset
246 </%def>