##// 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 #graph_content{
964 #graph_content{
968
965
@@ -995,13 +992,12 b' label {'
995 }
992 }
996
993
997 .graph-col-wrapper {
994 .graph-col-wrapper {
998 padding-left: 110px;
999
995
1000 #graph_nodes {
996 #graph_nodes {
1001 width: 100px;
997 width: 100px;
1002 margin-left: -110px;
998 position: absolute;
1003 float: left;
999 left: 120px;
1004 clear: left;
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 #filter_changelog {
1027 #filter_changelog {
1022 float: left;
1028 float: left;
1023 }
1029 }
@@ -621,14 +621,6 b' ul#context-pages {'
621 font-family: @text-regular;
621 font-family: @text-regular;
622 color: @grey1;
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 .nav-pills {
624 .nav-pills {
633 margin: 0;
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 &.td-time {
125 &.td-time {
122 width: 160px;
126 width: 160px;
123 white-space: nowrap;
127 white-space: nowrap;
@@ -46,6 +46,8 b' var CommitsController = function () {'
46 self.$graphCanvas.html('');
46 self.$graphCanvas.html('');
47
47
48 var edgeData = $("[data-graph]").data('graph') || this.$graphCanvas.data('graph') || [];
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 // Determine max number of edges per row in graph
52 // Determine max number of edges per row in graph
51 var edgeCount = 1;
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 var x_step = Math.min(10, Math.floor(86 / edgeCount));
71 var x_step = Math.min(10, Math.floor(86 / edgeCount));
72 var height = $('#changesets').find('.commits-range').height() + graph_padding;
61 var graph_options = {
73 var graph_options = {
62 width: 100,
74 width: 100,
63 height: $('#changesets').find('.commits-range').height(),
75 height: height,
64 x_step: x_step,
76 x_step: x_step,
65 y_step: 42,
77 y_step: 42,
66 dotRadius: 3.5,
78 dotRadius: 3.5,
@@ -85,11 +97,11 b' var CommitsController = function () {'
85 this.$graphCanvas.commits(graph_options);
97 this.$graphCanvas.commits(graph_options);
86
98
87 this.setLabelText(edgeData);
99 this.setLabelText(edgeData);
88 if ($('.load-more-commits').find('.prev-commits').get(0)) {
89 var padding = 75;
90
100
91 } else {
101 var padding = 98;
92 var padding = 43;
102 if (prev_link) {
103 padding += 32;
104
93 }
105 }
94 $('#graph_nodes').css({'padding-top': padding});
106 $('#graph_nodes').css({'padding-top': padding});
95 };
107 };
@@ -29,10 +29,30 b''
29 <%def name="main()">
29 <%def name="main()">
30
30
31 <div class="box">
31 <div class="box">
32
32 <div class="title">
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 <ul class="links">
53 <ul class="links">
34 <li>
54 <li>
35 <a href="#" class="btn btn-small" id="rev_range_container" style="display:none;"></a>
55
36 %if c.rhodecode_db_repo.fork:
56 %if c.rhodecode_db_repo.fork:
37 <span>
57 <span>
38 <a id="compare_fork_button"
58 <a id="compare_fork_button"
@@ -60,11 +80,6 b''
60 </span>
80 </span>
61 %endif
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 </li>
83 </li>
69 </ul>
84 </ul>
70 </div>
85 </div>
@@ -73,29 +88,7 b''
73 <script type="text/javascript" src="${h.asset('js/src/plugins/jquery.commits-graph.js')}"></script>
88 <script type="text/javascript" src="${h.asset('js/src/plugins/jquery.commits-graph.js')}"></script>
74
89
75 <div class="graph-header">
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 ${self.breadcrumbs('breadcrumbs_light')}
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 </div>
92 </div>
100
93
101 <div id="graph">
94 <div id="graph">
@@ -103,14 +96,23 b''
103 <div id="graph_nodes">
96 <div id="graph_nodes">
104 <div id="graph_canvas"></div>
97 <div id="graph_canvas"></div>
105 </div>
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 <div class="table">
101 <div class="table">
109 <table id="changesets" class="rctable">
102 <table id="changesets" class="rctable">
110 <tr>
103 <tr>
111 ## checkbox
104 ## checkbox
112 <th></th>
105 <th colspan="4">
113 <th></th>
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 <th>${_('Commit')}</th>
117 <th>${_('Commit')}</th>
116
118
@@ -135,6 +137,9 b''
135 <div class="pagination-wh pagination-left">
137 <div class="pagination-wh pagination-left">
136 ${c.pagination.pager('$link_previous ~2~ $link_next')}
138 ${c.pagination.pager('$link_previous ~2~ $link_next')}
137 </div>
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 </div>
143 </div>
139
144
140 <script type="text/javascript">
145 <script type="text/javascript">
@@ -144,6 +149,7 b''
144 // Create links to commit ranges when range checkboxes are selected
149 // Create links to commit ranges when range checkboxes are selected
145 var $commitCheckboxes = $('.commit-range');
150 var $commitCheckboxes = $('.commit-range');
146 // cache elements
151 // cache elements
152 var $commitRangeMore = $('#rev_range_more');
147 var $commitRangeContainer = $('#rev_range_container');
153 var $commitRangeContainer = $('#rev_range_container');
148 var $commitRangeClear = $('#rev_range_clear');
154 var $commitRangeClear = $('#rev_range_clear');
149
155
@@ -155,57 +161,67 b''
155 }
161 }
156 }
162 }
157 var open_new_pull_request = $('#open_new_pull_request');
163 var open_new_pull_request = $('#open_new_pull_request');
164
158 if(open_new_pull_request){
165 if (open_new_pull_request) {
159 var selected_changes = selectedCheckboxes.length;
166 var selected_changes = selectedCheckboxes.length;
160 if (selected_changes > 1 || selected_changes == 1 && templateContext.repo_type == 'svn') {
161 open_new_pull_request.hide();
167 open_new_pull_request.hide();
162 } else {
163 if (selected_changes == 1) {
168 if (selected_changes == 1) {
164 open_new_pull_request.html(_gettext('Open new pull request for selected commit'));
169 open_new_pull_request.html(_gettext('Open new pull request for selected commit'));
165 } else if (selected_changes == 0) {
170 } else {
166 open_new_pull_request.html(_gettext('Open new pull request'));
171 open_new_pull_request.html(_gettext('Open new pull request'));
167 }
172 }
168 open_new_pull_request.show();
173 open_new_pull_request.show();
169 }
174 }
170 }
171
175
172 if (selectedCheckboxes.length>0){
176 if (selectedCheckboxes.length > 0) {
173 var revEnd = selectedCheckboxes[0].name;
177 $('#compare_fork_button').hide();
174 var revStart = selectedCheckboxes[selectedCheckboxes.length-1].name;
178 var commitStart = $(selectedCheckboxes[selectedCheckboxes.length-1]).data();
175 var url = pyroutes.url('repo_commit',
179
176 {'repo_name': '${c.repo_name}',
180 var revStart = commitStart.commitId;
177 'commit_id': revStart+'...'+revEnd});
181
182 var commitEnd = $(selectedCheckboxes[0]).data();
183 var revEnd = commitEnd.commitId;
178
184
179 var link = (revStart == revEnd)
185 var lbl_start = 'r{0}:{1}'.format(commitStart.commitIdx, commitStart.commitId.substr(0,6));
180 ? _gettext('Show selected commit __S')
186 var lbl_end = 'r{0}:{1}'.format(commitEnd.commitIdx, commitEnd.commitId.substr(0,6));
181 : _gettext('Show selected commits __S ... __E');
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));
190 if (selectedCheckboxes.length > 1) {
184 link = link.replace('__E', revEnd.substr(0,6));
191 $commitRangeClear.show();
192 $commitRangeMore.hide();
185
193
186 $commitRangeContainer
194 $commitRangeContainer
187 .attr('href',url)
195 .attr('href',url)
188 .html(link)
196 .html(link)
189 .show();
197 .show();
190
198
199
200 } else {
201 $commitRangeContainer.hide();
191 $commitRangeClear.show();
202 $commitRangeClear.show();
192 var _url = pyroutes.url('pullrequest_new',
203 $commitRangeMore.show();
193 {'repo_name': '${c.repo_name}',
204 }
194 'commit': revEnd});
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 open_new_pull_request.attr('href', _url);
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 } else {
215 } else {
198 $commitRangeContainer.hide();
216 $commitRangeContainer.hide();
199 $commitRangeClear.hide();
217 $commitRangeClear.hide();
218 $commitRangeMore.hide();
200
219
201 %if c.branch_name:
220 %if c.branch_name:
202 var _url = pyroutes.url('pullrequest_new',
221 var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}', 'branch':'${c.branch_name}'});
203 {'repo_name': '${c.repo_name}',
204 'branch':'${c.branch_name}'});
205 open_new_pull_request.attr('href', _url);
222 open_new_pull_request.attr('href', _url);
206 %else:
223 %else:
207 var _url = pyroutes.url('pullrequest_new',
224 var _url = pyroutes.url('pullrequest_new', {'repo_name': '${c.repo_name}'});
208 {'repo_name': '${c.repo_name}'});
209 open_new_pull_request.attr('href', _url);
225 open_new_pull_request.attr('href', _url);
210 %endif
226 %endif
211 $('#compare_fork_button').show();
227 $('#compare_fork_button').show();
@@ -247,7 +263,7 b''
247 $("#branch_filter").select2({
263 $("#branch_filter").select2({
248 'dropdownAutoWidth': true,
264 'dropdownAutoWidth': true,
249 'width': 'resolve',
265 'width': 'resolve',
250 'placeholder': "${c.selected_name or _('Filter changelog')}",
266 'placeholder': "${c.selected_name or _('Branch filter')}",
251 containerCssClass: "drop-menu",
267 containerCssClass: "drop-menu",
252 dropdownCssClass: "drop-menu-dropdown",
268 dropdownCssClass: "drop-menu-dropdown",
253 query: function(query){
269 query: function(query){
@@ -21,7 +21,11 b''
21 <tr id="sha_${commit.raw_id}" class="changelogRow container ${'tablerow%s' % (cnt%2)}">
21 <tr id="sha_${commit.raw_id}" class="changelogRow container ${'tablerow%s' % (cnt%2)}">
22
22
23 <td class="td-checkbox">
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 </td>
29 </td>
26
30
27 <td class="td-status">
31 <td class="td-status">
General Comments 0
You need to be logged in to leave comments. Login now