comparison rhodecode/templates/compare/compare_diff.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 8d1125a40973
comparison
equal deleted inserted replaced
4115:8b7294a804a0 4116:ffd45b185016
1 ## -*- coding: utf-8 -*- 1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.html"/> 2 <%inherit file="/base/base.html"/>
3 3
4 <%def name="title()"> 4 <%def name="title()">
5 ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.org_repo.repo_name, c.org_ref)} -&gt; ${'%s@%s' % (c.other_repo.repo_name, c.other_ref)} &middot; ${c.rhodecode_name} 5 %if c.compare_home:
6 ${_('%s Compare') % c.repo_name}
7 %else:
8 ${_('%s Compare') % c.repo_name} - ${'%s@%s' % (c.org_repo.repo_name, c.org_ref)} &gt; ${'%s@%s' % (c.other_repo.repo_name, c.other_ref)}
9 %endif
10 %if c.rhodecode_name:
11 &middot; ${c.rhodecode_name}
12 %endif
6 </%def> 13 </%def>
7 14
8 <%def name="breadcrumbs_links()"> 15 <%def name="breadcrumbs_links()">
9 ${_('Compare revisions')} 16 ${_('Compare revisions')}
10 </%def> 17 </%def>
20 <div class="title"> 27 <div class="title">
21 ${self.breadcrumbs()} 28 ${self.breadcrumbs()}
22 </div> 29 </div>
23 <div class="table"> 30 <div class="table">
24 <div id="body" class="diffblock"> 31 <div id="body" class="diffblock">
25 <div class="code-header"> 32 <div class="code-header" style="height: 26px">
26 <div> 33 <div>
27 ${'%s@%s' % (c.org_repo.repo_name, c.org_ref)} -&gt; ${'%s@%s' % (c.other_repo.repo_name, c.other_ref)} <a href="${c.swap_url}">[swap]</a> 34 ${h.hidden('compare_org')} <i class="icon-ellipsis-horizontal" style="color: #999; vertical-align: -12px; padding: 0px 0px 0px 2px"></i> ${h.hidden('compare_other')}
35 %if not c.compare_home:
36 <a class="btn btn-small" href="${c.swap_url}"><i class="icon-refresh"></i> ${_('Swap')}</a>
37 %endif
38 <div id="compare_revs" class="btn btn-small"><i class="icon-loop"></i> ${_('Compare Revisions')}</div>
28 </div> 39 </div>
29 </div> 40 </div>
30 </div> 41 </div>
42
43 %if c.compare_home:
31 <div id="changeset_compare_view_content"> 44 <div id="changeset_compare_view_content">
32 ##CS 45 <div style="color:#999;font-size: 18px">${_('Compare revisions, branches, bookmarks or tags.')}</div>
33 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${ungettext('Showing %s commit','Showing %s commits', len(c.cs_ranges)) % len(c.cs_ranges)}</div> 46 </div>
34 <%include file="compare_cs.html" /> 47 %else:
48 <div id="changeset_compare_view_content">
49 ##CS
50 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${ungettext('Showing %s commit','Showing %s commits', len(c.cs_ranges)) % len(c.cs_ranges)}</div>
51 <%include file="compare_cs.html" />
35 52
36 ## FILES 53 ## FILES
37 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px"> 54 <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">
38 55
39 % if c.limited_diff: 56 % if c.limited_diff:
40 ${ungettext('%s file changed', '%s files changed', len(c.files)) % len(c.files)} 57 ${ungettext('%s file changed', '%s files changed', len(c.files)) % len(c.files)}
41 % else: 58 % else:
42 ${ungettext('%s file changed with %s insertions and %s deletions','%s files changed with %s insertions and %s deletions', len(c.files)) % (len(c.files),c.lines_added,c.lines_deleted)}: 59 ${ungettext('%s file changed with %s insertions and %s deletions','%s files changed with %s insertions and %s deletions', len(c.files)) % (len(c.files),c.lines_added,c.lines_deleted)}:
43 %endif 60 %endif
44 61
45 </div> 62 </div>
46 <div class="cs_files"> 63 <div class="cs_files">
47 %if not c.files: 64 %if not c.files:
48 <span class="empty_data">${_('No files')}</span> 65 <span class="empty_data">${_('No files')}</span>
49 %endif 66 %endif
50 %for fid, change, f, stat in c.files: 67 %for fid, change, f, stat in c.files:
51 <div class="cs_${change}"> 68 <div class="cs_${change}">
52 <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid, **request.GET.mixed()))}</div> 69 <div class="node">${h.link_to(h.safe_unicode(f),h.url.current(anchor=fid, **request.GET.mixed()))}</div>
53 <div class="changes">${h.fancy_file_stats(stat)}</div> 70 <div class="changes">${h.fancy_file_stats(stat)}</div>
54 </div> 71 </div>
55 %endfor 72 %endfor
56 </div> 73 </div>
57 % if c.limited_diff: 74 % if c.limited_diff:
58 <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff')}</a></h5> 75 <h5>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff')}</a></h5>
59 % endif 76 % endif
60 </div> 77 </div>
78
79 ## diff block
80 <%namespace name="diff_block" file="/changeset/diff_block.html"/>
81 %for fid, change, f, stat in c.files:
82 ${diff_block.diff_block_simple([c.changes[fid]])}
83 %endfor
84 % if c.limited_diff:
85 <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff')}</a></h4>
86 % endif
87 %endif
61 </div> 88 </div>
62 89
63 ## diff block 90 </div>
64 <%namespace name="diff_block" file="/changeset/diff_block.html"/> 91 <script type="text/javascript">
65 %for fid, change, f, stat in c.files:
66 ${diff_block.diff_block_simple([c.changes[fid]])}
67 %endfor
68 % if c.limited_diff:
69 <h4>${_('Changeset was too big and was cut off...')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}">${_('Show full diff')}</a></h4>
70 % endif
71 <script type="text/javascript">
72 92
73 YUE.onDOMReady(function(){ 93 $(document).ready(function(){
94 var cache = {}
95 $("#compare_org").select2({
96 placeholder: "${'%s@%s' % (c.org_repo.repo_name, c.org_ref)}",
97 formatSelection: function(obj){
98 return '{0}@{1}'.format("${c.org_repo.repo_name}", obj.text)
99 },
100 dropdownAutoWidth: true,
101 query: function(query){
102 var key = 'cache';
103 var cached = cache[key] ;
104 if(cached) {
105 var data = {results: []};
106 //filter results
107 $.each(cached.results, function(){
108 var section = this.text;
109 var children = [];
110 $.each(this.children, function(){
111 if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
112 children.push({'id': this.id, 'text': this.text})
113 }
114 })
115 data.results.push({'text': section, 'children': children})
116 });
117 //push the typed in changeset
118 data.results.push({'text':_TM['specify changeset'],
119 'children': [{'id': query.term, 'text': query.term, 'type': 'rev'}]})
120 query.callback(data);
121 }else{
122 $.ajax({
123 url: pyroutes.url('repo_refs_data', {'repo_name': '${c.org_repo.repo_name}'}),
124 data: {},
125 dataType: 'json',
126 type: 'GET',
127 success: function(data) {
128 cache[key] = data;
129 query.callback({results: data.results});
130 }
131 })
132 }
133 },
134 });
135 $("#compare_other").select2({
136 placeholder: "${'%s@%s' % (c.other_repo.repo_name, c.other_ref)}",
137 dropdownAutoWidth: true,
138 formatSelection: function(obj){
139 return '{0}@{1}'.format("${c.other_repo.repo_name}", obj.text)
140 },
141 query: function(query){
142 var key = 'cache2';
143 var cached = cache[key] ;
144 if(cached) {
145 var data = {results: []};
146 //filter results
147 $.each(cached.results, function(){
148 var section = this.text;
149 var children = [];
150 $.each(this.children, function(){
151 if(query.term.length == 0 || this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ){
152 children.push({'id': this.id, 'text': this.text})
153 }
154 })
155 data.results.push({'text': section, 'children': children})
156 });
157 //push the typed in changeset
158 data.results.push({'text':_TM['specify changeset'],
159 'children': [{'id': query.term, 'text': query.term, 'type': 'rev'}]})
160 query.callback(data);
161 }else{
162 $.ajax({
163 url: pyroutes.url('repo_refs_data', {'repo_name': '${c.other_repo.repo_name}'}),
164 data: {},
165 dataType: 'json',
166 type: 'GET',
167 success: function(data) {
168 cache[key] = data;
169 query.callback({results: data.results});
170 }
171 })
172 }
173 },
174 });
74 175
75 YUE.on(YUQ('.diff-menu-activate'),'click',function(e){ 176 $('#compare_revs').on('click', function(e){
76 var act = e.currentTarget.nextElementSibling; 177 var org = $('#compare_org').select2('data');
178 var other = $('#compare_other').select2('data');
77 179
78 if(YUD.hasClass(act,'active')){ 180 var compare_url = "${h.url('compare_url',repo_name=c.repo_name,org_ref_type='__other_ref_type__',org_ref='__org__',other_ref_type='__org_ref_type__',other_ref='__other__', other_repo=c.other_repo.repo_name)}";
79 YUD.removeClass(act,'active'); 181 var u = compare_url.replace('__other_ref_type__',org.type)
80 YUD.setStyle(act,'display','none'); 182 .replace('__org__',org.text)
81 }else{ 183 .replace('__org_ref_type__',other.type)
82 YUD.addClass(act,'active'); 184 .replace('__other__',other.text);
83 YUD.setStyle(act,'display',''); 185 window.location=u;
84 } 186 })
85 }); 187 });
86 })
87 </script> 188 </script>
88 </div>
89 </%def> 189 </%def>