##// END OF EJS Templates
clipboard: added dummy placeholders for copying commits/paths via clipboard.js
marcink -
r1935:51b8a8f9 default
parent child Browse files
Show More
@@ -1,121 +1,122 b''
1 @font-face {
1 @font-face {
2 font-family: 'rcicons';
2 font-family: 'rcicons';
3 src: url('../fonts/RCIcons/rcicons.eot?88634534');
3 src: url('../fonts/RCIcons/rcicons.eot?88634534');
4 src: url('../fonts/RCIcons/rcicons.eot?88634534#iefix') format('embedded-opentype'),
4 src: url('../fonts/RCIcons/rcicons.eot?88634534#iefix') format('embedded-opentype'),
5 url('../fonts/RCIcons/rcicons.woff2?88634534') format('woff2'),
5 url('../fonts/RCIcons/rcicons.woff2?88634534') format('woff2'),
6 url('../fonts/RCIcons/rcicons.woff?88634534') format('woff'),
6 url('../fonts/RCIcons/rcicons.woff?88634534') format('woff'),
7 url('../fonts/RCIcons/rcicons.ttf?88634534') format('truetype'),
7 url('../fonts/RCIcons/rcicons.ttf?88634534') format('truetype'),
8 url('../fonts/RCIcons/rcicons.svg?88634534#rcicons') format('svg');
8 url('../fonts/RCIcons/rcicons.svg?88634534#rcicons') format('svg');
9 font-weight: normal;
9 font-weight: normal;
10 font-style: normal;
10 font-style: normal;
11 }
11 }
12 /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
12 /* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
13 /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
13 /* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
14 /*
14 /*
15 @media screen and (-webkit-min-device-pixel-ratio:0) {
15 @media screen and (-webkit-min-device-pixel-ratio:0) {
16 @font-face {
16 @font-face {
17 font-family: 'rcicons';
17 font-family: 'rcicons';
18 src: url('../fonts/RCIcons/rcicons.svg?88634534#rcicons') format('svg');
18 src: url('../fonts/RCIcons/rcicons.svg?88634534#rcicons') format('svg');
19 }
19 }
20 }
20 }
21 */
21 */
22
22
23 [class^="icon-"]:before, [class*=" icon-"]:before {
23 [class^="icon-"]:before, [class*=" icon-"]:before {
24 font-family: "rcicons";
24 font-family: "rcicons";
25 font-style: normal;
25 font-style: normal;
26 font-weight: normal;
26 font-weight: normal;
27 speak: none;
27 speak: none;
28
28
29 display: inline-block;
29 display: inline-block;
30 text-decoration: inherit;
30 text-decoration: inherit;
31 width: 1em;
31 width: 1em;
32 margin-right: .2em;
32 margin-right: .2em;
33 text-align: center;
33 text-align: center;
34 /* opacity: .8; */
34 /* opacity: .8; */
35
35
36 /* For safety - reset parent styles, that can break glyph codes*/
36 /* For safety - reset parent styles, that can break glyph codes*/
37 font-variant: normal;
37 font-variant: normal;
38 text-transform: none;
38 text-transform: none;
39
39
40 /* fix buttons height, for twitter bootstrap */
40 /* fix buttons height, for twitter bootstrap */
41 line-height: 1em;
41 line-height: 1em;
42
42
43 /* Animation center compensation - margins should be symmetric */
43 /* Animation center compensation - margins should be symmetric */
44 /* remove if not needed */
44 /* remove if not needed */
45 margin-left: .2em;
45 margin-left: .2em;
46
46
47 /* you can be more comfortable with increased icons size */
47 /* you can be more comfortable with increased icons size */
48 /* font-size: 120%; */
48 /* font-size: 120%; */
49
49
50 /* Font smoothing. That was taken from TWBS */
50 /* Font smoothing. That was taken from TWBS */
51 -webkit-font-smoothing: antialiased;
51 -webkit-font-smoothing: antialiased;
52 -moz-osx-font-smoothing: grayscale;
52 -moz-osx-font-smoothing: grayscale;
53
53
54 /* Uncomment for 3D effect */
54 /* Uncomment for 3D effect */
55 /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
55 /* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
56 }
56 }
57
57
58
58
59 .icon-git:before { content: '\e82a'; } /* '' */
59 .icon-git:before { content: '\e82a'; } /* '' */
60 .icon-hg:before { content: '\e82d'; } /* '' */
60 .icon-hg:before { content: '\e82d'; } /* '' */
61 .icon-svn:before { content: '\e82e'; } /* '' */
61 .icon-svn:before { content: '\e82e'; } /* '' */
62 .icon-plus:before { content: '\e813'; } /* '' */
62 .icon-plus:before { content: '\e813'; } /* '' */
63 .icon-clipboard:before { content: '\e813'; } /* '' */
63 .icon-minus:before { content: '\e814'; } /* '' */
64 .icon-minus:before { content: '\e814'; } /* '' */
64 .icon-remove:before { content: '\e815'; } /* '' */
65 .icon-remove:before { content: '\e815'; } /* '' */
65 .icon-bookmark:before { content: '\e803'; } /* '' */
66 .icon-bookmark:before { content: '\e803'; } /* '' */
66 .icon-branch:before { content: '\e804'; } /* '' */
67 .icon-branch:before { content: '\e804'; } /* '' */
67 .icon-merge:before { content: '\e833'; } /* '' */
68 .icon-merge:before { content: '\e833'; } /* '' */
68 .icon-tag:before { content: '\e805'; } /* '' */
69 .icon-tag:before { content: '\e805'; } /* '' */
69 .icon-lock:before { content: '\e806'; } /* '' */
70 .icon-lock:before { content: '\e806'; } /* '' */
70 .icon-unlock:before { content: '\e807'; } /* '' */
71 .icon-unlock:before { content: '\e807'; } /* '' */
71 .icon-delete:before,
72 .icon-delete:before,
72 .icon-false:before { content: '\e800'; } /* '' */
73 .icon-false:before { content: '\e800'; } /* '' */
73 .icon-ok:before,
74 .icon-ok:before,
74 .icon-true:before { content: '\e801'; } /* '' */
75 .icon-true:before { content: '\e801'; } /* '' */
75 .icon-feed:before { content: '\e808'; } /* '' */
76 .icon-feed:before { content: '\e808'; } /* '' */
76 .icon-left:before { content: '\e809'; } /* '' */
77 .icon-left:before { content: '\e809'; } /* '' */
77 .icon-right:before { content: '\e80a'; } /* '' */
78 .icon-right:before { content: '\e80a'; } /* '' */
78 .icon-arrow_down:before { content: '\e80b'; } /* '' */
79 .icon-arrow_down:before { content: '\e80b'; } /* '' */
79 .icon-arrow_up:before { content: '\e832'; } /* '' */
80 .icon-arrow_up:before { content: '\e832'; } /* '' */
80 .icon-group:before { content: '\e80f'; } /* '' */
81 .icon-group:before { content: '\e80f'; } /* '' */
81 .icon-folder:before { content: '\e810'; } /* '' */
82 .icon-folder:before { content: '\e810'; } /* '' */
82 .icon-fork:before { content: '\e811'; } /* '' */
83 .icon-fork:before { content: '\e811'; } /* '' */
83 .icon-more:before { content: '\e812'; } /* '' */
84 .icon-more:before { content: '\e812'; } /* '' */
84 .icon-comment:before { content: '\e802'; } /* '' */
85 .icon-comment:before { content: '\e802'; } /* '' */
85 .icon-comment-add:before { content: '\e82f'; } /* '' */
86 .icon-comment-add:before { content: '\e82f'; } /* '' */
86 .icon-comment-toggle:before { content: '\e830'; } /* '' */
87 .icon-comment-toggle:before { content: '\e830'; } /* '' */
87 .icon-rhodecode:before { content: '\e831'; } /* '' */
88 .icon-rhodecode:before { content: '\e831'; } /* '' */
88 .icon-remove-sign:before { &:extend(.icon-remove:before); }
89 .icon-remove-sign:before { &:extend(.icon-remove:before); }
89 .icon-repo-private:before,
90 .icon-repo-private:before,
90 .icon-repo-lock:before { &:extend(.icon-lock:before); }
91 .icon-repo-lock:before { &:extend(.icon-lock:before); }
91 .icon-unlock-alt:before,
92 .icon-unlock-alt:before,
92 .icon-repo-unlock:before,
93 .icon-repo-unlock:before,
93 .icon-repo-public:before { &:extend(.icon-unlock:before); }
94 .icon-repo-public:before { &:extend(.icon-unlock:before); }
94 .icon-rss-sign:before { &:extend(.icon-feed:before); }
95 .icon-rss-sign:before { &:extend(.icon-feed:before); }
95 .icon-chevron-right:before { &:extend(.icon-right:before); }
96 .icon-chevron-right:before { &:extend(.icon-right:before); }
96 .icon-chevron-left:before { &:extend(.icon-left:before); }
97 .icon-chevron-left:before { &:extend(.icon-left:before); }
97 .icon-caret-down:before { &:extend(.icon-arrow_down:before); }
98 .icon-caret-down:before { &:extend(.icon-arrow_down:before); }
98 .icon-folder-close:before { &:extend(.icon-folder:before); }
99 .icon-folder-close:before { &:extend(.icon-folder:before); }
99 .icon-code-fork:before { &:extend(.icon-fork:before); }
100 .icon-code-fork:before { &:extend(.icon-fork:before); }
100
101
101
102
102 //--- ICONS STYLING ------------------//
103 //--- ICONS STYLING ------------------//
103
104
104 .icon-git { color: @color4 !important; }
105 .icon-git { color: @color4 !important; }
105 .icon-hg { color: @color8 !important; }
106 .icon-hg { color: @color8 !important; }
106 .icon-svn { color: @color1 !important; }
107 .icon-svn { color: @color1 !important; }
107 .icon-repo-lock { color: #FF0000; }
108 .icon-repo-lock { color: #FF0000; }
108 .icon-repo-unlock { color: #FF0000; }
109 .icon-repo-unlock { color: #FF0000; }
109
110
110 .repo-switcher-dropdown .select2-result-label {
111 .repo-switcher-dropdown .select2-result-label {
111 .icon-git:before {
112 .icon-git:before {
112 &:extend(.icon-git-transparent:before);
113 &:extend(.icon-git-transparent:before);
113 }
114 }
114 .icon-hg:before {
115 .icon-hg:before {
115 &:extend(.icon-hg-transparent:before);
116 &:extend(.icon-hg-transparent:before);
116 color: @alert4;
117 color: @alert4;
117 }
118 }
118 .icon-svn:before {
119 .icon-svn:before {
119 &:extend(.icon-svn-transparent:before);
120 &:extend(.icon-svn-transparent:before);
120 }
121 }
121 }
122 }
@@ -1,483 +1,497 b''
1 // # Copyright (C) 2010-2017 RhodeCode GmbH
1 // # Copyright (C) 2010-2017 RhodeCode GmbH
2 // #
2 // #
3 // # This program is free software: you can redistribute it and/or modify
3 // # This program is free software: you can redistribute it and/or modify
4 // # it under the terms of the GNU Affero General Public License, version 3
4 // # it under the terms of the GNU Affero General Public License, version 3
5 // # (only), as published by the Free Software Foundation.
5 // # (only), as published by the Free Software Foundation.
6 // #
6 // #
7 // # This program is distributed in the hope that it will be useful,
7 // # This program is distributed in the hope that it will be useful,
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 // # but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 // # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // # GNU General Public License for more details.
10 // # GNU General Public License for more details.
11 // #
11 // #
12 // # You should have received a copy of the GNU Affero General Public License
12 // # You should have received a copy of the GNU Affero General Public License
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
13 // # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 // #
14 // #
15 // # This program is dual-licensed. If you wish to learn more about the
15 // # This program is dual-licensed. If you wish to learn more about the
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
16 // # RhodeCode Enterprise Edition, including its added features, Support services,
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
17 // # and proprietary license terms, please see https://rhodecode.com/licenses/
18
18
19 /**
19 /**
20 RhodeCode JS Files
20 RhodeCode JS Files
21 **/
21 **/
22
22
23 if (typeof console == "undefined" || typeof console.log == "undefined"){
23 if (typeof console == "undefined" || typeof console.log == "undefined"){
24 console = { log: function() {} }
24 console = { log: function() {} }
25 }
25 }
26
26
27 // TODO: move the following function to submodules
27 // TODO: move the following function to submodules
28
28
29 /**
29 /**
30 * show more
30 * show more
31 */
31 */
32 var show_more_event = function(){
32 var show_more_event = function(){
33 $('table .show_more').click(function(e) {
33 $('table .show_more').click(function(e) {
34 var cid = e.target.id.substring(1);
34 var cid = e.target.id.substring(1);
35 var button = $(this);
35 var button = $(this);
36 if (button.hasClass('open')) {
36 if (button.hasClass('open')) {
37 $('#'+cid).hide();
37 $('#'+cid).hide();
38 button.removeClass('open');
38 button.removeClass('open');
39 } else {
39 } else {
40 $('#'+cid).show();
40 $('#'+cid).show();
41 button.addClass('open one');
41 button.addClass('open one');
42 }
42 }
43 });
43 });
44 };
44 };
45
45
46 var compare_radio_buttons = function(repo_name, compare_ref_type){
46 var compare_radio_buttons = function(repo_name, compare_ref_type){
47 $('#compare_action').on('click', function(e){
47 $('#compare_action').on('click', function(e){
48 e.preventDefault();
48 e.preventDefault();
49
49
50 var source = $('input[name=compare_source]:checked').val();
50 var source = $('input[name=compare_source]:checked').val();
51 var target = $('input[name=compare_target]:checked').val();
51 var target = $('input[name=compare_target]:checked').val();
52 if(source && target){
52 if(source && target){
53 var url_data = {
53 var url_data = {
54 repo_name: repo_name,
54 repo_name: repo_name,
55 source_ref: source,
55 source_ref: source,
56 source_ref_type: compare_ref_type,
56 source_ref_type: compare_ref_type,
57 target_ref: target,
57 target_ref: target,
58 target_ref_type: compare_ref_type,
58 target_ref_type: compare_ref_type,
59 merge: 1
59 merge: 1
60 };
60 };
61 window.location = pyroutes.url('compare_url', url_data);
61 window.location = pyroutes.url('compare_url', url_data);
62 }
62 }
63 });
63 });
64 $('.compare-radio-button').on('click', function(e){
64 $('.compare-radio-button').on('click', function(e){
65 var source = $('input[name=compare_source]:checked').val();
65 var source = $('input[name=compare_source]:checked').val();
66 var target = $('input[name=compare_target]:checked').val();
66 var target = $('input[name=compare_target]:checked').val();
67 if(source && target){
67 if(source && target){
68 $('#compare_action').removeAttr("disabled");
68 $('#compare_action').removeAttr("disabled");
69 $('#compare_action').removeClass("disabled");
69 $('#compare_action').removeClass("disabled");
70 }
70 }
71 })
71 })
72 };
72 };
73
73
74 var showRepoSize = function(target, repo_name, commit_id, callback) {
74 var showRepoSize = function(target, repo_name, commit_id, callback) {
75 var container = $('#' + target);
75 var container = $('#' + target);
76 var url = pyroutes.url('repo_stats',
76 var url = pyroutes.url('repo_stats',
77 {"repo_name": repo_name, "commit_id": commit_id});
77 {"repo_name": repo_name, "commit_id": commit_id});
78
78
79 if (!container.hasClass('loaded')) {
79 if (!container.hasClass('loaded')) {
80 $.ajax({url: url})
80 $.ajax({url: url})
81 .complete(function (data) {
81 .complete(function (data) {
82 var responseJSON = data.responseJSON;
82 var responseJSON = data.responseJSON;
83 container.addClass('loaded');
83 container.addClass('loaded');
84 container.html(responseJSON.size);
84 container.html(responseJSON.size);
85 callback(responseJSON.code_stats)
85 callback(responseJSON.code_stats)
86 })
86 })
87 .fail(function (data) {
87 .fail(function (data) {
88 console.log('failed to load repo stats');
88 console.log('failed to load repo stats');
89 });
89 });
90 }
90 }
91
91
92 };
92 };
93
93
94 var showRepoStats = function(target, data){
94 var showRepoStats = function(target, data){
95 var container = $('#' + target);
95 var container = $('#' + target);
96
96
97 if (container.hasClass('loaded')) {
97 if (container.hasClass('loaded')) {
98 return
98 return
99 }
99 }
100
100
101 var total = 0;
101 var total = 0;
102 var no_data = true;
102 var no_data = true;
103 var tbl = document.createElement('table');
103 var tbl = document.createElement('table');
104 tbl.setAttribute('class', 'trending_language_tbl');
104 tbl.setAttribute('class', 'trending_language_tbl');
105
105
106 $.each(data, function(key, val){
106 $.each(data, function(key, val){
107 total += val.count;
107 total += val.count;
108 });
108 });
109
109
110 var sortedStats = [];
110 var sortedStats = [];
111 for (var obj in data){
111 for (var obj in data){
112 sortedStats.push([obj, data[obj]])
112 sortedStats.push([obj, data[obj]])
113 }
113 }
114 var sortedData = sortedStats.sort(function (a, b) {
114 var sortedData = sortedStats.sort(function (a, b) {
115 return b[1].count - a[1].count
115 return b[1].count - a[1].count
116 });
116 });
117 var cnt = 0;
117 var cnt = 0;
118 $.each(sortedData, function(idx, val){
118 $.each(sortedData, function(idx, val){
119 cnt += 1;
119 cnt += 1;
120 no_data = false;
120 no_data = false;
121
121
122 var hide = cnt > 2;
122 var hide = cnt > 2;
123 var tr = document.createElement('tr');
123 var tr = document.createElement('tr');
124 if (hide) {
124 if (hide) {
125 tr.setAttribute('style', 'display:none');
125 tr.setAttribute('style', 'display:none');
126 tr.setAttribute('class', 'stats_hidden');
126 tr.setAttribute('class', 'stats_hidden');
127 }
127 }
128
128
129 var key = val[0];
129 var key = val[0];
130 var obj = {"desc": val[1].desc, "count": val[1].count};
130 var obj = {"desc": val[1].desc, "count": val[1].count};
131
131
132 var percentage = Math.round((obj.count / total * 100), 2);
132 var percentage = Math.round((obj.count / total * 100), 2);
133
133
134 var td1 = document.createElement('td');
134 var td1 = document.createElement('td');
135 td1.width = 300;
135 td1.width = 300;
136 var trending_language_label = document.createElement('div');
136 var trending_language_label = document.createElement('div');
137 trending_language_label.innerHTML = obj.desc + " (.{0})".format(key);
137 trending_language_label.innerHTML = obj.desc + " (.{0})".format(key);
138 td1.appendChild(trending_language_label);
138 td1.appendChild(trending_language_label);
139
139
140 var td2 = document.createElement('td');
140 var td2 = document.createElement('td');
141 var trending_language = document.createElement('div');
141 var trending_language = document.createElement('div');
142 var nr_files = obj.count +" "+ _ngettext('file', 'files', obj.count);
142 var nr_files = obj.count +" "+ _ngettext('file', 'files', obj.count);
143
143
144 trending_language.title = key + " " + nr_files;
144 trending_language.title = key + " " + nr_files;
145
145
146 trending_language.innerHTML = "<span>" + percentage + "% " + nr_files
146 trending_language.innerHTML = "<span>" + percentage + "% " + nr_files
147 + "</span><b>" + percentage + "% " + nr_files + "</b>";
147 + "</span><b>" + percentage + "% " + nr_files + "</b>";
148
148
149 trending_language.setAttribute("class", 'trending_language');
149 trending_language.setAttribute("class", 'trending_language');
150 $('b', trending_language)[0].style.width = percentage + "%";
150 $('b', trending_language)[0].style.width = percentage + "%";
151 td2.appendChild(trending_language);
151 td2.appendChild(trending_language);
152
152
153 tr.appendChild(td1);
153 tr.appendChild(td1);
154 tr.appendChild(td2);
154 tr.appendChild(td2);
155 tbl.appendChild(tr);
155 tbl.appendChild(tr);
156 if (cnt == 3) {
156 if (cnt == 3) {
157 var show_more = document.createElement('tr');
157 var show_more = document.createElement('tr');
158 var td = document.createElement('td');
158 var td = document.createElement('td');
159 lnk = document.createElement('a');
159 lnk = document.createElement('a');
160
160
161 lnk.href = '#';
161 lnk.href = '#';
162 lnk.innerHTML = _gettext('Show more');
162 lnk.innerHTML = _gettext('Show more');
163 lnk.id = 'code_stats_show_more';
163 lnk.id = 'code_stats_show_more';
164 td.appendChild(lnk);
164 td.appendChild(lnk);
165
165
166 show_more.appendChild(td);
166 show_more.appendChild(td);
167 show_more.appendChild(document.createElement('td'));
167 show_more.appendChild(document.createElement('td'));
168 tbl.appendChild(show_more);
168 tbl.appendChild(show_more);
169 }
169 }
170 });
170 });
171
171
172 $(container).html(tbl);
172 $(container).html(tbl);
173 $(container).addClass('loaded');
173 $(container).addClass('loaded');
174
174
175 $('#code_stats_show_more').on('click', function (e) {
175 $('#code_stats_show_more').on('click', function (e) {
176 e.preventDefault();
176 e.preventDefault();
177 $('.stats_hidden').each(function (idx) {
177 $('.stats_hidden').each(function (idx) {
178 $(this).css("display", "");
178 $(this).css("display", "");
179 });
179 });
180 $('#code_stats_show_more').hide();
180 $('#code_stats_show_more').hide();
181 });
181 });
182
182
183 };
183 };
184
184
185 // returns a node from given html;
185 // returns a node from given html;
186 var fromHTML = function(html){
186 var fromHTML = function(html){
187 var _html = document.createElement('element');
187 var _html = document.createElement('element');
188 _html.innerHTML = html;
188 _html.innerHTML = html;
189 return _html;
189 return _html;
190 };
190 };
191
191
192 // Toggle Collapsable Content
192 // Toggle Collapsable Content
193 function collapsableContent() {
193 function collapsableContent() {
194
194
195 $('.collapsable-content').not('.no-hide').hide();
195 $('.collapsable-content').not('.no-hide').hide();
196
196
197 $('.btn-collapse').unbind(); //in case we've been here before
197 $('.btn-collapse').unbind(); //in case we've been here before
198 $('.btn-collapse').click(function() {
198 $('.btn-collapse').click(function() {
199 var button = $(this);
199 var button = $(this);
200 var togglename = $(this).data("toggle");
200 var togglename = $(this).data("toggle");
201 $('.collapsable-content[data-toggle='+togglename+']').toggle();
201 $('.collapsable-content[data-toggle='+togglename+']').toggle();
202 if ($(this).html()=="Show Less")
202 if ($(this).html()=="Show Less")
203 $(this).html("Show More");
203 $(this).html("Show More");
204 else
204 else
205 $(this).html("Show Less");
205 $(this).html("Show Less");
206 });
206 });
207 };
207 };
208
208
209 var timeagoActivate = function() {
209 var timeagoActivate = function() {
210 $("time.timeago").timeago();
210 $("time.timeago").timeago();
211 };
211 };
212
212
213
214 var clipboardActivate = function() {
215 /*
216 *
217 * <i class="tooltip icon-plus clipboard-action" data-clipboard-text="${commit.raw_id}" title="${_('Copy the full commit id')}"></i>
218 * */
219 var clipboard = new Clipboard('.clipboard-action');
220
221 clipboard.on('success', function(e) {
222 e.clearSelection();
223 });
224 };
225
226
213 // Formatting values in a Select2 dropdown of commit references
227 // Formatting values in a Select2 dropdown of commit references
214 var formatSelect2SelectionRefs = function(commit_ref){
228 var formatSelect2SelectionRefs = function(commit_ref){
215 var tmpl = '';
229 var tmpl = '';
216 if (!commit_ref.text || commit_ref.type === 'sha'){
230 if (!commit_ref.text || commit_ref.type === 'sha'){
217 return commit_ref.text;
231 return commit_ref.text;
218 }
232 }
219 if (commit_ref.type === 'branch'){
233 if (commit_ref.type === 'branch'){
220 tmpl = tmpl.concat('<i class="icon-branch"></i> ');
234 tmpl = tmpl.concat('<i class="icon-branch"></i> ');
221 } else if (commit_ref.type === 'tag'){
235 } else if (commit_ref.type === 'tag'){
222 tmpl = tmpl.concat('<i class="icon-tag"></i> ');
236 tmpl = tmpl.concat('<i class="icon-tag"></i> ');
223 } else if (commit_ref.type === 'book'){
237 } else if (commit_ref.type === 'book'){
224 tmpl = tmpl.concat('<i class="icon-bookmark"></i> ');
238 tmpl = tmpl.concat('<i class="icon-bookmark"></i> ');
225 }
239 }
226 return tmpl.concat(commit_ref.text);
240 return tmpl.concat(commit_ref.text);
227 };
241 };
228
242
229 // takes a given html element and scrolls it down offset pixels
243 // takes a given html element and scrolls it down offset pixels
230 function offsetScroll(element, offset) {
244 function offsetScroll(element, offset) {
231 setTimeout(function() {
245 setTimeout(function() {
232 var location = element.offset().top;
246 var location = element.offset().top;
233 // some browsers use body, some use html
247 // some browsers use body, some use html
234 $('html, body').animate({ scrollTop: (location - offset) });
248 $('html, body').animate({ scrollTop: (location - offset) });
235 }, 100);
249 }, 100);
236 }
250 }
237
251
238 // scroll an element `percent`% from the top of page in `time` ms
252 // scroll an element `percent`% from the top of page in `time` ms
239 function scrollToElement(element, percent, time) {
253 function scrollToElement(element, percent, time) {
240 percent = (percent === undefined ? 25 : percent);
254 percent = (percent === undefined ? 25 : percent);
241 time = (time === undefined ? 100 : time);
255 time = (time === undefined ? 100 : time);
242
256
243 var $element = $(element);
257 var $element = $(element);
244 if ($element.length == 0) {
258 if ($element.length == 0) {
245 throw('Cannot scroll to {0}'.format(element))
259 throw('Cannot scroll to {0}'.format(element))
246 }
260 }
247 var elOffset = $element.offset().top;
261 var elOffset = $element.offset().top;
248 var elHeight = $element.height();
262 var elHeight = $element.height();
249 var windowHeight = $(window).height();
263 var windowHeight = $(window).height();
250 var offset = elOffset;
264 var offset = elOffset;
251 if (elHeight < windowHeight) {
265 if (elHeight < windowHeight) {
252 offset = elOffset - ((windowHeight / (100 / percent)) - (elHeight / 2));
266 offset = elOffset - ((windowHeight / (100 / percent)) - (elHeight / 2));
253 }
267 }
254 setTimeout(function() {
268 setTimeout(function() {
255 $('html, body').animate({ scrollTop: offset});
269 $('html, body').animate({ scrollTop: offset});
256 }, time);
270 }, time);
257 }
271 }
258
272
259 /**
273 /**
260 * global hooks after DOM is loaded
274 * global hooks after DOM is loaded
261 */
275 */
262 $(document).ready(function() {
276 $(document).ready(function() {
263 firefoxAnchorFix();
277 firefoxAnchorFix();
264
278
265 $('.navigation a.menulink').on('click', function(e){
279 $('.navigation a.menulink').on('click', function(e){
266 var menuitem = $(this).parent('li');
280 var menuitem = $(this).parent('li');
267 if (menuitem.hasClass('open')) {
281 if (menuitem.hasClass('open')) {
268 menuitem.removeClass('open');
282 menuitem.removeClass('open');
269 } else {
283 } else {
270 menuitem.addClass('open');
284 menuitem.addClass('open');
271 $(document).on('click', function(event) {
285 $(document).on('click', function(event) {
272 if (!$(event.target).closest(menuitem).length) {
286 if (!$(event.target).closest(menuitem).length) {
273 menuitem.removeClass('open');
287 menuitem.removeClass('open');
274 }
288 }
275 });
289 });
276 }
290 }
277 });
291 });
278 $('.compare_view_files').on(
292 $('.compare_view_files').on(
279 'mouseenter mouseleave', 'tr.line .lineno a',function(event) {
293 'mouseenter mouseleave', 'tr.line .lineno a',function(event) {
280 if (event.type === "mouseenter") {
294 if (event.type === "mouseenter") {
281 $(this).parents('tr.line').addClass('hover');
295 $(this).parents('tr.line').addClass('hover');
282 } else {
296 } else {
283 $(this).parents('tr.line').removeClass('hover');
297 $(this).parents('tr.line').removeClass('hover');
284 }
298 }
285 });
299 });
286
300
287 $('.compare_view_files').on(
301 $('.compare_view_files').on(
288 'mouseenter mouseleave', 'tr.line .add-comment-line a',function(event){
302 'mouseenter mouseleave', 'tr.line .add-comment-line a',function(event){
289 if (event.type === "mouseenter") {
303 if (event.type === "mouseenter") {
290 $(this).parents('tr.line').addClass('commenting');
304 $(this).parents('tr.line').addClass('commenting');
291 } else {
305 } else {
292 $(this).parents('tr.line').removeClass('commenting');
306 $(this).parents('tr.line').removeClass('commenting');
293 }
307 }
294 });
308 });
295
309
296 $('body').on( /* TODO: replace the $('.compare_view_files').on('click') below
310 $('body').on( /* TODO: replace the $('.compare_view_files').on('click') below
297 when new diffs are integrated */
311 when new diffs are integrated */
298 'click', '.cb-lineno a', function(event) {
312 'click', '.cb-lineno a', function(event) {
299
313
300 if ($(this).attr('data-line-no') !== ""){
314 if ($(this).attr('data-line-no') !== ""){
301 $('.cb-line-selected').removeClass('cb-line-selected');
315 $('.cb-line-selected').removeClass('cb-line-selected');
302 var td = $(this).parent();
316 var td = $(this).parent();
303 td.addClass('cb-line-selected'); // line number td
317 td.addClass('cb-line-selected'); // line number td
304 td.prev().addClass('cb-line-selected'); // line data td
318 td.prev().addClass('cb-line-selected'); // line data td
305 td.next().addClass('cb-line-selected'); // line content td
319 td.next().addClass('cb-line-selected'); // line content td
306
320
307 // Replace URL without jumping to it if browser supports.
321 // Replace URL without jumping to it if browser supports.
308 // Default otherwise
322 // Default otherwise
309 if (history.pushState) {
323 if (history.pushState) {
310 var new_location = location.href.rstrip('#');
324 var new_location = location.href.rstrip('#');
311 if (location.hash) {
325 if (location.hash) {
312 new_location = new_location.replace(location.hash, "");
326 new_location = new_location.replace(location.hash, "");
313 }
327 }
314
328
315 // Make new anchor url
329 // Make new anchor url
316 new_location = new_location + $(this).attr('href');
330 new_location = new_location + $(this).attr('href');
317 history.pushState(true, document.title, new_location);
331 history.pushState(true, document.title, new_location);
318
332
319 return false;
333 return false;
320 }
334 }
321 }
335 }
322 });
336 });
323
337
324 $('.compare_view_files').on( /* TODO: replace this with .cb function above
338 $('.compare_view_files').on( /* TODO: replace this with .cb function above
325 when new diffs are integrated */
339 when new diffs are integrated */
326 'click', 'tr.line .lineno a',function(event) {
340 'click', 'tr.line .lineno a',function(event) {
327 if ($(this).text() != ""){
341 if ($(this).text() != ""){
328 $('tr.line').removeClass('selected');
342 $('tr.line').removeClass('selected');
329 $(this).parents("tr.line").addClass('selected');
343 $(this).parents("tr.line").addClass('selected');
330
344
331 // Replace URL without jumping to it if browser supports.
345 // Replace URL without jumping to it if browser supports.
332 // Default otherwise
346 // Default otherwise
333 if (history.pushState) {
347 if (history.pushState) {
334 var new_location = location.href;
348 var new_location = location.href;
335 if (location.hash){
349 if (location.hash){
336 new_location = new_location.replace(location.hash, "");
350 new_location = new_location.replace(location.hash, "");
337 }
351 }
338
352
339 // Make new anchor url
353 // Make new anchor url
340 var new_location = new_location+$(this).attr('href');
354 var new_location = new_location+$(this).attr('href');
341 history.pushState(true, document.title, new_location);
355 history.pushState(true, document.title, new_location);
342
356
343 return false;
357 return false;
344 }
358 }
345 }
359 }
346 });
360 });
347
361
348 $('.compare_view_files').on(
362 $('.compare_view_files').on(
349 'click', 'tr.line .add-comment-line a',function(event) {
363 'click', 'tr.line .add-comment-line a',function(event) {
350 var tr = $(event.currentTarget).parents('tr.line')[0];
364 var tr = $(event.currentTarget).parents('tr.line')[0];
351 injectInlineForm(tr);
365 injectInlineForm(tr);
352 return false;
366 return false;
353 });
367 });
354
368
355 $('.collapse_file').on('click', function(e) {
369 $('.collapse_file').on('click', function(e) {
356 e.stopPropagation();
370 e.stopPropagation();
357 if ($(e.target).is('a')) { return; }
371 if ($(e.target).is('a')) { return; }
358 var node = $(e.delegateTarget).first();
372 var node = $(e.delegateTarget).first();
359 var icon = $($(node.children().first()).children().first());
373 var icon = $($(node.children().first()).children().first());
360 var id = node.attr('fid');
374 var id = node.attr('fid');
361 var target = $('#'+id);
375 var target = $('#'+id);
362 var tr = $('#tr_'+id);
376 var tr = $('#tr_'+id);
363 var diff = $('#diff_'+id);
377 var diff = $('#diff_'+id);
364 if(node.hasClass('expand_file')){
378 if(node.hasClass('expand_file')){
365 node.removeClass('expand_file');
379 node.removeClass('expand_file');
366 icon.removeClass('expand_file_icon');
380 icon.removeClass('expand_file_icon');
367 node.addClass('collapse_file');
381 node.addClass('collapse_file');
368 icon.addClass('collapse_file_icon');
382 icon.addClass('collapse_file_icon');
369 diff.show();
383 diff.show();
370 tr.show();
384 tr.show();
371 target.show();
385 target.show();
372 } else {
386 } else {
373 node.removeClass('collapse_file');
387 node.removeClass('collapse_file');
374 icon.removeClass('collapse_file_icon');
388 icon.removeClass('collapse_file_icon');
375 node.addClass('expand_file');
389 node.addClass('expand_file');
376 icon.addClass('expand_file_icon');
390 icon.addClass('expand_file_icon');
377 diff.hide();
391 diff.hide();
378 tr.hide();
392 tr.hide();
379 target.hide();
393 target.hide();
380 }
394 }
381 });
395 });
382
396
383 $('#expand_all_files').click(function() {
397 $('#expand_all_files').click(function() {
384 $('.expand_file').each(function() {
398 $('.expand_file').each(function() {
385 var node = $(this);
399 var node = $(this);
386 var icon = $($(node.children().first()).children().first());
400 var icon = $($(node.children().first()).children().first());
387 var id = $(this).attr('fid');
401 var id = $(this).attr('fid');
388 var target = $('#'+id);
402 var target = $('#'+id);
389 var tr = $('#tr_'+id);
403 var tr = $('#tr_'+id);
390 var diff = $('#diff_'+id);
404 var diff = $('#diff_'+id);
391 node.removeClass('expand_file');
405 node.removeClass('expand_file');
392 icon.removeClass('expand_file_icon');
406 icon.removeClass('expand_file_icon');
393 node.addClass('collapse_file');
407 node.addClass('collapse_file');
394 icon.addClass('collapse_file_icon');
408 icon.addClass('collapse_file_icon');
395 diff.show();
409 diff.show();
396 tr.show();
410 tr.show();
397 target.show();
411 target.show();
398 });
412 });
399 });
413 });
400
414
401 $('#collapse_all_files').click(function() {
415 $('#collapse_all_files').click(function() {
402 $('.collapse_file').each(function() {
416 $('.collapse_file').each(function() {
403 var node = $(this);
417 var node = $(this);
404 var icon = $($(node.children().first()).children().first());
418 var icon = $($(node.children().first()).children().first());
405 var id = $(this).attr('fid');
419 var id = $(this).attr('fid');
406 var target = $('#'+id);
420 var target = $('#'+id);
407 var tr = $('#tr_'+id);
421 var tr = $('#tr_'+id);
408 var diff = $('#diff_'+id);
422 var diff = $('#diff_'+id);
409 node.removeClass('collapse_file');
423 node.removeClass('collapse_file');
410 icon.removeClass('collapse_file_icon');
424 icon.removeClass('collapse_file_icon');
411 node.addClass('expand_file');
425 node.addClass('expand_file');
412 icon.addClass('expand_file_icon');
426 icon.addClass('expand_file_icon');
413 diff.hide();
427 diff.hide();
414 tr.hide();
428 tr.hide();
415 target.hide();
429 target.hide();
416 });
430 });
417 });
431 });
418
432
419 // Mouse over behavior for comments and line selection
433 // Mouse over behavior for comments and line selection
420
434
421 // Select the line that comes from the url anchor
435 // Select the line that comes from the url anchor
422 // At the time of development, Chrome didn't seem to support jquery's :target
436 // At the time of development, Chrome didn't seem to support jquery's :target
423 // element, so I had to scroll manually
437 // element, so I had to scroll manually
424
438
425 if (location.hash) {
439 if (location.hash) {
426 var result = splitDelimitedHash(location.hash);
440 var result = splitDelimitedHash(location.hash);
427 var loc = result.loc;
441 var loc = result.loc;
428 if (loc.length > 1) {
442 if (loc.length > 1) {
429
443
430 var highlightable_line_tds = [];
444 var highlightable_line_tds = [];
431
445
432 // source code line format
446 // source code line format
433 var page_highlights = loc.substring(
447 var page_highlights = loc.substring(
434 loc.indexOf('#') + 1).split('L');
448 loc.indexOf('#') + 1).split('L');
435
449
436 if (page_highlights.length > 1) {
450 if (page_highlights.length > 1) {
437 var highlight_ranges = page_highlights[1].split(",");
451 var highlight_ranges = page_highlights[1].split(",");
438 var h_lines = [];
452 var h_lines = [];
439 for (var pos in highlight_ranges) {
453 for (var pos in highlight_ranges) {
440 var _range = highlight_ranges[pos].split('-');
454 var _range = highlight_ranges[pos].split('-');
441 if (_range.length === 2) {
455 if (_range.length === 2) {
442 var start = parseInt(_range[0]);
456 var start = parseInt(_range[0]);
443 var end = parseInt(_range[1]);
457 var end = parseInt(_range[1]);
444 if (start < end) {
458 if (start < end) {
445 for (var i = start; i <= end; i++) {
459 for (var i = start; i <= end; i++) {
446 h_lines.push(i);
460 h_lines.push(i);
447 }
461 }
448 }
462 }
449 }
463 }
450 else {
464 else {
451 h_lines.push(parseInt(highlight_ranges[pos]));
465 h_lines.push(parseInt(highlight_ranges[pos]));
452 }
466 }
453 }
467 }
454 for (pos in h_lines) {
468 for (pos in h_lines) {
455 var line_td = $('td.cb-lineno#L' + h_lines[pos]);
469 var line_td = $('td.cb-lineno#L' + h_lines[pos]);
456 if (line_td.length) {
470 if (line_td.length) {
457 highlightable_line_tds.push(line_td);
471 highlightable_line_tds.push(line_td);
458 }
472 }
459 }
473 }
460 }
474 }
461
475
462 // now check a direct id reference (diff page)
476 // now check a direct id reference (diff page)
463 if ($(loc).length && $(loc).hasClass('cb-lineno')) {
477 if ($(loc).length && $(loc).hasClass('cb-lineno')) {
464 highlightable_line_tds.push($(loc));
478 highlightable_line_tds.push($(loc));
465 }
479 }
466 $.each(highlightable_line_tds, function (i, $td) {
480 $.each(highlightable_line_tds, function (i, $td) {
467 $td.addClass('cb-line-selected'); // line number td
481 $td.addClass('cb-line-selected'); // line number td
468 $td.prev().addClass('cb-line-selected'); // line data
482 $td.prev().addClass('cb-line-selected'); // line data
469 $td.next().addClass('cb-line-selected'); // line content
483 $td.next().addClass('cb-line-selected'); // line content
470 });
484 });
471
485
472 if (highlightable_line_tds.length) {
486 if (highlightable_line_tds.length) {
473 var $first_line_td = highlightable_line_tds[0];
487 var $first_line_td = highlightable_line_tds[0];
474 scrollToElement($first_line_td);
488 scrollToElement($first_line_td);
475 $.Topic('/ui/plugins/code/anchor_focus').prepareOrPublish({
489 $.Topic('/ui/plugins/code/anchor_focus').prepareOrPublish({
476 td: $first_line_td,
490 td: $first_line_td,
477 remainder: result.remainder
491 remainder: result.remainder
478 });
492 });
479 }
493 }
480 }
494 }
481 }
495 }
482 collapsableContent();
496 collapsableContent();
483 });
497 });
@@ -1,175 +1,176 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <!DOCTYPE html>
2 <!DOCTYPE html>
3
3
4 <%
4 <%
5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
5 c.template_context['repo_name'] = getattr(c, 'repo_name', '')
6
6
7 if hasattr(c, 'rhodecode_db_repo'):
7 if hasattr(c, 'rhodecode_db_repo'):
8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
8 c.template_context['repo_type'] = c.rhodecode_db_repo.repo_type
9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
9 c.template_context['repo_landing_commit'] = c.rhodecode_db_repo.landing_rev[1]
10
10
11 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
11 if getattr(c, 'rhodecode_user', None) and c.rhodecode_user.user_id:
12 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
12 c.template_context['rhodecode_user']['username'] = c.rhodecode_user.username
13 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
13 c.template_context['rhodecode_user']['email'] = c.rhodecode_user.email
14 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
14 c.template_context['rhodecode_user']['notification_status'] = c.rhodecode_user.get_instance().user_data.get('notification_status', True)
15 c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name
15 c.template_context['rhodecode_user']['first_name'] = c.rhodecode_user.first_name
16 c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name
16 c.template_context['rhodecode_user']['last_name'] = c.rhodecode_user.last_name
17
17
18 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
18 c.template_context['visual']['default_renderer'] = h.get_visual_attr(c, 'default_renderer')
19 c.template_context['default_user'] = {
19 c.template_context['default_user'] = {
20 'username': h.DEFAULT_USER,
20 'username': h.DEFAULT_USER,
21 'user_id': 1
21 'user_id': 1
22 }
22 }
23
23
24 %>
24 %>
25 <html xmlns="http://www.w3.org/1999/xhtml">
25 <html xmlns="http://www.w3.org/1999/xhtml">
26 <head>
26 <head>
27 <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}"></script>
27 <script src="${h.asset('js/vendors/webcomponentsjs/webcomponents-lite.min.js', ver=c.rhodecode_version_hash)}"></script>
28 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
28 <link rel="import" href="${h.asset('js/rhodecode-components.html', ver=c.rhodecode_version_hash)}">
29 <title>${self.title()}</title>
29 <title>${self.title()}</title>
30 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
30 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
31 <%def name="robots()">
31 <%def name="robots()">
32 <meta name="robots" content="index, nofollow"/>
32 <meta name="robots" content="index, nofollow"/>
33 </%def>
33 </%def>
34 ${self.robots()}
34 ${self.robots()}
35 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
35 <link rel="icon" href="${h.asset('images/favicon.ico', ver=c.rhodecode_version_hash)}" sizes="16x16 32x32" type="image/png" />
36
36
37 ## CSS definitions
37 ## CSS definitions
38 <%def name="css()">
38 <%def name="css()">
39 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
39 <link rel="stylesheet" type="text/css" href="${h.asset('css/style.css', ver=c.rhodecode_version_hash)}" media="screen"/>
40 <!--[if lt IE 9]>
40 <!--[if lt IE 9]>
41 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
41 <link rel="stylesheet" type="text/css" href="${h.asset('css/ie.css', ver=c.rhodecode_version_hash)}" media="screen"/>
42 <![endif]-->
42 <![endif]-->
43 ## EXTRA FOR CSS
43 ## EXTRA FOR CSS
44 ${self.css_extra()}
44 ${self.css_extra()}
45 </%def>
45 </%def>
46 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
46 ## CSS EXTRA - optionally inject some extra CSS stuff needed for specific websites
47 <%def name="css_extra()">
47 <%def name="css_extra()">
48 </%def>
48 </%def>
49
49
50 ${self.css()}
50 ${self.css()}
51
51
52 ## JAVASCRIPT
52 ## JAVASCRIPT
53 <%def name="js()">
53 <%def name="js()">
54 <script>
54 <script>
55 // setup Polymer options
55 // setup Polymer options
56 window.Polymer = {lazyRegister: true, dom: 'shadow'};
56 window.Polymer = {lazyRegister: true, dom: 'shadow'};
57
57
58 // Load webcomponentsjs polyfill if browser does not support native Web Components
58 // Load webcomponentsjs polyfill if browser does not support native Web Components
59 (function() {
59 (function() {
60 'use strict';
60 'use strict';
61 var onload = function() {
61 var onload = function() {
62 // For native Imports, manually fire WebComponentsReady so user code
62 // For native Imports, manually fire WebComponentsReady so user code
63 // can use the same code path for native and polyfill'd imports.
63 // can use the same code path for native and polyfill'd imports.
64 if (!window.HTMLImports) {
64 if (!window.HTMLImports) {
65 document.dispatchEvent(
65 document.dispatchEvent(
66 new CustomEvent('WebComponentsReady', {bubbles: true})
66 new CustomEvent('WebComponentsReady', {bubbles: true})
67 );
67 );
68 }
68 }
69 };
69 };
70 var webComponentsSupported = (
70 var webComponentsSupported = (
71 'registerElement' in document
71 'registerElement' in document
72 && 'import' in document.createElement('link')
72 && 'import' in document.createElement('link')
73 && 'content' in document.createElement('template')
73 && 'content' in document.createElement('template')
74 );
74 );
75 if (!webComponentsSupported) {
75 if (!webComponentsSupported) {
76 } else {
76 } else {
77 onload();
77 onload();
78 }
78 }
79 })();
79 })();
80 </script>
80 </script>
81
81
82 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
82 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
83 <script type="text/javascript">
83 <script type="text/javascript">
84 // register templateContext to pass template variables to JS
84 // register templateContext to pass template variables to JS
85 var templateContext = ${h.json.dumps(c.template_context)|n};
85 var templateContext = ${h.json.dumps(c.template_context)|n};
86
86
87 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
87 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
88 var ASSET_URL = "${h.asset('')}";
88 var ASSET_URL = "${h.asset('')}";
89 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
89 var DEFAULT_RENDERER = "${h.get_visual_attr(c, 'default_renderer')}";
90 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
90 var CSRF_TOKEN = "${getattr(c, 'csrf_token', '')}";
91
91
92 var APPENLIGHT = {
92 var APPENLIGHT = {
93 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
93 enabled: ${'true' if getattr(c, 'appenlight_enabled', False) else 'false'},
94 key: '${getattr(c, "appenlight_api_public_key", "")}',
94 key: '${getattr(c, "appenlight_api_public_key", "")}',
95 % if getattr(c, 'appenlight_server_url', None):
95 % if getattr(c, 'appenlight_server_url', None):
96 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
96 serverUrl: '${getattr(c, "appenlight_server_url", "")}',
97 % endif
97 % endif
98 requestInfo: {
98 requestInfo: {
99 % if getattr(c, 'rhodecode_user', None):
99 % if getattr(c, 'rhodecode_user', None):
100 ip: '${c.rhodecode_user.ip_addr}',
100 ip: '${c.rhodecode_user.ip_addr}',
101 username: '${c.rhodecode_user.username}'
101 username: '${c.rhodecode_user.username}'
102 % endif
102 % endif
103 },
103 },
104 tags: {
104 tags: {
105 rhodecode_version: '${c.rhodecode_version}',
105 rhodecode_version: '${c.rhodecode_version}',
106 rhodecode_edition: '${c.rhodecode_edition}'
106 rhodecode_edition: '${c.rhodecode_edition}'
107 }
107 }
108 };
108 };
109
109
110 </script>
110 </script>
111 <%include file="/base/plugins_base.mako"/>
111 <%include file="/base/plugins_base.mako"/>
112 <!--[if lt IE 9]>
112 <!--[if lt IE 9]>
113 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
113 <script language="javascript" type="text/javascript" src="${h.asset('js/excanvas.min.js')}"></script>
114 <![endif]-->
114 <![endif]-->
115 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
115 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode/routes.js', ver=c.rhodecode_version_hash)}"></script>
116 <script> var alertMessagePayloads = ${h.flash.json_alerts(request)|n}; </script>
116 <script> var alertMessagePayloads = ${h.flash.json_alerts(request)|n}; </script>
117 ## avoide escaping the %N
117 ## avoide escaping the %N
118 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}"></script>
118 <script language="javascript" type="text/javascript" src="${h.asset('js/rhodecode-components.js', ver=c.rhodecode_version_hash)}"></script>
119 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
119 <script>CodeMirror.modeURL = "${h.asset('') + 'js/mode/%N/%N.js?ver='+c.rhodecode_version_hash}";</script>
120
120
121
121
122 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
122 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
123 ${self.js_extra()}
123 ${self.js_extra()}
124
124
125 <script type="text/javascript">
125 <script type="text/javascript">
126 Rhodecode = (function() {
126 Rhodecode = (function() {
127 function _Rhodecode() {
127 function _Rhodecode() {
128 this.comments = new CommentsController();
128 this.comments = new CommentsController();
129 }
129 }
130 return new _Rhodecode();
130 return new _Rhodecode();
131 })();
131 })();
132
132
133 $(document).ready(function(){
133 $(document).ready(function(){
134 show_more_event();
134 show_more_event();
135 timeagoActivate();
135 timeagoActivate();
136 clipboardActivate();
136 })
137 })
137 </script>
138 </script>
138
139
139 </%def>
140 </%def>
140
141
141 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
142 ## JAVASCRIPT EXTRA - optionally inject some extra JS for specificed templates
142 <%def name="js_extra()"></%def>
143 <%def name="js_extra()"></%def>
143 ${self.js()}
144 ${self.js()}
144
145
145 <%def name="head_extra()"></%def>
146 <%def name="head_extra()"></%def>
146 ${self.head_extra()}
147 ${self.head_extra()}
147 ## extra stuff
148 ## extra stuff
148 %if c.pre_code:
149 %if c.pre_code:
149 ${c.pre_code|n}
150 ${c.pre_code|n}
150 %endif
151 %endif
151 </head>
152 </head>
152 <body id="body">
153 <body id="body">
153 <noscript>
154 <noscript>
154 <div class="noscript-error">
155 <div class="noscript-error">
155 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
156 ${_('Please enable JavaScript to use RhodeCode Enterprise')}
156 </div>
157 </div>
157 </noscript>
158 </noscript>
158 ## IE hacks
159 ## IE hacks
159 <!--[if IE 7]>
160 <!--[if IE 7]>
160 <script>$(document.body).addClass('ie7')</script>
161 <script>$(document.body).addClass('ie7')</script>
161 <![endif]-->
162 <![endif]-->
162 <!--[if IE 8]>
163 <!--[if IE 8]>
163 <script>$(document.body).addClass('ie8')</script>
164 <script>$(document.body).addClass('ie8')</script>
164 <![endif]-->
165 <![endif]-->
165 <!--[if IE 9]>
166 <!--[if IE 9]>
166 <script>$(document.body).addClass('ie9')</script>
167 <script>$(document.body).addClass('ie9')</script>
167 <![endif]-->
168 <![endif]-->
168
169
169 ${next.body()}
170 ${next.body()}
170 %if c.post_code:
171 %if c.post_code:
171 ${c.post_code|n}
172 ${c.post_code|n}
172 %endif
173 %endif
173 <rhodecode-app></rhodecode-app>
174 <rhodecode-app></rhodecode-app>
174 </body>
175 </body>
175 </html>
176 </html>
@@ -1,142 +1,144 b''
1 ## small box that displays changed/added/removed details fetched by AJAX
1 ## small box that displays changed/added/removed details fetched by AJAX
2 <%namespace name="base" file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
3
3
4
4
5 % if c.prev_page:
5 % if c.prev_page:
6 <tr>
6 <tr>
7 <td colspan="9" class="load-more-commits">
7 <td colspan="9" class="load-more-commits">
8 <a class="prev-commits" href="#loadPrevCommits" onclick="commitsController.loadPrev(this, ${c.prev_page}, '${c.branch_name}');return false">
8 <a class="prev-commits" href="#loadPrevCommits" onclick="commitsController.loadPrev(this, ${c.prev_page}, '${c.branch_name}');return false">
9 ${_('load previous')}
9 ${_('load previous')}
10 </a>
10 </a>
11 </td>
11 </td>
12 </tr>
12 </tr>
13 % endif
13 % endif
14
14
15 % for cnt,commit in enumerate(c.pagination):
15 % for cnt,commit in enumerate(c.pagination):
16 <tr id="sha_${commit.raw_id}" class="changelogRow container ${'tablerow%s' % (cnt%2)}">
16 <tr id="sha_${commit.raw_id}" class="changelogRow container ${'tablerow%s' % (cnt%2)}">
17
17
18 <td class="td-checkbox">
18 <td class="td-checkbox">
19 ${h.checkbox(commit.raw_id,class_="commit-range")}
19 ${h.checkbox(commit.raw_id,class_="commit-range")}
20 </td>
20 </td>
21 <td class="td-status">
21 <td class="td-status">
22
22
23 %if c.statuses.get(commit.raw_id):
23 %if c.statuses.get(commit.raw_id):
24 <div class="changeset-status-ico">
24 <div class="changeset-status-ico">
25 %if c.statuses.get(commit.raw_id)[2]:
25 %if c.statuses.get(commit.raw_id)[2]:
26 <a class="tooltip" title="${_('Commit status: %s\nClick to open associated pull request #%s') % (h.commit_status_lbl(c.statuses.get(commit.raw_id)[0]), c.statuses.get(commit.raw_id)[2])}" href="${h.route_path('pullrequest_show',repo_name=c.statuses.get(commit.raw_id)[3],pull_request_id=c.statuses.get(commit.raw_id)[2])}">
26 <a class="tooltip" title="${_('Commit status: %s\nClick to open associated pull request #%s') % (h.commit_status_lbl(c.statuses.get(commit.raw_id)[0]), c.statuses.get(commit.raw_id)[2])}" href="${h.route_path('pullrequest_show',repo_name=c.statuses.get(commit.raw_id)[3],pull_request_id=c.statuses.get(commit.raw_id)[2])}">
27 <div class="${'flag_status %s' % c.statuses.get(commit.raw_id)[0]}"></div>
27 <div class="${'flag_status %s' % c.statuses.get(commit.raw_id)[0]}"></div>
28 </a>
28 </a>
29 %else:
29 %else:
30 <a class="tooltip" title="${_('Commit status: %s') % h.commit_status_lbl(c.statuses.get(commit.raw_id)[0])}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id,anchor='comment-%s' % c.comments[commit.raw_id][0].comment_id)}">
30 <a class="tooltip" title="${_('Commit status: %s') % h.commit_status_lbl(c.statuses.get(commit.raw_id)[0])}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id,anchor='comment-%s' % c.comments[commit.raw_id][0].comment_id)}">
31 <div class="${'flag_status %s' % c.statuses.get(commit.raw_id)[0]}"></div>
31 <div class="${'flag_status %s' % c.statuses.get(commit.raw_id)[0]}"></div>
32 </a>
32 </a>
33 %endif
33 %endif
34 </div>
34 </div>
35 %else:
35 %else:
36 <div class="tooltip flag_status not_reviewed" title="${_('Commit status: Not Reviewed')}"></div>
36 <div class="tooltip flag_status not_reviewed" title="${_('Commit status: Not Reviewed')}"></div>
37 %endif
37 %endif
38 </td>
38 </td>
39 <td class="td-comments comments-col">
39 <td class="td-comments comments-col">
40 %if c.comments.get(commit.raw_id):
40 %if c.comments.get(commit.raw_id):
41 <a title="${_('Commit has comments')}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id,anchor='comment-%s' % c.comments[commit.raw_id][0].comment_id)}">
41 <a title="${_('Commit has comments')}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id,anchor='comment-%s' % c.comments[commit.raw_id][0].comment_id)}">
42 <i class="icon-comment"></i> ${len(c.comments[commit.raw_id])}
42 <i class="icon-comment"></i> ${len(c.comments[commit.raw_id])}
43 </a>
43 </a>
44 %endif
44 %endif
45 </td>
45 </td>
46 <td class="td-hash">
46 <td class="td-hash">
47 <code>
47 <code>
48 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${commit.raw_id}" title="${_('Copy the full commit id')}"></i>
49
48 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id)}">
50 <a href="${h.url('changeset_home',repo_name=c.repo_name,revision=commit.raw_id)}">
49 <span class="${'commit_hash obsolete' if getattr(commit, 'obsolete', None) else 'commit_hash'}">${h.show_id(commit)}</span>
51 <span class="${'commit_hash obsolete' if getattr(commit, 'obsolete', None) else 'commit_hash'}">${h.show_id(commit)}</span>
50 </a>
52 </a>
51 % if hasattr(commit, 'phase'):
53 % if hasattr(commit, 'phase'):
52 % if commit.phase != 'public':
54 % if commit.phase != 'public':
53 <span class="tag phase-${commit.phase} tooltip" title="${_('Commit phase')}">${commit.phase}</span>
55 <span class="tag phase-${commit.phase} tooltip" title="${_('Commit phase')}">${commit.phase}</span>
54 % endif
56 % endif
55 % endif
57 % endif
56
58
57 ## obsolete commits
59 ## obsolete commits
58 % if hasattr(commit, 'obsolete'):
60 % if hasattr(commit, 'obsolete'):
59 % if commit.obsolete:
61 % if commit.obsolete:
60 <span class="tag obsolete-${commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
62 <span class="tag obsolete-${commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
61 % endif
63 % endif
62 % endif
64 % endif
63
65
64 ## hidden commits
66 ## hidden commits
65 % if hasattr(commit, 'hidden'):
67 % if hasattr(commit, 'hidden'):
66 % if commit.hidden:
68 % if commit.hidden:
67 <span class="tag obsolete-${commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
69 <span class="tag obsolete-${commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
68 % endif
70 % endif
69 % endif
71 % endif
70
72
71 </code>
73 </code>
72 </td>
74 </td>
73 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_('Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
75 <td class="td-message expand_commit" data-commit-id="${commit.raw_id}" title="${_('Expand commit message')}" onclick="commitsController.expandCommit(this); return false">
74 <div class="show_more_col">
76 <div class="show_more_col">
75 <i class="show_more"></i>&nbsp;
77 <i class="show_more"></i>&nbsp;
76 </div>
78 </div>
77 </td>
79 </td>
78 <td class="td-description mid">
80 <td class="td-description mid">
79 <div class="log-container truncate-wrap">
81 <div class="log-container truncate-wrap">
80 <div class="message truncate" id="c-${commit.raw_id}">${h.urlify_commit_message(commit.message, c.repo_name)}</div>
82 <div class="message truncate" id="c-${commit.raw_id}">${h.urlify_commit_message(commit.message, c.repo_name)}</div>
81 </div>
83 </div>
82 </td>
84 </td>
83
85
84 <td class="td-time">
86 <td class="td-time">
85 ${h.age_component(commit.date)}
87 ${h.age_component(commit.date)}
86 </td>
88 </td>
87 <td class="td-user">
89 <td class="td-user">
88 ${base.gravatar_with_user(commit.author)}
90 ${base.gravatar_with_user(commit.author)}
89 </td>
91 </td>
90
92
91 <td class="td-tags tags-col">
93 <td class="td-tags tags-col">
92 <div id="t-${commit.raw_id}">
94 <div id="t-${commit.raw_id}">
93
95
94 ## merge
96 ## merge
95 %if commit.merge:
97 %if commit.merge:
96 <span class="tag mergetag">
98 <span class="tag mergetag">
97 <i class="icon-merge"></i>${_('merge')}
99 <i class="icon-merge"></i>${_('merge')}
98 </span>
100 </span>
99 %endif
101 %endif
100
102
101 ## branch
103 ## branch
102 %if commit.branch:
104 %if commit.branch:
103 <span class="tag branchtag" title="${h.tooltip(_('Branch %s') % commit.branch)}">
105 <span class="tag branchtag" title="${h.tooltip(_('Branch %s') % commit.branch)}">
104 <a href="${h.route_path('repo_changelog',repo_name=c.repo_name,_query=dict(branch=commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(commit.branch)}</a>
106 <a href="${h.route_path('repo_changelog',repo_name=c.repo_name,_query=dict(branch=commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(commit.branch)}</a>
105 </span>
107 </span>
106 %endif
108 %endif
107
109
108 ## bookmarks
110 ## bookmarks
109 %if h.is_hg(c.rhodecode_repo):
111 %if h.is_hg(c.rhodecode_repo):
110 %for book in commit.bookmarks:
112 %for book in commit.bookmarks:
111 <span class="tag booktag" title="${h.tooltip(_('Bookmark %s') % book)}">
113 <span class="tag booktag" title="${h.tooltip(_('Bookmark %s') % book)}">
112 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id, _query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
114 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id, _query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
113 </span>
115 </span>
114 %endfor
116 %endfor
115 %endif
117 %endif
116
118
117 ## tags
119 ## tags
118 %for tag in commit.tags:
120 %for tag in commit.tags:
119 <span class="tag tagtag" title="${h.tooltip(_('Tag %s') % tag)}">
121 <span class="tag tagtag" title="${h.tooltip(_('Tag %s') % tag)}">
120 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id, _query=dict(at=tag))}"><i class="icon-tag"></i>${h.shorter(tag)}</a>
122 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=commit.raw_id, _query=dict(at=tag))}"><i class="icon-tag"></i>${h.shorter(tag)}</a>
121 </span>
123 </span>
122 %endfor
124 %endfor
123
125
124 </div>
126 </div>
125 </td>
127 </td>
126 </tr>
128 </tr>
127 % endfor
129 % endfor
128
130
129 % if c.next_page:
131 % if c.next_page:
130 <tr>
132 <tr>
131 <td colspan="9" class="load-more-commits">
133 <td colspan="9" class="load-more-commits">
132 <a class="next-commits" href="#loadNextCommits" onclick="commitsController.loadNext(this, ${c.next_page}, '${c.branch_name}');return false">
134 <a class="next-commits" href="#loadNextCommits" onclick="commitsController.loadNext(this, ${c.next_page}, '${c.branch_name}');return false">
133 ${_('load next')}
135 ${_('load next')}
134 </a>
136 </a>
135 </td>
137 </td>
136 </tr>
138 </tr>
137 % endif
139 % endif
138 <tr class="chunk-graph-data" style="display:none"
140 <tr class="chunk-graph-data" style="display:none"
139 data-graph='${c.graph_data|n}'
141 data-graph='${c.graph_data|n}'
140 data-node='${c.prev_page}:${c.next_page}'
142 data-node='${c.prev_page}:${c.next_page}'
141 data-commits='${c.graph_commits|n}'>
143 data-commits='${c.graph_commits|n}'>
142 </tr> No newline at end of file
144 </tr>
@@ -1,351 +1,352 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2
2
3 <%inherit file="/base/base.mako"/>
3 <%inherit file="/base/base.mako"/>
4 <%namespace name="diff_block" file="/changeset/diff_block.mako"/>
4 <%namespace name="diff_block" file="/changeset/diff_block.mako"/>
5
5
6 <%def name="title()">
6 <%def name="title()">
7 ${_('%s Commit') % c.repo_name} - ${h.show_id(c.commit)}
7 ${_('%s Commit') % c.repo_name} - ${h.show_id(c.commit)}
8 %if c.rhodecode_name:
8 %if c.rhodecode_name:
9 &middot; ${h.branding(c.rhodecode_name)}
9 &middot; ${h.branding(c.rhodecode_name)}
10 %endif
10 %endif
11 </%def>
11 </%def>
12
12
13 <%def name="menu_bar_nav()">
13 <%def name="menu_bar_nav()">
14 ${self.menu_items(active='repositories')}
14 ${self.menu_items(active='repositories')}
15 </%def>
15 </%def>
16
16
17 <%def name="menu_bar_subnav()">
17 <%def name="menu_bar_subnav()">
18 ${self.repo_menu(active='changelog')}
18 ${self.repo_menu(active='changelog')}
19 </%def>
19 </%def>
20
20
21 <%def name="main()">
21 <%def name="main()">
22 <script>
22 <script>
23 // TODO: marcink switch this to pyroutes
23 // TODO: marcink switch this to pyroutes
24 AJAX_COMMENT_DELETE_URL = "${h.url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
24 AJAX_COMMENT_DELETE_URL = "${h.url('changeset_comment_delete',repo_name=c.repo_name,comment_id='__COMMENT_ID__')}";
25 templateContext.commit_data.commit_id = "${c.commit.raw_id}";
25 templateContext.commit_data.commit_id = "${c.commit.raw_id}";
26 </script>
26 </script>
27 <div class="box">
27 <div class="box">
28 <div class="title">
28 <div class="title">
29 ${self.repo_page_title(c.rhodecode_db_repo)}
29 ${self.repo_page_title(c.rhodecode_db_repo)}
30 </div>
30 </div>
31
31
32 <div id="changeset_compare_view_content" class="summary changeset">
32 <div id="changeset_compare_view_content" class="summary changeset">
33 <div class="summary-detail">
33 <div class="summary-detail">
34 <div class="summary-detail-header">
34 <div class="summary-detail-header">
35 <span class="breadcrumbs files_location">
35 <span class="breadcrumbs files_location">
36 <h4>${_('Commit')}
36 <h4>${_('Commit')}
37 <code>
37 <code>
38 <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.commit.raw_id}" title="${_('Copy the full commit id')}"></i>
38 ${h.show_id(c.commit)}
39 ${h.show_id(c.commit)}
39 % if hasattr(c.commit, 'phase'):
40 % if hasattr(c.commit, 'phase'):
40 <span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">${c.commit.phase}</span>
41 <span class="tag phase-${c.commit.phase} tooltip" title="${_('Commit phase')}">${c.commit.phase}</span>
41 % endif
42 % endif
42
43
43 ## obsolete commits
44 ## obsolete commits
44 % if hasattr(c.commit, 'obsolete'):
45 % if hasattr(c.commit, 'obsolete'):
45 % if c.commit.obsolete:
46 % if c.commit.obsolete:
46 <span class="tag obsolete-${c.commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
47 <span class="tag obsolete-${c.commit.obsolete} tooltip" title="${_('Evolve State')}">${_('obsolete')}</span>
47 % endif
48 % endif
48 % endif
49 % endif
49
50
50 ## hidden commits
51 ## hidden commits
51 % if hasattr(c.commit, 'hidden'):
52 % if hasattr(c.commit, 'hidden'):
52 % if c.commit.hidden:
53 % if c.commit.hidden:
53 <span class="tag hidden-${c.commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
54 <span class="tag hidden-${c.commit.hidden} tooltip" title="${_('Evolve State')}">${_('hidden')}</span>
54 % endif
55 % endif
55 % endif
56 % endif
56
57
57 </code>
58 </code>
58 </h4>
59 </h4>
59 </span>
60 </span>
60 <div class="pull-right">
61 <div class="pull-right">
61 <span id="parent_link">
62 <span id="parent_link">
62 <a href="#" title="${_('Parent Commit')}">${_('Parent')}</a>
63 <a href="#" title="${_('Parent Commit')}">${_('Parent')}</a>
63 </span>
64 </span>
64 |
65 |
65 <span id="child_link">
66 <span id="child_link">
66 <a href="#" title="${_('Child Commit')}">${_('Child')}</a>
67 <a href="#" title="${_('Child Commit')}">${_('Child')}</a>
67 </span>
68 </span>
68 </div>
69 </div>
69 </div>
70 </div>
70
71
71 <div class="fieldset">
72 <div class="fieldset">
72 <div class="left-label">
73 <div class="left-label">
73 ${_('Description')}:
74 ${_('Description')}:
74 </div>
75 </div>
75 <div class="right-content">
76 <div class="right-content">
76 <div id="trimmed_message_box" class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div>
77 <div id="trimmed_message_box" class="commit">${h.urlify_commit_message(c.commit.message,c.repo_name)}</div>
77 <div id="message_expand" style="display:none;">
78 <div id="message_expand" style="display:none;">
78 ${_('Expand')}
79 ${_('Expand')}
79 </div>
80 </div>
80 </div>
81 </div>
81 </div>
82 </div>
82
83
83 %if c.statuses:
84 %if c.statuses:
84 <div class="fieldset">
85 <div class="fieldset">
85 <div class="left-label">
86 <div class="left-label">
86 ${_('Commit status')}:
87 ${_('Commit status')}:
87 </div>
88 </div>
88 <div class="right-content">
89 <div class="right-content">
89 <div class="changeset-status-ico">
90 <div class="changeset-status-ico">
90 <div class="${'flag_status %s' % c.statuses[0]} pull-left"></div>
91 <div class="${'flag_status %s' % c.statuses[0]} pull-left"></div>
91 </div>
92 </div>
92 <div title="${_('Commit status')}" class="changeset-status-lbl">[${h.commit_status_lbl(c.statuses[0])}]</div>
93 <div title="${_('Commit status')}" class="changeset-status-lbl">[${h.commit_status_lbl(c.statuses[0])}]</div>
93 </div>
94 </div>
94 </div>
95 </div>
95 %endif
96 %endif
96
97
97 <div class="fieldset">
98 <div class="fieldset">
98 <div class="left-label">
99 <div class="left-label">
99 ${_('References')}:
100 ${_('References')}:
100 </div>
101 </div>
101 <div class="right-content">
102 <div class="right-content">
102 <div class="tags">
103 <div class="tags">
103
104
104 %if c.commit.merge:
105 %if c.commit.merge:
105 <span class="mergetag tag">
106 <span class="mergetag tag">
106 <i class="icon-merge"></i>${_('merge')}
107 <i class="icon-merge"></i>${_('merge')}
107 </span>
108 </span>
108 %endif
109 %endif
109
110
110 %if h.is_hg(c.rhodecode_repo):
111 %if h.is_hg(c.rhodecode_repo):
111 %for book in c.commit.bookmarks:
112 %for book in c.commit.bookmarks:
112 <span class="booktag tag" title="${h.tooltip(_('Bookmark %s') % book)}">
113 <span class="booktag tag" title="${h.tooltip(_('Bookmark %s') % book)}">
113 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
114 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=book))}"><i class="icon-bookmark"></i>${h.shorter(book)}</a>
114 </span>
115 </span>
115 %endfor
116 %endfor
116 %endif
117 %endif
117
118
118 %for tag in c.commit.tags:
119 %for tag in c.commit.tags:
119 <span class="tagtag tag" title="${h.tooltip(_('Tag %s') % tag)}">
120 <span class="tagtag tag" title="${h.tooltip(_('Tag %s') % tag)}">
120 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=tag))}"><i class="icon-tag"></i>${tag}</a>
121 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=tag))}"><i class="icon-tag"></i>${tag}</a>
121 </span>
122 </span>
122 %endfor
123 %endfor
123
124
124 %if c.commit.branch:
125 %if c.commit.branch:
125 <span class="branchtag tag" title="${h.tooltip(_('Branch %s') % c.commit.branch)}">
126 <span class="branchtag tag" title="${h.tooltip(_('Branch %s') % c.commit.branch)}">
126 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=c.commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(c.commit.branch)}</a>
127 <a href="${h.route_path('repo_files:default_path',repo_name=c.repo_name,commit_id=c.commit.raw_id,_query=dict(at=c.commit.branch))}"><i class="icon-code-fork"></i>${h.shorter(c.commit.branch)}</a>
127 </span>
128 </span>
128 %endif
129 %endif
129 </div>
130 </div>
130 </div>
131 </div>
131 </div>
132 </div>
132
133
133 <div class="fieldset">
134 <div class="fieldset">
134 <div class="left-label">
135 <div class="left-label">
135 ${_('Diff options')}:
136 ${_('Diff options')}:
136 </div>
137 </div>
137 <div class="right-content">
138 <div class="right-content">
138 <div class="diff-actions">
139 <div class="diff-actions">
139 <a href="${h.url('changeset_raw_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
140 <a href="${h.url('changeset_raw_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Raw diff'))}">
140 ${_('Raw Diff')}
141 ${_('Raw Diff')}
141 </a>
142 </a>
142 |
143 |
143 <a href="${h.url('changeset_patch_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Patch diff'))}">
144 <a href="${h.url('changeset_patch_home',repo_name=c.repo_name,revision=c.commit.raw_id)}" class="tooltip" title="${h.tooltip(_('Patch diff'))}">
144 ${_('Patch Diff')}
145 ${_('Patch Diff')}
145 </a>
146 </a>
146 |
147 |
147 <a href="${h.url('changeset_download_home',repo_name=c.repo_name,revision=c.commit.raw_id,diff='download')}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
148 <a href="${h.url('changeset_download_home',repo_name=c.repo_name,revision=c.commit.raw_id,diff='download')}" class="tooltip" title="${h.tooltip(_('Download diff'))}">
148 ${_('Download Diff')}
149 ${_('Download Diff')}
149 </a>
150 </a>
150 |
151 |
151 ${c.ignorews_url(request.GET)}
152 ${c.ignorews_url(request.GET)}
152 |
153 |
153 ${c.context_url(request.GET)}
154 ${c.context_url(request.GET)}
154 </div>
155 </div>
155 </div>
156 </div>
156 </div>
157 </div>
157
158
158 <div class="fieldset">
159 <div class="fieldset">
159 <div class="left-label">
160 <div class="left-label">
160 ${_('Comments')}:
161 ${_('Comments')}:
161 </div>
162 </div>
162 <div class="right-content">
163 <div class="right-content">
163 <div class="comments-number">
164 <div class="comments-number">
164 %if c.comments:
165 %if c.comments:
165 <a href="#comments">${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}</a>,
166 <a href="#comments">${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}</a>,
166 %else:
167 %else:
167 ${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}
168 ${ungettext("%d Commit comment", "%d Commit comments", len(c.comments)) % len(c.comments)}
168 %endif
169 %endif
169 %if c.inline_cnt:
170 %if c.inline_cnt:
170 <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a>
171 <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}</a>
171 %else:
172 %else:
172 ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}
173 ${ungettext("%d Inline Comment", "%d Inline Comments", c.inline_cnt) % c.inline_cnt}
173 %endif
174 %endif
174 </div>
175 </div>
175 </div>
176 </div>
176 </div>
177 </div>
177
178
178 <div class="fieldset">
179 <div class="fieldset">
179 <div class="left-label">
180 <div class="left-label">
180 ${_('Unresolved TODOs')}:
181 ${_('Unresolved TODOs')}:
181 </div>
182 </div>
182 <div class="right-content">
183 <div class="right-content">
183 <div class="comments-number">
184 <div class="comments-number">
184 % if c.unresolved_comments:
185 % if c.unresolved_comments:
185 % for co in c.unresolved_comments:
186 % for co in c.unresolved_comments:
186 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','}
187 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'))"> #${co.comment_id}</a>${'' if loop.last else ','}
187 % endfor
188 % endfor
188 % else:
189 % else:
189 ${_('There are no unresolved TODOs')}
190 ${_('There are no unresolved TODOs')}
190 % endif
191 % endif
191 </div>
192 </div>
192 </div>
193 </div>
193 </div>
194 </div>
194
195
195 </div> <!-- end summary-detail -->
196 </div> <!-- end summary-detail -->
196
197
197 <div id="commit-stats" class="sidebar-right">
198 <div id="commit-stats" class="sidebar-right">
198 <div class="summary-detail-header">
199 <div class="summary-detail-header">
199 <h4 class="item">
200 <h4 class="item">
200 ${_('Author')}
201 ${_('Author')}
201 </h4>
202 </h4>
202 </div>
203 </div>
203 <div class="sidebar-right-content">
204 <div class="sidebar-right-content">
204 ${self.gravatar_with_user(c.commit.author)}
205 ${self.gravatar_with_user(c.commit.author)}
205 <div class="user-inline-data">- ${h.age_component(c.commit.date)}</div>
206 <div class="user-inline-data">- ${h.age_component(c.commit.date)}</div>
206 </div>
207 </div>
207 </div><!-- end sidebar -->
208 </div><!-- end sidebar -->
208 </div> <!-- end summary -->
209 </div> <!-- end summary -->
209 <div class="cs_files">
210 <div class="cs_files">
210 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
211 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
211 ${cbdiffs.render_diffset_menu()}
212 ${cbdiffs.render_diffset_menu()}
212 ${cbdiffs.render_diffset(
213 ${cbdiffs.render_diffset(
213 c.changes[c.commit.raw_id], commit=c.commit, use_comments=True)}
214 c.changes[c.commit.raw_id], commit=c.commit, use_comments=True)}
214 </div>
215 </div>
215
216
216 ## template for inline comment form
217 ## template for inline comment form
217 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
218 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
218
219
219 ## render comments
220 ## render comments
220 ${comment.generate_comments(c.comments)}
221 ${comment.generate_comments(c.comments)}
221
222
222 ## main comment form and it status
223 ## main comment form and it status
223 ${comment.comments(h.url('changeset_comment', repo_name=c.repo_name, revision=c.commit.raw_id),
224 ${comment.comments(h.url('changeset_comment', repo_name=c.repo_name, revision=c.commit.raw_id),
224 h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))}
225 h.commit_status(c.rhodecode_db_repo, c.commit.raw_id))}
225 </div>
226 </div>
226
227
227 ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
228 ## FORM FOR MAKING JS ACTION AS CHANGESET COMMENTS
228 <script type="text/javascript">
229 <script type="text/javascript">
229
230
230 $(document).ready(function() {
231 $(document).ready(function() {
231
232
232 var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10);
233 var boxmax = parseInt($('#trimmed_message_box').css('max-height'), 10);
233 if($('#trimmed_message_box').height() === boxmax){
234 if($('#trimmed_message_box').height() === boxmax){
234 $('#message_expand').show();
235 $('#message_expand').show();
235 }
236 }
236
237
237 $('#message_expand').on('click', function(e){
238 $('#message_expand').on('click', function(e){
238 $('#trimmed_message_box').css('max-height', 'none');
239 $('#trimmed_message_box').css('max-height', 'none');
239 $(this).hide();
240 $(this).hide();
240 });
241 });
241
242
242 $('.show-inline-comments').on('click', function(e){
243 $('.show-inline-comments').on('click', function(e){
243 var boxid = $(this).attr('data-comment-id');
244 var boxid = $(this).attr('data-comment-id');
244 var button = $(this);
245 var button = $(this);
245
246
246 if(button.hasClass("comments-visible")) {
247 if(button.hasClass("comments-visible")) {
247 $('#{0} .inline-comments'.format(boxid)).each(function(index){
248 $('#{0} .inline-comments'.format(boxid)).each(function(index){
248 $(this).hide();
249 $(this).hide();
249 });
250 });
250 button.removeClass("comments-visible");
251 button.removeClass("comments-visible");
251 } else {
252 } else {
252 $('#{0} .inline-comments'.format(boxid)).each(function(index){
253 $('#{0} .inline-comments'.format(boxid)).each(function(index){
253 $(this).show();
254 $(this).show();
254 });
255 });
255 button.addClass("comments-visible");
256 button.addClass("comments-visible");
256 }
257 }
257 });
258 });
258
259
259
260
260 // next links
261 // next links
261 $('#child_link').on('click', function(e){
262 $('#child_link').on('click', function(e){
262 // fetch via ajax what is going to be the next link, if we have
263 // fetch via ajax what is going to be the next link, if we have
263 // >1 links show them to user to choose
264 // >1 links show them to user to choose
264 if(!$('#child_link').hasClass('disabled')){
265 if(!$('#child_link').hasClass('disabled')){
265 $.ajax({
266 $.ajax({
266 url: '${h.url('changeset_children',repo_name=c.repo_name, revision=c.commit.raw_id)}',
267 url: '${h.url('changeset_children',repo_name=c.repo_name, revision=c.commit.raw_id)}',
267 success: function(data) {
268 success: function(data) {
268 if(data.results.length === 0){
269 if(data.results.length === 0){
269 $('#child_link').html("${_('No Child Commits')}").addClass('disabled');
270 $('#child_link').html("${_('No Child Commits')}").addClass('disabled');
270 }
271 }
271 if(data.results.length === 1){
272 if(data.results.length === 1){
272 var commit = data.results[0];
273 var commit = data.results[0];
273 window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id});
274 window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id});
274 }
275 }
275 else if(data.results.length === 2){
276 else if(data.results.length === 2){
276 $('#child_link').addClass('disabled');
277 $('#child_link').addClass('disabled');
277 $('#child_link').addClass('double');
278 $('#child_link').addClass('double');
278 var _html = '';
279 var _html = '';
279 _html +='<a title="__title__" href="__url__">__rev__</a> '
280 _html +='<a title="__title__" href="__url__">__rev__</a> '
280 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
281 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
281 .replace('__title__', data.results[0].message)
282 .replace('__title__', data.results[0].message)
282 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id}));
283 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id}));
283 _html +=' | ';
284 _html +=' | ';
284 _html +='<a title="__title__" href="__url__">__rev__</a> '
285 _html +='<a title="__title__" href="__url__">__rev__</a> '
285 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
286 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
286 .replace('__title__', data.results[1].message)
287 .replace('__title__', data.results[1].message)
287 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id}));
288 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id}));
288 $('#child_link').html(_html);
289 $('#child_link').html(_html);
289 }
290 }
290 }
291 }
291 });
292 });
292 e.preventDefault();
293 e.preventDefault();
293 }
294 }
294 });
295 });
295
296
296 // prev links
297 // prev links
297 $('#parent_link').on('click', function(e){
298 $('#parent_link').on('click', function(e){
298 // fetch via ajax what is going to be the next link, if we have
299 // fetch via ajax what is going to be the next link, if we have
299 // >1 links show them to user to choose
300 // >1 links show them to user to choose
300 if(!$('#parent_link').hasClass('disabled')){
301 if(!$('#parent_link').hasClass('disabled')){
301 $.ajax({
302 $.ajax({
302 url: '${h.url("changeset_parents",repo_name=c.repo_name, revision=c.commit.raw_id)}',
303 url: '${h.url("changeset_parents",repo_name=c.repo_name, revision=c.commit.raw_id)}',
303 success: function(data) {
304 success: function(data) {
304 if(data.results.length === 0){
305 if(data.results.length === 0){
305 $('#parent_link').html('${_('No Parent Commits')}').addClass('disabled');
306 $('#parent_link').html('${_('No Parent Commits')}').addClass('disabled');
306 }
307 }
307 if(data.results.length === 1){
308 if(data.results.length === 1){
308 var commit = data.results[0];
309 var commit = data.results[0];
309 window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id});
310 window.location = pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': commit.raw_id});
310 }
311 }
311 else if(data.results.length === 2){
312 else if(data.results.length === 2){
312 $('#parent_link').addClass('disabled');
313 $('#parent_link').addClass('disabled');
313 $('#parent_link').addClass('double');
314 $('#parent_link').addClass('double');
314 var _html = '';
315 var _html = '';
315 _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
316 _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
316 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
317 .replace('__rev__','r{0}:{1}'.format(data.results[0].revision, data.results[0].raw_id.substr(0,6)))
317 .replace('__title__', data.results[0].message)
318 .replace('__title__', data.results[0].message)
318 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id}));
319 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[0].raw_id}));
319 _html +=' | ';
320 _html +=' | ';
320 _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
321 _html +='<a title="__title__" href="__url__">Parent __rev__</a>'
321 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
322 .replace('__rev__','r{0}:{1}'.format(data.results[1].revision, data.results[1].raw_id.substr(0,6)))
322 .replace('__title__', data.results[1].message)
323 .replace('__title__', data.results[1].message)
323 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id}));
324 .replace('__url__', pyroutes.url('changeset_home', {'repo_name': '${c.repo_name}','revision': data.results[1].raw_id}));
324 $('#parent_link').html(_html);
325 $('#parent_link').html(_html);
325 }
326 }
326 }
327 }
327 });
328 });
328 e.preventDefault();
329 e.preventDefault();
329 }
330 }
330 });
331 });
331
332
332 if (location.hash) {
333 if (location.hash) {
333 var result = splitDelimitedHash(location.hash);
334 var result = splitDelimitedHash(location.hash);
334 var line = $('html').find(result.loc);
335 var line = $('html').find(result.loc);
335 if (line.length > 0){
336 if (line.length > 0){
336 offsetScroll(line, 70);
337 offsetScroll(line, 70);
337 }
338 }
338 }
339 }
339
340
340 // browse tree @ revision
341 // browse tree @ revision
341 $('#files_link').on('click', function(e){
342 $('#files_link').on('click', function(e){
342 window.location = '${h.route_path('repo_files:default_path',repo_name=c.repo_name, commit_id=c.commit.raw_id)}';
343 window.location = '${h.route_path('repo_files:default_path',repo_name=c.repo_name, commit_id=c.commit.raw_id)}';
343 e.preventDefault();
344 e.preventDefault();
344 });
345 });
345
346
346 // inject comments into their proper positions
347 // inject comments into their proper positions
347 var file_comments = $('.inline-comment-placeholder');
348 var file_comments = $('.inline-comment-placeholder');
348 })
349 })
349 </script>
350 </script>
350
351
351 </%def>
352 </%def>
@@ -1,92 +1,93 b''
1 <%namespace name="sourceblock" file="/codeblocks/source.mako"/>
1 <%namespace name="sourceblock" file="/codeblocks/source.mako"/>
2
2
3 <div id="codeblock" class="codeblock">
3 <div id="codeblock" class="codeblock">
4 <div class="codeblock-header">
4 <div class="codeblock-header">
5 <div class="stats">
5 <div class="stats">
6 <span> <strong>${c.file}</strong></span>
6 <span> <strong>${c.file}</strong></span>
7 % if c.lf_node:
7 % if c.lf_node:
8 <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span>
8 <span title="${_('This file is a pointer to large binary file')}"> | ${_('LargeFile')} ${h.format_byte_size_binary(c.lf_node.size)} </span>
9 % endif
9 % endif
10 <span> | ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])}</span>
10 <span> | ${c.file.lines()[0]} ${_ungettext('line', 'lines', c.file.lines()[0])}</span>
11 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
11 <span> | ${h.format_byte_size_binary(c.file.size)}</span>
12 <span> | ${c.file.mimetype} </span>
12 <span> | ${c.file.mimetype} </span>
13 <span class="item last"> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
13 <span> | ${h.get_lexer_for_filenode(c.file).__class__.__name__}</span>
14 <span class="item last"> | <i class="tooltip icon-clipboard clipboard-action" data-clipboard-text="${c.file.path}" title="${_('Copy the full path')}"></i></span>
14 </div>
15 </div>
15 <div class="buttons">
16 <div class="buttons">
16 <a id="file_history_overview" href="#">
17 <a id="file_history_overview" href="#">
17 ${_('History')}
18 ${_('History')}
18 </a>
19 </a>
19 <a id="file_history_overview_full" style="display: none" href="${h.route_path('repo_changelog_file',repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">
20 <a id="file_history_overview_full" style="display: none" href="${h.route_path('repo_changelog_file',repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">
20 ${_('Show Full History')}
21 ${_('Show Full History')}
21 </a> |
22 </a> |
22 %if c.annotate:
23 %if c.annotate:
23 ${h.link_to(_('Source'), h.route_path('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
24 ${h.link_to(_('Source'), h.route_path('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
24 %else:
25 %else:
25 ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
26 ${h.link_to(_('Annotation'), h.route_path('repo_files:annotated',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
26 %endif
27 %endif
27 | ${h.link_to(_('Raw'), h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
28 | ${h.link_to(_('Raw'), h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
28 |
29 |
29 % if c.lf_node:
30 % if c.lf_node:
30 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _query=dict(lf=1))}">
31 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path, _query=dict(lf=1))}">
31 ${_('Download largefile')}
32 ${_('Download largefile')}
32 </a>
33 </a>
33 % else:
34 % else:
34 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
35 <a href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
35 ${_('Download')}
36 ${_('Download')}
36 </a>
37 </a>
37 % endif
38 % endif
38
39
39 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
40 %if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
40 |
41 |
41 %if c.on_branch_head and c.branch_or_raw_id and not c.file.is_binary:
42 %if c.on_branch_head and c.branch_or_raw_id and not c.file.is_binary:
42 <a href="${h.route_path('repo_files_edit_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">
43 <a href="${h.route_path('repo_files_edit_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">
43 ${_('Edit on Branch:{}').format(c.branch_name)}
44 ${_('Edit on Branch:{}').format(c.branch_name)}
44 </a>
45 </a>
45 | <a class="btn-danger btn-link" href="${h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">${_('Delete')}
46 | <a class="btn-danger btn-link" href="${h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit')}">${_('Delete')}
46 </a>
47 </a>
47 %elif c.on_branch_head and c.branch_or_raw_id and c.file.is_binary:
48 %elif c.on_branch_head and c.branch_or_raw_id and c.file.is_binary:
48 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing binary files not allowed'))}
49 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing binary files not allowed'))}
49 | ${h.link_to(_('Delete'), h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit'),class_="btn-danger btn-link")}
50 | ${h.link_to(_('Delete'), h.route_path('repo_files_remove_file',repo_name=c.repo_name,commit_id=c.branch_or_raw_id,f_path=c.f_path, _anchor='edit'),class_="btn-danger btn-link")}
50 %else:
51 %else:
51 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing files allowed only when on branch head commit'))}
52 ${h.link_to(_('Edit'), '#', class_="btn btn-link disabled tooltip", title=_('Editing files allowed only when on branch head commit'))}
52 | ${h.link_to(_('Delete'), '#', class_="btn btn-danger btn-link disabled tooltip", title=_('Deleting files allowed only when on branch head commit'))}
53 | ${h.link_to(_('Delete'), '#', class_="btn btn-danger btn-link disabled tooltip", title=_('Deleting files allowed only when on branch head commit'))}
53 %endif
54 %endif
54 %endif
55 %endif
55 </div>
56 </div>
56 </div>
57 </div>
57 <div id="file_history_container"></div>
58 <div id="file_history_container"></div>
58 <div class="code-body">
59 <div class="code-body">
59 %if c.file.is_binary:
60 %if c.file.is_binary:
60 <% rendered_binary = h.render_binary(c.repo_name, c.file)%>
61 <% rendered_binary = h.render_binary(c.repo_name, c.file)%>
61 % if rendered_binary:
62 % if rendered_binary:
62 ${rendered_binary}
63 ${rendered_binary}
63 % else:
64 % else:
64 <div>
65 <div>
65 ${_('Binary file (%s)') % c.file.mimetype}
66 ${_('Binary file (%s)') % c.file.mimetype}
66 </div>
67 </div>
67 % endif
68 % endif
68 %else:
69 %else:
69 % if c.file.size < c.visual.cut_off_limit_file:
70 % if c.file.size < c.visual.cut_off_limit_file:
70 %if c.renderer and not c.annotate:
71 %if c.renderer and not c.annotate:
71 ${h.render(c.file.content, renderer=c.renderer, relative_url=h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
72 ${h.render(c.file.content, renderer=c.renderer, relative_url=h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
72 %else:
73 %else:
73 <table class="cb codehilite">
74 <table class="cb codehilite">
74 %if c.annotate:
75 %if c.annotate:
75 <% color_hasher = h.color_hasher() %>
76 <% color_hasher = h.color_hasher() %>
76 %for annotation, lines in c.annotated_lines:
77 %for annotation, lines in c.annotated_lines:
77 ${sourceblock.render_annotation_lines(annotation, lines, color_hasher)}
78 ${sourceblock.render_annotation_lines(annotation, lines, color_hasher)}
78 %endfor
79 %endfor
79 %else:
80 %else:
80 %for line_num, tokens in enumerate(c.lines, 1):
81 %for line_num, tokens in enumerate(c.lines, 1):
81 ${sourceblock.render_line(line_num, tokens)}
82 ${sourceblock.render_line(line_num, tokens)}
82 %endfor
83 %endfor
83 %endif
84 %endif
84 </table>
85 </table>
85 %endif
86 %endif
86 %else:
87 %else:
87 ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'),
88 ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'),
88 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
89 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
89 %endif
90 %endif
90 %endif
91 %endif
91 </div>
92 </div>
92 </div> No newline at end of file
93 </div>
General Comments 0
You need to be logged in to leave comments. Login now