##// END OF EJS Templates
commits: new commits page based on new UI
dan -
r3758:a0fb39a1 new-ui
parent child Browse files
Show More
@@ -960,9 +960,6 b' label {'
960 960 }
961 961
962 962
963 #graph_nodes {
964 padding-top: 43px;
965 }
966 963
967 964 #graph_content{
968 965
@@ -995,13 +992,12 b' label {'
995 992 }
996 993
997 994 .graph-col-wrapper {
998 padding-left: 110px;
999 995
1000 996 #graph_nodes {
1001 997 width: 100px;
1002 margin-left: -110px;
1003 float: left;
1004 clear: left;
998 position: absolute;
999 left: 120px;
1000 z-index: -1;
1005 1001 }
1006 1002 }
1007 1003
@@ -1018,6 +1014,16 b' label {'
1018 1014 }
1019 1015 }
1020 1016
1017 .obsolete-toggle {
1018 line-height: 30px;
1019 margin-left: -15px;
1020 }
1021
1022 #rev_range_container, #rev_range_clear, #rev_range_more {
1023 margin-top: -5px;
1024 margin-bottom: -5px;
1025 }
1026
1021 1027 #filter_changelog {
1022 1028 float: left;
1023 1029 }
@@ -621,14 +621,6 b' ul#context-pages {'
621 621 font-family: @text-regular;
622 622 color: @grey1;
623 623
624 &#graph_nodes {
625 clear:both;
626 width: auto;
627 margin-left: -100px;
628 padding: 0;
629 border: none;
630 }
631
632 624 .nav-pills {
633 625 margin: 0;
634 626 }
@@ -118,6 +118,10 b' table.dataTable {'
118 118 }
119 119 }
120 120
121 &.td-graphbox {
122 width: 140px;
123 }
124
121 125 &.td-time {
122 126 width: 160px;
123 127 white-space: nowrap;
@@ -46,6 +46,8 b' var CommitsController = function () {'
46 46 self.$graphCanvas.html('');
47 47
48 48 var edgeData = $("[data-graph]").data('graph') || this.$graphCanvas.data('graph') || [];
49 var prev_link = $('.load-more-commits').find('.prev-commits').get(0);
50 var next_link = $('.load-more-commits').find('.next-commits').get(0);
49 51
50 52 // Determine max number of edges per row in graph
51 53 var edgeCount = 1;
@@ -57,10 +59,20 b' var CommitsController = function () {'
57 59 });
58 60 });
59 61
62 if (prev_link && next_link) {
63 var graph_padding = -64;
64 }
65 else if (next_link) {
66 var graph_padding = -32;
67 } else {
68 var graph_padding = 0;
69 }
70
60 71 var x_step = Math.min(10, Math.floor(86 / edgeCount));
72 var height = $('#changesets').find('.commits-range').height() + graph_padding;
61 73 var graph_options = {
62 74 width: 100,
63 height: $('#changesets').find('.commits-range').height(),
75 height: height,
64 76 x_step: x_step,
65 77 y_step: 42,
66 78 dotRadius: 3.5,
@@ -85,11 +97,11 b' var CommitsController = function () {'
85 97 this.$graphCanvas.commits(graph_options);
86 98
87 99 this.setLabelText(edgeData);
88 if ($('.load-more-commits').find('.prev-commits').get(0)) {
89 var padding = 75;
90 100
91 } else {
92 var padding = 43;
101 var padding = 98;
102 if (prev_link) {
103 padding += 32;
104
93 105 }
94 106 $('#graph_nodes').css({'padding-top': padding});
95 107 };
@@ -29,10 +29,30 b''
29 29 <%def name="main()">
30 30
31 31 <div class="box">
32
32 33 <div class="title">
34 <div id="filter_changelog">
35 ${h.hidden('branch_filter')}
36 %if c.selected_name:
37 <div class="btn btn-default" id="clear_filter" >
38 ${_('Clear filter')}
39 </div>
40 %endif
41 </div>
42 <div class="pull-left obsolete-toggle">
43 % if h.is_hg(c.rhodecode_repo):
44 % if c.show_hidden:
45 <a class="action-link" href="${h.current_route_path(request, evolve=0)}">${_('Hide obsolete/hidden')}</a>
46 % else:
47 <a class="action-link" href="${h.current_route_path(request, evolve=1)}">${_('Show obsolete/hidden')}</a>
48 % endif
49 % else:
50 <span class="action-link disabled">${_('Show hidden')}</span>
51 % endif
52 </div>
33 53 <ul class="links">
34 54 <li>
35 <a href="#" class="btn btn-small" id="rev_range_container" style="display:none;"></a>
55
36 56 %if c.rhodecode_db_repo.fork:
37 57 <span>
38 58 <a id="compare_fork_button"
@@ -60,11 +80,6 b''
60 80 </span>
61 81 %endif
62 82
63 ## clear selection
64 <div title="${_('Clear selection')}" class="btn" id="rev_range_clear" style="display:none">
65 ${_('Clear selection')}
66 </div>
67
68 83 </li>
69 84 </ul>
70 85 </div>
@@ -73,29 +88,7 b''
73 88 <script type="text/javascript" src="${h.asset('js/src/plugins/jquery.commits-graph.js')}"></script>
74 89
75 90 <div class="graph-header">
76 <div id="filter_changelog">
77 ${h.hidden('branch_filter')}
78 %if c.selected_name:
79 <div class="btn btn-default" id="clear_filter" >
80 ${_('Clear filter')}
81 </div>
82 %endif
83 </div>
84 91 ${self.breadcrumbs('breadcrumbs_light')}
85 <div class="pull-right">
86 % if h.is_hg(c.rhodecode_repo):
87 % if c.show_hidden:
88 <a class="action-link" href="${h.current_route_path(request, evolve=0)}">${_('Hide obsolete/hidden')}</a>
89 % else:
90 <a class="action-link" href="${h.current_route_path(request, evolve=1)}">${_('Show obsolete/hidden')}</a>
91 % endif
92 % else:
93 <span class="action-link disabled">${_('Show hidden')}</span>
94 % endif
95 </div>
96 <div id="commit-counter" data-total=${c.total_cs} class="pull-right">
97 ${_ungettext('showing %d out of %d commit', 'showing %d out of %d commits', c.showing_commits) % (c.showing_commits, c.total_cs)}
98 </div>
99 92 </div>
100 93
101 94 <div id="graph">
@@ -103,14 +96,23 b''
103 96 <div id="graph_nodes">
104 97 <div id="graph_canvas"></div>
105 98 </div>
106 <div id="graph_content" class="main-content graph_full_width">
99 <div id="graph_content" class="graph_full_width">
107 100
108 101 <div class="table">
109 102 <table id="changesets" class="rctable">
110 103 <tr>
111 104 ## checkbox
112 <th></th>
113 <th></th>
105 <th colspan="4">
106 ## clear selection
107 <div title="${_('Clear selection')}" class="btn btn-sm" id="rev_range_clear" style="display:none">
108 <i class="icon-cancel-circled2"></i>
109 </div>
110 <div class="btn btn-sm disabled" disabled="disabled" id="rev_range_more" style="display:none;">${_('Select second commit')}</div>
111 <a href="#" class="btn btn-success btn-sm" id="rev_range_container" style="display:none;"></a>
112 </th>
113 ## graph
114
115 ## review box
114 116
115 117 <th>${_('Commit')}</th>
116 118
@@ -135,6 +137,9 b''
135 137 <div class="pagination-wh pagination-left">
136 138 ${c.pagination.pager('$link_previous ~2~ $link_next')}
137 139 </div>
140 <div id="commit-counter" data-total=${c.total_cs} class="pull-right">
141 ${_ungettext('showing %d out of %d commit', 'showing %d out of %d commits', c.showing_commits) % (c.showing_commits, c.total_cs)}
142 </div>
138 143 </div>
139 144
140 145 <script type="text/javascript">
@@ -144,6 +149,7 b''
144 149 // Create links to commit ranges when range checkboxes are selected
145 150 var $commitCheckboxes = $('.commit-range');
146 151 // cache elements
152 var $commitRangeMore = $('#rev_range_more');
147 153 var $commitRangeContainer = $('#rev_range_container');
148 154 var $commitRangeClear = $('#rev_range_clear');
149 155
@@ -155,57 +161,67 b''
155 161 }
156 162 }
157 163 var open_new_pull_request = $('#open_new_pull_request');
164
158 165 if(open_new_pull_request){
159 166 var selected_changes = selectedCheckboxes.length;
160 if (selected_changes > 1 || selected_changes == 1 && templateContext.repo_type == 'svn') {
161 167 open_new_pull_request.hide();
162 } else {
163 168 if (selected_changes == 1) {
164 169 open_new_pull_request.html(_gettext('Open new pull request for selected commit'));
165 } else if (selected_changes == 0) {
170 } else {
166 171 open_new_pull_request.html(_gettext('Open new pull request'));
167 172 }
168 173 open_new_pull_request.show();
169 174 }
170 }
171 175
172 176 if (selectedCheckboxes.length>0){
173 var revEnd = selectedCheckboxes[0].name;
174 var revStart = selectedCheckboxes[selectedCheckboxes.length-1].name;
175 var url = pyroutes.url('repo_commit',
176 {'repo_name': '${c.repo_name}',
177 'commit_id': revStart+'...'+revEnd});
177 $('#compare_fork_button').hide();
178 var commitStart = $(selectedCheckboxes[selectedCheckboxes.length-1]).data();
179
180 var revStart = commitStart.commitId;
181
182 var commitEnd = $(selectedCheckboxes[0]).data();
183 var revEnd = commitEnd.commitId;
178 184
179 var link = (revStart == revEnd)
180 ? _gettext('Show selected commit __S')
181 : _gettext('Show selected commits __S ... __E');
185 var lbl_start = 'r{0}:{1}'.format(commitStart.commitIdx, commitStart.commitId.substr(0,6));
186 var lbl_end = 'r{0}:{1}'.format(commitEnd.commitIdx, commitEnd.commitId.substr(0,6));
187 var url = pyroutes.url('repo_commit', {'repo_name': '${c.repo_name}', 'commit_id': revStart+'...'+revEnd});
188 var link = _gettext('Show selected commits {0} ... {1}').format(lbl_start, lbl_end);
182 189
183 link = link.replace('__S', revStart.substr(0,6));
184 link = link.replace('__E', revEnd.substr(0,6));
190 if (selectedCheckboxes.length > 1) {
191 $commitRangeClear.show();
192 $commitRangeMore.hide();
185 193
186 194 $commitRangeContainer
187 195 .attr('href',url)
188 196 .html(link)
189 197 .show();
190 198
199
200 } else {
201 $commitRangeContainer.hide();
191 202 $commitRangeClear.show();
192 var _url = pyroutes.url('pullrequest_new',
193 {'repo_name': '${c.repo_name}',
194 'commit': revEnd});
203 $commitRangeMore.show();
204 }
205
206 // pull-request link
207 if (selectedCheckboxes.length == 1){
208 var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}', 'commit': revEnd});
195 209 open_new_pull_request.attr('href', _url);
196 $('#compare_fork_button').hide();
210 } else {
211 var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}'});
212 open_new_pull_request.attr('href', _url);
213 }
214
197 215 } else {
198 216 $commitRangeContainer.hide();
199 217 $commitRangeClear.hide();
218 $commitRangeMore.hide();
200 219
201 220 %if c.branch_name:
202 var _url = pyroutes.url('pullrequest_new',
203 {'repo_name': '${c.repo_name}',
204 'branch':'${c.branch_name}'});
221 var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}', 'branch':'${c.branch_name}'});
205 222 open_new_pull_request.attr('href', _url);
206 223 %else:
207 var _url = pyroutes.url('pullrequest_new',
208 {'repo_name': '${c.repo_name}'});
224 var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}'});
209 225 open_new_pull_request.attr('href', _url);
210 226 %endif
211 227 $('#compare_fork_button').show();
@@ -247,7 +263,7 b''
247 263 $("#branch_filter").select2({
248 264 'dropdownAutoWidth': true,
249 265 'width': 'resolve',
250 'placeholder': "${c.selected_name or _('Filter changelog')}",
266 'placeholder': "${c.selected_name or _('Branch filter')}",
251 267 containerCssClass: "drop-menu",
252 268 dropdownCssClass: "drop-menu-dropdown",
253 269 query: function(query){
@@ -21,7 +21,11 b''
21 21 <tr id="sha_${commit.raw_id}" class="changelogRow container ${'tablerow%s' % (cnt%2)}">
22 22
23 23 <td class="td-checkbox">
24 ${h.checkbox(commit.raw_id,class_="commit-range")}
24 ${h.checkbox(commit.raw_id,class_="commit-range", **{'data-commit-idx':commit.idx, 'data-commit-id': commit.raw_id})}
25 </td>
26 ##
27 <td class="td-graphbox">
28
25 29 </td>
26 30
27 31 <td class="td-status">
General Comments 0
You need to be logged in to leave comments. Login now