Showing 1 changed files with 55 additions and 37 deletions
+55 -37
templates/compare.html.ep
... ...
@@ -122,10 +122,14 @@
122 122
     $('[name=base-branch]').on('keypress', function (e) {
123 123
       // Enter
124 124
       if (e.which == 13) {
125
-        location.href = '<%= url_for("/$user/$project/compare/") %>' + $(this).val() + '...<%= $rev %>';
125
+        var href = '<%= url_for("/$user/$project/compare/") %>' + $(this).val() + '...<%= $rev %>';
126
+        if (<%= $expand ? 1 : 0 %>) {
127
+          href = href + '?expand=1';
128
+        }
129
+        location.href = href;
126 130
       }
127 131
     });
128
-
132
+    
129 133
     // Change compare branch
130 134
     $('#compare-branch-btn').on('click', function () {
131 135
       $('#compare-branch-popup')
... ...
@@ -140,7 +144,11 @@
140 144
     $('[name=compare-branch]').on('keypress', function (e) {
141 145
       // Enter
142 146
       if (e.which == 13) {
143
-        location.href = '<%= url_for("/$user/$project/compare/") %>' + '<%= $from_rev %>...' + $(this).val();
147
+        var href = '<%= url_for("/$user/$project/compare/") %>' + '<%= $from_rev %>...' + $(this).val();
148
+        if (<%= $expand ? 1 : 0 %>) {
149
+          href = href + '?expand=1';
150
+        }
151
+        location.href = href;
144 152
       }
145 153
     });
146 154
   });
... ...
@@ -167,43 +175,49 @@
167 175
           <span>compare:</span> <b><%= $rev %></b><i class="icon-arrow-down"></i>
168 176
         </button>
169 177
         
170
-        % if ($merge_automatical) {
171
-          <span style="margin-left:10px">
172
-            <span style="color:green;font-weight:bold"><%= "\x{2714}" %>Able to merge.</span> These branches can be automatically merged.
173
-          </span>
178
+        % if ($can_open_pull_request) {
179
+          % if ($merge_automatical) {
180
+            <span style="margin-left:10px">
181
+              <span style="color:green;font-weight:bold"><%= "\x{2714}" %>Able to merge.</span> These branches can be automatically merged.
182
+            </span>
183
+          % } else {
184
+            <span style="margin-left:10px">
185
+              <span style="color:red;font-weight:bold"><%= "×" %>Not able to merge.</span> These branches can't be automatically merged.
186
+            </span>
187
+          % }
174 188
         % }
175 189
       </div>
176 190
     </div>
177
-    
178
-    % if ($merge_automatical) {
179
-      <div id="base-branch-popup" style="display:none;width:330px;position:absolute">
180
-        <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
181
-          <div style="overflow:hidden">
182
-            <div style="float:left;width:90%;">
183
-              <b>Choose a base branch</b>
184
-            </div>
185
-            <div style="float:left:width:10%;text-align:right;">
186
-              <i id="base-branch-close" class="icon-remove-circle"></i>
187
-            </div>
191
+
192
+    <div id="base-branch-popup" style="display:none;width:330px;position:absolute">
193
+      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
194
+        <div style="overflow:hidden">
195
+          <div style="float:left;width:90%;">
196
+            <b>Choose a base branch</b>
197
+          </div>
198
+          <div style="float:left:width:10%;text-align:right;">
199
+            <i id="base-branch-close" class="icon-remove-circle"></i>
188 200
           </div>
189
-        </div>
190
-        <div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0">
191
-          %= text_field 'base-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker';
192
-        </div>
193
-        <div style="background:white;max-height:500px;overflow:auto;">
194
-          <ul class="nav nav-tabs nav-stacked">
195
-            % for (my $i = 0; $i < @$branches; $i++) {
196
-              % my $branch = $branches->[$i];
197
-                <li>
198
-                  <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= url_for("/$user/$project/compare/$branch->{name}...$rev") %>">
199
-                    <%= $branch->{name} %>
200
-                  </a>
201
-                </li>
202
-            % }
203
-          </ul>
204 201
         </div>
205 202
       </div>
206
-    % }
203
+      <div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0">
204
+        %= text_field 'base-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker';
205
+      </div>
206
+      <div style="background:white;max-height:500px;overflow:auto;">
207
+        <ul class="nav nav-tabs nav-stacked">
208
+          % for (my $i = 0; $i < @$branches; $i++) {
209
+            % my $branch = $branches->[$i];
210
+              <li>
211
+                <a style="border-top-left-radius:0px;border-top-right-radius:0px;"
212
+                  href="<%= url_with("/$user/$project/compare/$branch->{name}...$rev") %>">
213
+                  <%= $branch->{name} %>
214
+                </a>
215
+              </li>
216
+          % }
217
+        </ul>
218
+      </div>
219
+    </div>
220
+
207 221
     <div id="compare-branch-popup" style="display:none;width:330px;position:absolute">
208 222
       <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
209 223
         <div style="overflow:hidden">
... ...
@@ -223,7 +237,8 @@
223 237
         % for (my $i = 0; $i < @$branches; $i++) {
224 238
           % my $branch = $branches->[$i];
225 239
             <li>
226
-              <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= url_for("/$user/$project/compare/$from_rev...$branch->{name}") %>">
240
+              <a style="border-top-left-radius:0px;border-top-right-radius:0px;"
241
+                href="<%= url_with("/$user/$project/compare/$from_rev...$branch->{name}") %>">
227 242
                 <%= $branch->{name} %>
228 243
               </a>
229 244
             </li>
... ...
@@ -233,7 +248,7 @@
233 248
     </div>
234 249
   </div>
235 250
   
236
-  % if ($can_open_pull_request) {
251
+  % if ($merge_automatical) {
237 252
     <div class="compare-open-pull-request">
238 253
       <form>
239 254
         <div class="compare-open-pull-request-title">
... ...
@@ -315,7 +330,10 @@
315 330
         <b><big>There isn't anything to compare.</big></b>
316 331
       </div>
317 332
       <div>
318
-        <b><%= $from_rev %></b> is up to date with all commits from <b><%= $rev %></b>. Try <a href="<%= url_for("/$user/$project/compare/$rev...$from_rev") %>">switching the base</a> for your comparison.
333
+        <b>
334
+          <%= $from_rev %></b> is up to date with all commits from
335
+          <b><%= $rev %></b>.
336
+          Try <a href="<%= url_for("/$user/$project/compare/$rev...$from_rev") %>">switching the base</a> for your comparison.
319 337
       </div>
320 338
     </div>
321 339
   % }