Showing 2 changed files with 77 additions and 46 deletions
+10
public/css/bootstrap.css
... ...
@@ -2435,3 +2435,13 @@ button.close {
2435 2435
   width:1px;
2436 2436
   background:#c0c0c0;
2437 2437
 }
2438
+
2439
+.branches-default {
2440
+  font-size:12px;
2441
+  text-align:center;
2442
+  display:inline-block;
2443
+  background-color: #767676;
2444
+  color: #fff;
2445
+  border-radius:3px;
2446
+  padding:1px 3px;
2447
+}
+67 -46
templates/branches.html.ep
... ...
@@ -72,28 +72,35 @@
72 72
     $max = $branch->{status}{ahead} if $max < $branch->{status}{ahead};
73 73
     $max = $branch->{status}{behind} if $max < $branch->{status}{behind};
74 74
     
75
-    my $is_active = $branch->{commit}{age} < 60 * 60 * 24 * (365 * 3);
75
+    my $branch_type;
76
+    if ($branch->{name} eq $default_branch_name) {
77
+      $branch_type = 'default';
78
+    }
79
+    elsif ($branch->{commit}{age} < 60 * 60 * 24 * (365 * 3)) {
80
+      $branch_type = 'active';
81
+    }
82
+    else {
83
+      $branch_type = 'stale';
84
+    }
76 85
     
77 86
     if ($display eq 'overview') {
78
-      if ($branch->{name} eq $default_branch_name) {
87
+      if ($branch_type eq 'default') {
79 88
         push @{$branches_h->{default}}, $branch;
80 89
       }
81
-      else {
82
-        if ($is_active) {
83
-          push @{$branches_h->{active}}, $branch;
84
-        }
85
-        else {
86
-          push @{$branches_h->{stale}}, $branch;
87
-        }
90
+      elsif ($branch_type eq 'active') {
91
+        push @{$branches_h->{active}}, $branch;
92
+      }
93
+      elsif ($branch_type eq 'stale') {
94
+        push @{$branches_h->{stale}}, $branch;
88 95
       }
89 96
     }
90 97
     elsif ($display eq 'active') {
91
-      if ($is_active) {
98
+      if ($branch_type eq 'active') {
92 99
         push @{$branches_h->{active}}, $branch;
93 100
       }
94 101
     }
95 102
     elsif ($display eq 'stale') {
96
-      unless ($is_active) {
103
+      if ($branch_type eq 'stale') {
97 104
         push @{$branches_h->{stale}}, $branch;
98 105
       }
99 106
     }
... ...
@@ -162,43 +169,57 @@
162 169
                   </div>
163 170
                 </li>
164 171
                 <li class="second-child">
165
-                  <table class="ahead-behind">
166
-                    <tr>
167
-                      <td class="ahead-behind-behind-count">
168
-                        <%= $branch->{status}{behind} %>
169
-                      </td>
170
-                      <td class="ahead-behind-separate">
171
-                      </td>
172
-                      <td style="padding-left:3px">
173
-                        <%= $branch->{status}{ahead} %>
174
-                      </td>
175
-                    </tr>
176
-                    <tr>
177
-                      <td style="width:100px">
178
-                        <div style="margin-left:auto;margin-right:0;background:#dcdcdc;width:<%= $max != 0 ? 100 * ($branch->{status}{behind} / $max) : 0 %>%;height:4px"></div>
179
-                      </td>
180
-                      <td class="ahead-behind-separate">
181
-                      </td>
182
-                      <td style="width:100px">
183
-                        <div style="background:#dcdcdc;width:<%= $max != 0 ? 100 * ($branch->{status}{ahead} / $max) : 0 %>%;height:4px"></div>
184
-                      </td>
185
-                    </tr>
186
-                  </table>
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>
177
+                    </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
+                  % }
187 202
                 </li>
188 203
                 <li class="last-child">
189
-                  <a class="btn btn-small" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$bname") %>">
190
-                    Compare
191
-                  </a>
192
-                  % if ($api->logined($user)) {
193
-                    <form action="<%= url_for->query(op => 'delete') %>" method="post" style="display:inline-block">
194
-                      <input type="submit" class="btn btn-small delete-branch" style="color:#900;" value="Delete">
195
-                      %= hidden_field branch => $bname;
196
-                    </form>
197
-                  % }
198
-                  % if (app->config->{basic}{show_ignore_space_change_link}) {
199
-                    (<a style="font-size:90%;color:#9999FF" href="<%= url_for("/$user/$project/compare/$default_branch->{name}...$bname?w=") %>">
200
-                      ignore space
201
-                    </a>)
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>
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>)
222
+                    % }
202 223
                   % }
203 224
                 </li>
204 225
               </ul>