added Tags link
|
1 |
<% |
added branch status to branc...
|
2 | |
added Tags link
|
3 |
# API |
cleanup
|
4 |
my $api = gitprep_api; |
added Tags link
|
5 | |
cleanup branches page
|
6 |
# Parameters |
added Tags link
|
7 |
my $user = param('user'); |
cleanup, rename repository t...
|
8 |
my $project = param('project'); |
improved branches page desig...
|
9 |
my $op = param('op') || ''; |
added Tags link
|
10 |
|
11 |
# Git |
|
revert encoding support
|
12 |
my $git = $self->app->git; |
added branch deleting featur...
|
13 | |
14 |
# Delete |
|
15 |
my $errors; |
|
fix branch not deleted bug a...
|
16 |
if ($op eq 'delete' && lc $self->req->method eq 'post') { |
17 |
|
|
18 |
# Forbbiden |
|
19 |
unless ($api->logined($user)) { |
|
20 |
$self->redirect_to('/'); |
|
21 |
return; |
|
22 |
} |
|
added branch deleting featur...
|
23 | |
24 |
# Validation |
|
25 |
my $params = $api->params; |
|
rename validator to vc to up...
|
26 |
my $vc = $self->app->vc; |
added branch deleting featur...
|
27 |
my $rule = [ |
28 |
branch => [ |
|
fix branch not deleted bug a...
|
29 |
[not_blank => 'Branch name is empty'] |
added branch deleting featur...
|
30 |
] |
31 |
]; |
|
rename validator to vc to up...
|
32 |
my $vresult = $vc->validate($params, $rule); |
added branch deleting featur...
|
33 | |
34 |
if ($vresult->is_ok) { |
|
35 |
# Valid parameters |
|
36 |
my $params = $vresult->data; |
|
37 |
my $branch = $params->{branch}; |
|
38 |
|
|
39 |
# Delete branch |
|
fix branch not deleted bug a...
|
40 |
eval { $git->delete_branch($user, $project, $branch) }; |
41 |
if ($@) { |
|
42 |
app->log->error(url_with . ":$@"); |
|
43 |
$errors = ['Internal Error']; |
|
added branch deleting featur...
|
44 |
} |
45 |
else { |
|
fix branch not deleted bug a...
|
46 |
$self->flash(message => "Branch $branch is deleted."); |
47 |
$self->redirect_to; |
|
added branch deleting featur...
|
48 |
return; |
49 |
} |
|
50 |
} |
|
51 |
else { $errors = $vresult->messages } |
|
52 |
} |
|
fix branch not deleted bug a...
|
53 |
|
54 |
# Default branch |
|
revert encoding support
|
55 |
my $base_branch_name = param('base_branch') || app->manager->default_branch($user, $project); |
fix branch not deleted bug a...
|
56 |
my $base_branch = $git->branch($user, $project, $base_branch_name); |
57 |
|
|
58 |
# No merged branches |
|
59 |
my $branches = $git->branches($user, $project); |
|
60 |
my $max = 0; |
|
61 |
for my $branch (@$branches) { |
|
62 |
$branch->{status} = $git->branch_status($user, $project, $base_branch->{name}, $branch->{name}); |
|
63 |
$max = $branch->{status}{ahead} if $max < $branch->{status}{ahead}; |
|
64 |
$max = $branch->{status}{behind} if $max < $branch->{status}{behind}; |
|
added branch deleting featur...
|
65 |
} |
fix branch not deleted bug a...
|
66 |
my $branches_count = $git->branches_count($user, $project); |
67 |
my $no_merged_branches_count = $git->no_merged_branches_count($user, $project); |
|
68 |
my $merged_branches_count = $branches_count - $no_merged_branches_count - 1; |
|
improved code_menu links
|
69 |
|
70 |
# Global variable |
|
71 |
stash(rev => $base_branch_name); |
|
added Tags link
|
72 |
%> |
73 | ||
add title
|
74 |
% layout 'common', title => "branches \x{30fb} $user/$project"; |
added merged branches to bra...
|
75 | |
76 |
%= javascript begin |
|
77 |
$('document').ready(function () { |
|
78 |
|
|
79 |
// Swich merged branch or not merged branch |
|
80 |
var display_no_merged = true; |
|
81 |
$('#toggle-branch').on('click', function () { |
|
82 |
if (display_no_merged) { |
|
83 |
$(this).text('View unmerged branches'); |
|
84 |
$('#no-merged-branch-message').hide(); |
|
85 |
$('#merged-branch-message').show(); |
|
86 |
$('.no-merged-branch').css('display', 'none'); |
|
improved branches page desig...
|
87 |
$('.merged-branch').css('display', 'block'); |
added merged branches to bra...
|
88 |
} |
89 |
else { |
|
90 |
$(this).text('View merged branches'); |
|
91 |
$('#no-merged-branch-message').show(); |
|
92 |
$('#merged-branch-message').hide(); |
|
improved branches page desig...
|
93 |
$('.no-merged-branch').css('display', 'block'); |
added merged branches to bra...
|
94 |
$('.merged-branch').css('display', 'none'); |
95 |
} |
|
96 |
display_no_merged = !display_no_merged; |
|
97 |
}); |
|
added branch deleting featur...
|
98 |
|
99 |
// Click delete button |
|
100 |
$('.delete-branch').on('click', function () { |
|
101 |
if (window.confirm('Are you sure you want to remove this branch?')) { |
|
102 |
return true; |
|
103 |
} |
|
104 |
else { |
|
105 |
return false; |
|
106 |
} |
|
107 |
}); |
|
added merged branches to bra...
|
108 |
}); |
109 |
% end |
|
design branches page
|
110 |
|
cleanup
|
111 |
%= include '/include/header'; |
cleanup
|
112 |
|
added branch deleting featur...
|
113 |
<div class="container" style="padding-bottom:30px"> |
fix branch not deleted bug a...
|
114 |
%= include '/include/errors', errors => $errors; |
115 |
%= include '/include/message', message => flash('message'); |
|
added branch deleting featur...
|
116 |
|
cleanup branches page
|
117 |
%= include '/include/project_header'; |
added change base branch fea...
|
118 |
%= include '/include/code_menu', display => 'branches', branches => $branches; |
design branches page
|
119 |
|
improved branches page desig...
|
120 |
<h3 style="font-size:19px">Branches</h3> |
design branches page
|
121 |
|
improved branches page desig...
|
122 |
<div style="margin-bottom:10px"> |
added merged branches to bra...
|
123 |
Showing |
124 |
<span id="no-merged-branch-message"> |
|
125 |
<%= $no_merged_branches_count %> branches not merged |
|
126 |
</span> |
|
127 |
<span style="display:none" id="merged-branch-message"> |
|
128 |
<%= $merged_branches_count %> branches merged |
|
129 |
</span> |
|
added change base branch fea...
|
130 |
into <%= $base_branch->{name} %>. |
added merged branches to bra...
|
131 |
<a id="toggle-branch" href="#">View merged branches</a> |
cleanup branches page
|
132 |
</div> |
improved branches page desig...
|
133 |
<div class="bk-black" style="padding:5px 10px"> |
cleanup
|
134 |
<div class="row"> |
improved branches page desig...
|
135 |
<div class="span8" style="line-height:1.2em"> |
136 |
<div style="color:white;font-size:16px;"> |
|
added change base branch fea...
|
137 |
<b><%= $base_branch->{name} %></b> |
cleanup branches page
|
138 |
</div> |
improved branches page desig...
|
139 |
<div class="muted" style="font-size:12px"> |
cleanup
|
140 |
Last updated |
added change base branch fea...
|
141 |
<span title="<%= $base_branch->{commit}{age_string_datetime} %>"> |
142 |
<%= $base_branch->{commit}{age_string} %> |
|
added commit datetime to man...
|
143 |
</span> |
cleanup
|
144 |
by |
added change base branch fea...
|
145 |
<span title="<%= $base_branch->{commit}{author_email} %>" style="color:white"> |
146 |
<%= $base_branch->{commit}{author_name} %> |
|
added commit datetime to man...
|
147 |
</span> |
cleanup branches page
|
148 |
</div> |
149 |
</div> |
|
improved branches page desig...
|
150 |
<div class="text-right font-white" style="padding-top:6px"> |
cleanup
|
151 |
Base branch |
152 |
</div> |
|
cleanup branches page
|
153 |
</div> |
154 |
</div> |
|
155 |
% for (my $i = 0; $i < @$branches; $i++) { |
|
156 |
% my $branch = $branches->[$i]; |
|
fixed branch page bug
|
157 |
% my $bname = $branch->{name}; |
added change base branch fea...
|
158 |
% next if $bname eq $base_branch->{name}; |
improved branches page desig...
|
159 |
<div class="<%= $branch->{no_merged} ? 'no-merged-branch' : 'merged-branch' %> border-bottom-gray" style="padding:10px 0px 5px 0px;<%= $branch->{no_merged} ? '' : 'display:none' %>"> |
cleanup
|
160 |
<div class="row"> |
added branch status to branc...
|
161 |
<div class="span5" style="line-height:1.2em"> |
improved branches page desig...
|
162 |
<div style="font-size:16px;"> |
fixed branch page bug
|
163 |
<a href="<%= url_for("/$user/$project/tree/$bname") %>"> |
improved branches page desig...
|
164 |
<b><%= $bname %></b> |
design branches page
|
165 |
</a> |
166 |
</div> |
|
improved branches page desig...
|
167 |
<div style="font-size:12px"> |
cleanup
|
168 |
Last updated |
added commit datetime to man...
|
169 |
<span title="<%= $branch->{commit}{age_string_datetime} %>"> |
170 |
<%= $branch->{commit}{age_string} %> |
|
171 |
</span> |
|
cleanup
|
172 |
by |
added commit datetime to man...
|
173 |
<span title="<%= $branch->{commit}{author_email} %>"> |
174 |
<%= $branch->{commit}{author_name} %> |
|
175 |
</span> |
|
cleanup
|
176 |
</div> |
177 |
</div> |
|
added branch status to branc...
|
178 |
<div class="span3 muted" style="line-height:1em;font-size:11px"> |
179 |
<table> |
|
180 |
<tr> |
|
181 |
<td> |
|
182 |
</td> |
|
183 |
<td style="background:#333"> |
|
184 |
</td> |
|
185 |
<td style="padding-left:3px"> |
|
186 |
<%= $branch->{status}{ahead} %> ahead |
|
187 |
</td> |
|
188 |
</tr> |
|
189 |
<tr> |
|
190 |
<td style="width:100px"> |
|
added change base branch fea...
|
191 |
<div style="margin-left:auto;margin-right:0;background:#b2d0dd;width:<%= $max != 0 ? 100 * ($branch->{status}{behind} / $max) : 0 %>%;height:8px"></div> |
added branch status to branc...
|
192 |
</td> |
193 |
<td style="background:#333"> |
|
194 |
</td> |
|
195 |
<td style="width:100px"> |
|
added change base branch fea...
|
196 |
<div style="background:#b2d0dd;width:<%= $max != 0 ? 100 * ($branch->{status}{ahead} / $max) : 0 %>%;height:8px"></div> |
added branch status to branc...
|
197 |
</td> |
198 |
</tr> |
|
199 |
<tr> |
|
200 |
<td> |
|
201 |
<%= $branch->{status}{behind} %> behind |
|
202 |
</td> |
|
203 |
<td style="background:#333"> |
|
204 |
</td> |
|
205 |
<td> |
|
206 |
</td> |
|
207 |
</tr> |
|
208 |
</table> |
|
209 |
</div> |
|
210 |
<div class="span4 text-right" style="padding-top:0px"> |
|
added branch deleting featur...
|
211 |
% if ($api->logined($user)) { |
212 |
<form action="<%= url_for->query(op => 'delete') %>" method="post" style="display:inline-block"> |
|
213 |
<input type="submit" class="btn delete-branch" style="color:#900;" value="Delete branch"> |
|
214 |
%= hidden_field branch => $bname; |
|
215 |
</form> |
|
216 |
% } |
|
added change base branch fea...
|
217 |
<a class="btn" href="<%= url_for("/$user/$project/compare/$base_branch->{name}...$bname") %>"> |
cleanup
|
218 |
Compare |
219 |
</a> |
|
cleanup branches page
|
220 |
</div> |
221 |
</div> |
|
222 |
</div> |
|
223 |
% } |
|
added branches link
|
224 |
</div> |
design branches page
|
225 |
|
226 |
%= include '/include/footer'; |