Showing 4 changed files with 58 additions and 20 deletions
+1
lib/Gitprep/Manager.pm
... ...
@@ -433,6 +433,7 @@ sub child_project {
433 433
   my $child_project = $self->app->dbi->model('project')->select(
434 434
     [
435 435
       {__MY__ => '*'},
436
+      {__user => ['id']}
436 437
     ],
437 438
     where => {
438 439
       'project.original_project' => $project_row_id,
+4
public/css/common.css
... ...
@@ -3157,6 +3157,10 @@ button.close {
3157 3157
   background-color: #fafafa;
3158 3158
 }
3159 3159
 
3160
+.compare-select button span {
3161
+  color:#767676;
3162
+}
3163
+
3160 3164
 .compare-header {
3161 3165
   border:1px solid #d8d8d8;
3162 3166
   overflow:hidden;
+52 -19
templates/compare.html.ep
... ...
@@ -15,7 +15,10 @@
15 15
   
16 16
   # Base project
17 17
   my $base_project = app->dbi->model('project')->select(
18
-    {__MY__ => '*'},
18
+    [
19
+      {__MY__ => '*'},
20
+      {__user => ['id']}
21
+    ],
19 22
     where => {'project.id' => $base_project_id, '__user.id' => $base_user_id}
20 23
   )->one;
21 24
   
... ...
@@ -229,13 +232,24 @@
229 232
     $('[name=base-branch]').on('keypress', function (e) {
230 233
       // Enter
231 234
       if (e.which == 13) {
232
-        var href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + $(this).val() + '...<%= $target_branch %>';
235
+        % use D;d [$base_user_id, $target_user_id];
236
+        
237
+        % if ($base_user_id eq $target_user_id) {
238
+          var href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + $(this).val() + '...<%= $target_branch %>';
239
+        % } else {
240
+          var href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + $(this).val() + '...<%= $target_user_id %>:<%= $target_branch %>';
241
+        % }
242
+        
233 243
         if (<%= $expand ? 1 : 0 %>) {
234 244
           href = href + '?expand=1';
235 245
         }
236 246
         location.href = href;
237 247
       }
238 248
     });
249
+    // ポップアップを閉じる
250
+    $(document).click(function() { $('#base-branch-popup').hide(); });
251
+    $('#base-branch-btn').click(function() { event.stopPropagation(); });
252
+    $('#base-branch-popup').click(function() { event.stopPropagation(); });
239 253
     
240 254
     // Change compare branch
241 255
     $('#compare-branch-btn').on('click', function () {
... ...
@@ -258,6 +272,11 @@
258 272
         location.href = href;
259 273
       }
260 274
     });
275
+    // ポップアップを閉じる
276
+    $(document).click(function() { $('#compare-branch-popup').hide(); });
277
+    $('#compare-branch-btn').click(function() { event.stopPropagation(); });
278
+    $('#compare-branch-popup').click(function() { event.stopPropagation(); });
279
+
261 280
   });
262 281
 % end
263 282
 
... ...
@@ -274,25 +293,39 @@
274 293
   <div class="compare-select">
275 294
     <div>
276 295
       <div>
277
-        <button id="base-branch-btn" class="btn btn-small">
278
-          <span>base:</span><b> <%= $base_branch %></b><i class="icon-arrow-down"></i>
279
-        </button>
280
-        ...
281
-        <button id="compare-branch-btn" class="btn btn-small">
282
-          <span>compare:</span> <b><%= $target_branch %></b><i class="icon-arrow-down"></i>
283
-        </button>
296
+        <div style="display:inline-block">
297
+          % if ($base_user_id ne $target_user_id) {
298
+            <button id="base-fork-btn" class="btn btn-small">
299
+              <span>base fork:</span><b> <%= $base_project->{'__user.id'} %>/<%= $base_project->{id} %></b><i class="icon-arrow-down"></i>
300
+            </button>
301
+          % }
302
+          <button id="base-branch-btn" class="btn btn-small">
303
+            <span>base:</span><b> <%= $base_branch %></b><i class="icon-arrow-down"></i>
304
+          </button>
305
+          ...
306
+        </div>
307
+        <div style="display:inline-block">
308
+          % if ($base_user_id ne $target_user_id) {
309
+            <button id="head-fork-btn" class="btn btn-small">
310
+              <span>head fork:</span><b> <%= $target_project->{'__user.id'} %>/<%= $target_project->{id} %></b><i class="icon-arrow-down"></i>
311
+            </button>
312
+          % }
313
+          <button id="compare-branch-btn" class="btn btn-small">
314
+            <span>compare:</span> <b><%= $target_branch %></b><i class="icon-arrow-down"></i>
315
+          </button>
284 316
         
285
-        % if ($can_open_pull_request) {
286
-          % if ($merge_success) {
287
-            <span style="margin-left:10px">
288
-              <span style="color:green;font-weight:bold"><%= "\x{2714}" %>Able to merge.</span> These branches can be automatically merged.
289
-            </span>
290
-          % } else {
291
-            <span style="margin-left:10px">
292
-              <span style="color:red;font-weight:bold"><%= "×" %>Not able to merge.</span> These branches can't be automatically merged.
293
-            </span>
317
+          % if ($can_open_pull_request) {
318
+            % if ($merge_success) {
319
+              <span style="margin-left:10px">
320
+                <span style="color:green;font-weight:bold"><%= "\x{2714}" %>Able to merge.</span> These branches can be automatically merged.
321
+              </span>
322
+            % } else {
323
+              <span style="margin-left:10px">
324
+                <span style="color:red;font-weight:bold"><%= "×" %>Not able to merge.</span> These branches can't be automatically merged.
325
+              </span>
326
+            % }
294 327
           % }
295
-        % }
328
+        </div>
296 329
       </div>
297 330
     </div>
298 331
 
+1 -1
xt/basic/work/kimoto/gitprep_t
... ...
@@ -1 +1 @@
1
-Subproject commit aae2cd54f5891d0a0ed5e2f845fa47199442d7a5
1
+Subproject commit 134b00c8889266c4b32699bc313c54db754a442e