... | ... |
@@ -1,6 +1,6 @@ |
1 | 1 |
<% |
2 | 2 |
# API |
3 |
- my $api = Gitprep::API->new($self); |
|
3 |
+ my $api = gitprep_api; |
|
4 | 4 |
|
5 | 5 |
# Parameters |
6 | 6 |
my $user = param('user'); |
... | ... |
@@ -14,7 +14,6 @@ |
14 | 14 |
|
15 | 15 |
# Commits |
16 | 16 |
my $commits = $git->branch_diff($user, $project, $rev1, $rev2); |
17 |
- |
|
18 | 17 |
my $commits_count = @$commits; |
19 | 18 |
my $commits_date = {}; |
20 | 19 |
my $authors = {}; |
... | ... |
@@ -55,7 +54,7 @@ |
55 | 54 |
my $branches = $git->branches($user, $project); |
56 | 55 |
@$branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$branches; |
57 | 56 |
|
58 |
- # Global variable |
|
57 |
+ # Global variables |
|
59 | 58 |
stash(user => $user, project => $project); |
60 | 59 |
%> |
61 | 60 |
|
... | ... |
@@ -67,6 +66,7 @@ |
67 | 66 |
$(this).tab('show'); |
68 | 67 |
}); |
69 | 68 |
|
69 |
+ // Change base branch |
|
70 | 70 |
$('#base-branch-btn').on('click', function () { |
71 | 71 |
$('#base-branch-popup') |
72 | 72 |
.css('display', 'block') |
... | ... |
@@ -77,6 +77,30 @@ |
77 | 77 |
$('#base-branch-close').on('click', function () { |
78 | 78 |
$('#base-branch-popup').css('display', 'none'); |
79 | 79 |
}); |
80 |
+ $('[name=base-branch]').on('keypress', function (e) { |
|
81 |
+ // Enter |
|
82 |
+ if (e.which == 13) { |
|
83 |
+ location.href = '<%= url_for("/$user/$project/compare/") %>' + $(this).val() + '...<%= $rev2 %>'; |
|
84 |
+ } |
|
85 |
+ }); |
|
86 |
+ |
|
87 |
+ // Change compare branch |
|
88 |
+ $('#compare-branch-btn').on('click', function () { |
|
89 |
+ $('#compare-branch-popup') |
|
90 |
+ .css('display', 'block') |
|
91 |
+ .css('top', '40px') |
|
92 |
+ .css('left', '96px') |
|
93 |
+ ; |
|
94 |
+ }); |
|
95 |
+ $('#compare-branch-close').on('click', function () { |
|
96 |
+ $('#compare-branch-popup').css('display', 'none'); |
|
97 |
+ }); |
|
98 |
+ $('[name=compare-branch]').on('keypress', function (e) { |
|
99 |
+ // Enter |
|
100 |
+ if (e.which == 13) { |
|
101 |
+ location.href = '<%= url_for("/$user/$project/compare/") %>' + '<%= $rev1 %>...' + $(this).val(); |
|
102 |
+ } |
|
103 |
+ }); |
|
80 | 104 |
}); |
81 | 105 |
% end |
82 | 106 |
|
... | ... |
@@ -130,6 +154,35 @@ |
130 | 154 |
</ul> |
131 | 155 |
</div> |
132 | 156 |
</div> |
157 |
+ |
|
158 |
+ <div id="compare-branch-popup" style="display:none;width:330px;position:absolute"> |
|
159 |
+ <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px"> |
|
160 |
+ <div class="row"> |
|
161 |
+ <div class="span3"> |
|
162 |
+ <b>Choose a compare branch</b> |
|
163 |
+ </div> |
|
164 |
+ <div class="text-right"> |
|
165 |
+ <i id="compare-branch-close" class="icon-remove-circle"></i> |
|
166 |
+ </div> |
|
167 |
+ </div> |
|
168 |
+ </div> |
|
169 |
+ <div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0"> |
|
170 |
+ %= text_field 'compare-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker'; |
|
171 |
+ </div> |
|
172 |
+ <div style="background:white;max-height:500px;overflow:auto;"> |
|
173 |
+ <ul class="nav nav-tabs nav-stacked"> |
|
174 |
+ % for (my $i = 0; $i < @$branches; $i++) { |
|
175 |
+ % my $branch = $branches->[$i]; |
|
176 |
+ <li> |
|
177 |
+ <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= url_for("/$user/$project/compare/$rev1...$branch->{name}") %>"> |
|
178 |
+ <%= $branch->{name} %> |
|
179 |
+ </a> |
|
180 |
+ </li> |
|
181 |
+ % } |
|
182 |
+ </ul> |
|
183 |
+ </div> |
|
184 |
+ </div> |
|
185 |
+ |
|
133 | 186 |
</div> |
134 | 187 |
|
135 | 188 |
<div style="margin-bottom:20px">From here you can compare two points in history. You can even compare tag names and commits.</div> |