... | ... |
@@ -57,7 +57,7 @@ |
57 | 57 |
my $default_branch = $git->branch($user, $project, $default_branch_name); |
58 | 58 |
|
59 | 59 |
# Branches |
60 |
- my $branch_types = ['default', 'active', 'stale', 'all']; |
|
60 |
+ my $branch_types; |
|
61 | 61 |
my $branches_h = { |
62 | 62 |
default => [], |
63 | 63 |
active => [], |
... | ... |
@@ -134,10 +134,25 @@ |
134 | 134 |
<a href="<%= url_for("/$user/$project/branches/all") %>">All branches</a> |
135 | 135 |
</li> |
136 | 136 |
</ul> |
137 |
+ <% |
|
138 |
+ if ($display eq 'overview') { |
|
139 |
+ $branch_types = ['default', 'active', 'stale']; |
|
140 |
+ } |
|
141 |
+ elsif ($display eq 'active') { |
|
142 |
+ $branch_types = ['active']; |
|
143 |
+ } |
|
144 |
+ elsif ($display eq 'stale') { |
|
145 |
+ $branch_types = ['stale']; |
|
146 |
+ } |
|
147 |
+ elsif ($display eq 'all') { |
|
148 |
+ $branch_types = ['all']; |
|
149 |
+ } |
|
150 |
+ %> |
|
137 | 151 |
|
138 | 152 |
% for my $branch_type (@$branch_types) { |
139 | 153 |
% my $branches = $branches_h->{$branch_type}; |
140 |
- % if (@$branches) { |
|
154 |
+ |
|
155 |
+ % if (@$branches || $display ne 'overview') { |
|
141 | 156 |
<ul class="branches"> |
142 | 157 |
<li> |
143 | 158 |
% if ($branch_type eq 'default') { |
... | ... |
@@ -150,79 +165,95 @@ |
150 | 165 |
All branches |
151 | 166 |
% } |
152 | 167 |
</li> |
153 |
- % for (my $i = 0; $i < @$branches; $i++) { |
|
154 |
- % my $branch = $branches->[$i]; |
|
155 |
- % my $bname = $branch->{name}; |
|
156 |
- <li> |
|
157 |
- <ul> |
|
158 |
- <li> |
|
159 |
- <div class="branches-name"> |
|
160 |
- <a href="<%= url_for("/$user/$project/tree/$bname") %>"> |
|
161 |
- <%= $bname %> |
|
162 |
- </a> |
|
163 |
- </div> |
|
164 |
- <div class="branches-age" title="<%= $branch->{commit}{age_string_datetime_local} %>"> |
|
165 |
- Updated <%= $branch->{commit}{age_string} %> by |
|
166 |
- </div> |
|
167 |
- <div class="branches-author" title="<%= $branch->{commit}{author_email} %>"> |
|
168 |
- <%= $branch->{commit}{author_name} %> |
|
169 |
- </div> |
|
170 |
- </li> |
|
171 |
- <li class="second-child"> |
|
172 |
- % if ($bname eq $default_branch_name) { |
|
173 |
- <div style="padding-left:80px;padding-top:3px"> |
|
174 |
- <div class="branches-default"> |
|
175 |
- Default |
|
176 |
- </div> |
|
168 |
+ % if (@$branches) { |
|
169 |
+ % for (my $i = 0; $i < @$branches; $i++) { |
|
170 |
+ % my $branch = $branches->[$i]; |
|
171 |
+ % my $bname = $branch->{name}; |
|
172 |
+ <li> |
|
173 |
+ <ul> |
|
174 |
+ <li> |
|
175 |
+ <div class="branches-name"> |
|
176 |
+ <a href="<%= url_for("/$user/$project/tree/$bname") %>"> |
|
177 |
+ <%= $bname %> |
|
178 |
+ </a> |
|
177 | 179 |
</div> |
178 |
- % } else { |
|
179 |
- <table class="ahead-behind"> |
|
180 |
- <tr> |
|
181 |
- <td class="ahead-behind-behind-count"> |
|
182 |
- <%= $branch->{status}{behind} %> |
|
183 |
- </td> |
|
184 |
- <td class="ahead-behind-separate"> |
|
185 |
- </td> |
|
186 |
- <td style="padding-left:3px"> |
|
187 |
- <%= $branch->{status}{ahead} %> |
|
188 |
- </td> |
|
189 |
- </tr> |
|
190 |
- <tr> |
|
191 |
- <td style="width:100px"> |
|
192 |
- <div style="margin-left:auto;margin-right:0;background:#dcdcdc;width:<%= $max != 0 ? 100 * ($branch->{status}{behind} / $max) : 0 %>%;height:4px"></div> |
|
193 |
- </td> |
|
194 |
- <td class="ahead-behind-separate"> |
|
195 |
- </td> |
|
196 |
- <td style="width:100px"> |
|
197 |
- <div style="background:#dcdcdc;width:<%= $max != 0 ? 100 * ($branch->{status}{ahead} / $max) : 0 %>%;height:4px"></div> |
|
198 |
- </td> |
|
199 |
- </tr> |
|
200 |
- </table> |
|
201 |
- % } |
|
202 |
- </li> |
|
203 |
- <li class="last-child"> |
|
204 |
- % if ($bname eq $default_branch_name) { |
|
205 |
- % if ($api->logined($user)) { |
|
206 |
- <a href="<%= url_for("/$user/$project/settings") %>" type="submit" class="btn btn-small">Change default branch</a> |
|
207 |
- % } |
|
208 |
- % } else { |
|
209 |
- <a class="btn btn-small" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$bname") %>"> |
|
210 |
- Compare |
|
211 |
- </a> |
|
212 |
- % if ($api->logined($user)) { |
|
213 |
- <form action="<%= url_for->query(op => 'delete') %>" method="post" style="display:inline-block"> |
|
214 |
- <input type="submit" class="btn btn-small delete-branch" style="color:#900;" value="Delete"> |
|
215 |
- %= hidden_field branch => $bname; |
|
216 |
- </form> |
|
180 |
+ <div class="branches-age" title="<%= $branch->{commit}{age_string_datetime_local} %>"> |
|
181 |
+ Updated <%= $branch->{commit}{age_string} %> by |
|
182 |
+ </div> |
|
183 |
+ <div class="branches-author" title="<%= $branch->{commit}{author_email} %>"> |
|
184 |
+ <%= $branch->{commit}{author_name} %> |
|
185 |
+ </div> |
|
186 |
+ </li> |
|
187 |
+ <li class="second-child"> |
|
188 |
+ % if ($bname eq $default_branch_name) { |
|
189 |
+ <div style="padding-left:80px;padding-top:3px"> |
|
190 |
+ <div class="branches-default"> |
|
191 |
+ Default |
|
192 |
+ </div> |
|
193 |
+ </div> |
|
194 |
+ % } else { |
|
195 |
+ <table class="ahead-behind"> |
|
196 |
+ <tr> |
|
197 |
+ <td class="ahead-behind-behind-count"> |
|
198 |
+ <%= $branch->{status}{behind} %> |
|
199 |
+ </td> |
|
200 |
+ <td class="ahead-behind-separate"> |
|
201 |
+ </td> |
|
202 |
+ <td style="padding-left:3px"> |
|
203 |
+ <%= $branch->{status}{ahead} %> |
|
204 |
+ </td> |
|
205 |
+ </tr> |
|
206 |
+ <tr> |
|
207 |
+ <td style="width:100px"> |
|
208 |
+ <div style="margin-left:auto;margin-right:0;background:#dcdcdc;width:<%= $max != 0 ? 100 * ($branch->{status}{behind} / $max) : 0 %>%;height:4px"></div> |
|
209 |
+ </td> |
|
210 |
+ <td class="ahead-behind-separate"> |
|
211 |
+ </td> |
|
212 |
+ <td style="width:100px"> |
|
213 |
+ <div style="background:#dcdcdc;width:<%= $max != 0 ? 100 * ($branch->{status}{ahead} / $max) : 0 %>%;height:4px"></div> |
|
214 |
+ </td> |
|
215 |
+ </tr> |
|
216 |
+ </table> |
|
217 | 217 |
% } |
218 |
- % if (app->config->{basic}{show_ignore_space_change_link}) { |
|
219 |
- (<a style="font-size:90%;color:#9999FF" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$bname?w=") %>"> |
|
220 |
- ignore space |
|
221 |
- </a>) |
|
218 |
+ </li> |
|
219 |
+ <li class="last-child"> |
|
220 |
+ % if ($bname eq $default_branch_name) { |
|
221 |
+ % if ($api->logined($user)) { |
|
222 |
+ <a href="<%= url_for("/$user/$project/settings") %>" type="submit" class="btn btn-small">Change default branch</a> |
|
223 |
+ % } |
|
224 |
+ % } else { |
|
225 |
+ <a class="btn btn-small" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$bname") %>"> |
|
226 |
+ Compare |
|
227 |
+ </a> |
|
228 |
+ % if ($api->logined($user)) { |
|
229 |
+ <form action="<%= url_for->query(op => 'delete') %>" method="post" style="display:inline-block"> |
|
230 |
+ <input type="submit" class="btn btn-small delete-branch" style="color:#900;" value="Delete"> |
|
231 |
+ %= hidden_field branch => $bname; |
|
232 |
+ </form> |
|
233 |
+ % } |
|
234 |
+ % if (app->config->{basic}{show_ignore_space_change_link}) { |
|
235 |
+ (<a style="font-size:90%;color:#9999FF" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$bname?w=") %>"> |
|
236 |
+ ignore space |
|
237 |
+ </a>) |
|
238 |
+ % } |
|
222 | 239 |
% } |
223 |
- % } |
|
224 |
- </li> |
|
225 |
- </ul> |
|
240 |
+ </li> |
|
241 |
+ </ul> |
|
242 |
+ </li> |
|
243 |
+ % } |
|
244 |
+ % } else { |
|
245 |
+ <li style="text-align:center;text-color:#767676"> |
|
246 |
+ <% |
|
247 |
+ my $branch_type_name; |
|
248 |
+ if ($branch_type eq 'active' || $branch_type eq 'stale') { |
|
249 |
+ $branch_type_name = $branch_type; |
|
250 |
+ } |
|
251 |
+ else { |
|
252 |
+ $branch_type_name = ''; |
|
253 |
+ } |
|
254 |
+ %> |
|
255 |
+ |
|
256 |
+ There aren’t any <%= $branch_type_name %> branches. |
|
226 | 257 |
</li> |
227 | 258 |
% } |
228 | 259 |
</ul> |