Mercurial > kallithea
view rhodecode/templates/files/files.html @ 4116:ffd45b185016 rhodecode-2.2.5-gpl
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:03:13 -0400 |
parents | 072a37c44f58 |
children |
line wrap: on
line source
<%inherit file="/base/base.html"/> <%def name="title(*args)"> ${_('%s Files') % c.repo_name} %if hasattr(c,'file'): · ${h.safe_unicode(c.file.path) or '\\'} %endif %if c.rhodecode_name: · ${c.rhodecode_name} %endif </%def> <%def name="breadcrumbs_links()"> ${_('Files')} %if c.file: @ ${h.show_id(c.changeset)} %endif </%def> <%def name="page_nav()"> ${self.menu('repositories')} </%def> <%def name="main()"> ${self.repo_context_bar('files')} <div class="box"> <!-- box / title --> <div class="title"> ${self.breadcrumbs()} <ul class="links"> <li> <span style="text-transform: uppercase;"><a href="#">${_('Branch')}: ${c.changeset.branch}</a></span> </li> </ul> </div> <div class="table"> <div id="files_data"> <%include file='files_ypjax.html'/> </div> </div> </div> <script type="text/javascript"> var CACHE = {}; var CACHE_EXPIRE = 5*60*1000; //cache for 5*60s //used to construct links from the search list var url_base = '${h.url("files_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}'; //send the nodelist request to this url var node_list_url = '${h.url("files_nodelist_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}'; // send the node history requst to this url var node_history_url = '${h.url("files_history_home",repo_name=c.repo_name,revision='__REV__',f_path='__FPATH__')}'; ## new pyroutes URLs 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']); 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']); 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']); var ypjax_links = function(){ YUE.on(YUQ('.ypjax-link'), 'click',function(e){ //don't do ypjax on middle click if(e.which == 2 || !History.enabled){ return true; } var el = e.currentTarget; var url = el.href; var _base_url = '${h.url("files_home",repo_name=c.repo_name,revision='',f_path='')}'; _base_url = _base_url.replace('//','/') //extract rev and the f_path from url. parts = url.split(_base_url) if(parts.length != 2){ return false; } var parts2 = parts[1].split('/'); var rev = parts2.shift(); // pop the first element which is the revision var f_path = parts2.join('/'); //page title make this consistent with title() mako function on top var title = "${_('%s Files') % c.repo_name}" + " · " + (f_path || '\\') + " · " + "${c.rhodecode_name}"; var _node_list_url = node_list_url.replace('__REV__',rev).replace('__FPATH__', f_path); var _url_base = url_base.replace('__REV__',rev); // Change our States and save some data for handling events var data = {url:url,title:title, url_base:_url_base, node_list_url:_node_list_url, rev:rev, f_path:f_path}; History.pushState(data, title, url); //now we're sure that we can do ypjax things YUE.preventDefault(e); return false; }); } // callbacks needed to process the pjax filebrowser var callbacks = function(State){ ypjax_links(); tooltip_activate(); if(State !== undefined){ //inistially loaded stuff var _f_path = State.data.f_path; var _rev = State.data.rev; fileBrowserListeners(State.url, State.data.node_list_url, State.data.url_base); // Inform Google Analytics of the change if ( typeof window.pageTracker !== 'undefined' ) { window.pageTracker._trackPageview(State.url); } } function highlight_lines(lines){ for(pos in lines){ YUD.setStyle('L'+lines[pos],'background-color','#FFFFBE'); } } page_highlights = location.href.substring(location.href.indexOf('#')+1).split('L'); if (page_highlights.length == 2){ highlight_ranges = page_highlights[1].split(","); var h_lines = []; for (pos in highlight_ranges){ var _range = highlight_ranges[pos].split('-'); if(_range.length == 2){ var start = parseInt(_range[0]); var end = parseInt(_range[1]); if (start < end){ for(var i=start;i<=end;i++){ h_lines.push(i); } } } else{ h_lines.push(parseInt(highlight_ranges[pos])); } } highlight_lines(h_lines); var _first_line= YUD.get('L'+h_lines[0]); if(_first_line){ _first_line.scrollIntoView() } } // select code link event YUE.on('hlcode', 'mouseup', getSelectionLink); // history select field var cache = {} $("#diff1").select2({ placeholder: _TM['Select changeset'], dropdownAutoWidth: true, query: function(query){ var key = 'cache'; var cached = cache[key] ; if(cached) { var data = {results: []}; //filter results $.each(cached.results, function(){ var section = this.text; var children = []; $.each(this.children, function(){ if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){ children.push({'id': this.id, 'text': this.text}) } }) data.results.push({'text': section, 'children': children}) }); query.callback(data); }else{ $.ajax({ url: pyroutes.url('files_history_home', {'revision': _rev, 'f_path': _f_path}), data: {}, dataType: 'json', type: 'GET', success: function(data) { cache[key] = data; query.callback({results: data.results}); } }) } }, }); $('#show_authors').on('click', function(){ $.ajax({ url: pyroutes.url('files_authors_home', {'revision': _rev, 'f_path': _f_path}), success: function(data) { $('#file_authors').html(data); $('#file_authors').show(); tooltip_activate() } }) }) } YUE.onDOMReady(function(){ ypjax_links(); var container = 'files_data'; //Bind to StateChange Event History.Adapter.bind(window,'statechange',function(){ var State = History.getState(); cache_key = State.url; //check if we have this request in cache maybe ? var _cache_obj = CACHE[cache_key]; var _cur_time = new Date().getTime(); // get from cache if it's there and not yet expired ! if(_cache_obj !== undefined && _cache_obj[0] > _cur_time){ YUD.get(container).innerHTML=_cache_obj[1]; YUD.setStyle(container,'opacity','1.0'); //callbacks after ypjax call callbacks(State); } else{ ypjax(State.url,container,function(o){ //callbacks after ypjax call callbacks(State); if (o !== undefined){ //store our request in cache var _expire_on = new Date().getTime()+CACHE_EXPIRE; CACHE[cache_key] = [_expire_on, o.responseText]; } }); } }); // init the search filter var _State = { url: "${h.url.current()}", data: { node_list_url: node_list_url.replace('__REV__',"${c.changeset.raw_id}").replace('__FPATH__', "${h.safe_unicode(c.file.path)}"), url_base: url_base.replace('__REV__',"${c.changeset.raw_id}"), rev:"${c.changeset.raw_id}", f_path: "${h.safe_unicode(c.file.path)}" } } fileBrowserListeners(_State.url, _State.data.node_list_url, _State.data.url_base); }); </script> </%def>