gitprep / templates / compare.html.ep /
Newer Older
635 lines | 22.117kb
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
1
<%
2
  # API
added compare branch popup t...
Yuki Kimoto authored on 2013-05-10
3
  my $api = gitprep_api;
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
4

            
5
  # Parameters
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
6
  my $base_user_id = param('user');
7
  my $base_project_id = param('project');
8
  my $base_branch = param('rev1');
9
  my $user_id_and_target_branch = param('rev2');
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
10
  my $page = param('page') || 0;
add pull request form
Yuki Kimoto authored on 2016-04-12
11
  my $expand = param('expand');
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
12
  
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
13
  # Default base branch
14
  $base_branch //= app->manager->default_branch($base_user_id, $base_project_id);
15
  
16
  # Base project
17
  my $base_project = app->dbi->model('project')->select(
improve compare page popup
Yuki Kimoto authored on 2016-04-28
18
    [
19
      {__MY__ => '*'},
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
20
      {user => ['id']}
improve compare page popup
Yuki Kimoto authored on 2016-04-28
21
    ],
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
22
    where => {'project.id' => $base_project_id, 'user.id' => $base_user_id}
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
23
  )->one;
24
  
get target branch logic
Yuki Kimoto authored on 2016-04-27
25
  # Get target user, project, branch
26
  my $target_user_id;
27
  my $target_branch;
28
  my $target_project;
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
29
  if ($user_id_and_target_branch =~ /^([^:]+):(.+)/) {
get target branch logic
Yuki Kimoto authored on 2016-04-27
30
    $target_user_id = $1;
31
    $target_branch = $2;
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
32
    $target_project = $self->app->manager->child_project($base_user_id, $base_project_id, $target_user_id);
get target branch logic
Yuki Kimoto authored on 2016-04-27
33
  }
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
34
  else {
35
    $target_user_id = $base_user_id;
36
    $target_branch = $user_id_and_target_branch;
37
    $target_project = $base_project
cleanup branch
Yuki Kimoto authored on 2016-04-12
38
  }
39
  
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
40
  # Git
revert encoding support
Yuki Kimoto authored on 2013-11-22
41
  my $git = $self->app->git;
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
42
  
add compare validation
Yuki Kimoto authored on 2016-05-04
43
  my $errors;
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
44
  if (lc $self->req->method eq 'post') {
45
    my $op = param('op');
46
    
47
    if ($op eq 'create-pull-request') {
add compare validation
Yuki Kimoto authored on 2016-05-04
48
      
49
      # Parameters
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
50
      my $title = param('title');
51
      my $message = param('message');
52
      
add compare validation
Yuki Kimoto authored on 2016-05-04
53
      # Validation
54
      my $vc = app->vc;
55
      my $validation = $vc->validation;
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
56
      
add compare validation
Yuki Kimoto authored on 2016-05-04
57
      # Check title
58
      if (!(defined $title && length $title)) {
59
        $validation->add_failed(title => 'title is empty');
60
      }
61
      elsif (length $title > 300) {
62
        $validation->add_failed(title => 'title is too long');
63
      }
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
64
      
add compare validation
Yuki Kimoto authored on 2016-05-04
65
      # Message
66
      if (!(defined $message && length $message)) {
67
        $message = '';
68
        if (length $message > 1000) {
69
          $validation->add_failed(message => 'message is too long');
70
        }
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
71
      }
add compare validation
Yuki Kimoto authored on 2016-05-04
72
      
73
      if ($validation->is_valid) {
74
      
75
        my $project_row_id = app->dbi->model('project')->select(
76
          'project.row_id',
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
77
          where => {'user.id' => $base_user_id, 'project.id' => $base_project_id}
add pulls description
Yuki Kimoto authored on 2016-04-20
78
        )->value;
79
        
add compare validation
Yuki Kimoto authored on 2016-05-04
80
        my $pull_request = app->dbi->model('pull_request')->select(
81
          where => {
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
82
            base_project => $project_row_id,
83
            base_branch => $base_branch,
add compare validation
Yuki Kimoto authored on 2016-05-04
84
            target_project => $target_project->{id},
85
            target_branch => $target_branch
86
          }
87
        )->one;
88
        
fix branches page
Yuki Kimoto authored on 2016-06-11
89
        my $issue;
add compare validation
Yuki Kimoto authored on 2016-05-04
90
        if ($pull_request) {
fix branches page
Yuki Kimoto authored on 2016-06-11
91
          $issue = app->dbi->model('issue')->select(
92
            where => {pull_request => $pull_request->{row_id}}
93
          )->one;
94
          $self->redirect_to("/$base_user_id/$base_project_id/pull/$issue->{row_id}");
add compare validation
Yuki Kimoto authored on 2016-05-04
95
          return;
96
        }
97
        else {
98
          my $now_tm = Time::Moment->now_utc;
99
          my $now_epoch = $now_tm->epoch;
100
          my $session_user_row_id = $api->session_user_row_id;
fix compare page
Yuki Kimoto authored on 2016-06-11
101
          my $new_issue_row_id;
add compare validation
Yuki Kimoto authored on 2016-05-04
102
          app->dbi->connector->txn(sub {
fix compare page
Yuki Kimoto authored on 2016-06-11
103
            
add compare validation
Yuki Kimoto authored on 2016-05-04
104
            # New pull request
fix compare page
Yuki Kimoto authored on 2016-06-11
105
            my $new_pull_request = {
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
106
              base_project => $project_row_id,
107
              base_branch => $base_branch,
108
              target_project => $target_project->{row_id},
add compare validation
Yuki Kimoto authored on 2016-05-04
109
              target_branch => $target_branch,
fix compare page
Yuki Kimoto authored on 2016-06-11
110
            };
111
            
112
            app->dbi->model('pull_request')->insert($new_pull_request);
113
            my $new_pull_request_row_id = app->dbi->execute("select LAST_INSERT_ROWID()")->value;
114
            
115
            # New issue
116
            my $new_issue = {
add compare validation
Yuki Kimoto authored on 2016-05-04
117
              title => $title,
118
              open => 1,
119
              open_time => $now_epoch,
fix compare page
Yuki Kimoto authored on 2016-06-11
120
              open_user => $session_user_row_id,
121
              pull_request => $new_pull_request_row_id
add compare validation
Yuki Kimoto authored on 2016-05-04
122
            };
fix compare page
Yuki Kimoto authored on 2016-06-11
123
            app->dbi->model('issue')->insert($new_issue);
124
            $new_issue_row_id = app->dbi->execute("select LAST_INSERT_ROWID()")->value;
add compare validation
Yuki Kimoto authored on 2016-05-04
125
            
fix compare page
Yuki Kimoto authored on 2016-06-11
126
            # New issue message
127
            my $new_issue_message = {
fix pulls page
Yuki Kimoto authored on 2016-06-09
128
              issue => $new_issue_row_id,
fix compare page
Yuki Kimoto authored on 2016-06-11
129
              number => 1,
add compare validation
Yuki Kimoto authored on 2016-05-04
130
              message => $message,
131
              create_time => $now_epoch,
132
              update_time => $now_epoch,
133
              user => $session_user_row_id
134
            };
135
            
fix compare page
Yuki Kimoto authored on 2016-06-11
136
            app->dbi->model('issue_message')->insert($new_issue_message);
add compare validation
Yuki Kimoto authored on 2016-05-04
137
          });
fix create pull request logi...
Yuki Kimoto authored on 2016-04-23
138
          
fix pulls page
Yuki Kimoto authored on 2016-06-09
139
          $self->redirect_to("/$base_user_id/$base_project_id/pull/$new_issue_row_id");
add compare validation
Yuki Kimoto authored on 2016-05-04
140
          return;
141
        }
142
      }
143
      else {
144
        $errors = $validation->messages;
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
145
      }
146
    }
147
  }
cleanup comapre
Yuki Kimoto authored on 2016-04-27
148

            
149
  # Can merge
fix compare branch link
Yuki Kimoto authored on 2016-04-28
150
  my $base_rep_info = app->rep_info($base_user_id, $base_project_id);
cleanup comapre
Yuki Kimoto authored on 2016-04-27
151
  my $merge_success;
fix compare branch link
Yuki Kimoto authored on 2016-04-28
152
  my $target_rep_info;
cleanup comapre
Yuki Kimoto authored on 2016-04-27
153
  if ($target_project) {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
154
    $target_rep_info = app->rep_info($target_user_id, $target_project->{id});
cleanup comapre
Yuki Kimoto authored on 2016-04-27
155
  }
156
  else {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
157
    $target_rep_info = $base_rep_info;
cleanup comapre
Yuki Kimoto authored on 2016-04-27
158
  }
159
    
160
  # Create working repository if it don't exist
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
161
  $self->app->manager->create_work_rep($base_user_id, $base_project_id);
cleanup comapre
Yuki Kimoto authored on 2016-04-27
162
  
163
  # Lock working repository
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
164
  my $work_rep_info = app->work_rep_info($base_user_id, $base_project_id);
cleanup comapre
Yuki Kimoto authored on 2016-04-27
165
  {
166
    my $lock_fh = $self->app->manager->lock_rep($work_rep_info);
167
    
168
    # Prepare merge
169
    $self->app->manager->prepare_merge(
170
      $work_rep_info,
fix compare branch link
Yuki Kimoto authored on 2016-04-28
171
      $base_rep_info,
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
172
      $base_branch,
fix compare branch link
Yuki Kimoto authored on 2016-04-28
173
      $target_rep_info,
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
174
      $target_branch
cleanup comapre
Yuki Kimoto authored on 2016-04-27
175
    );
176
    
177
    # Check merge automatically
178
    $merge_success = $self->app->manager->merge(
179
      $work_rep_info,
fix compare branch link
Yuki Kimoto authored on 2016-04-28
180
      $target_rep_info,
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
181
      $target_branch
cleanup comapre
Yuki Kimoto authored on 2016-04-27
182
    );
183
  }
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
184
  
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
185
  # Commits
fix compare branch link
Yuki Kimoto authored on 2016-04-28
186
  my $commits = $git->forward_commits($base_rep_info, $base_branch, $target_branch);
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
187
  my $commits_count = @$commits;
188
  my $commits_date = {};
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
189
  my $authors = {};
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
190
  for my $commit (@$commits) {
support time zone
Yuki Kimoto authored on 2014-03-08
191
    my $date = $commit->{age_string_date_local};
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
192
    $commits_date->{$date} ||= [];
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
193
    $authors->{$commit->{author}} = 1;
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
194
    push @{$commits_date->{$date}}, $commit;
195
  }
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
196
  my $authors_count = keys %$authors;
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
197

            
198
  # Start commit
fix compare branch link
Yuki Kimoto authored on 2016-04-28
199
  my $start_commit = $git->separated_commit($base_rep_info, $base_branch, $target_branch);
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
200

            
201
  # End commit
fix compare branch link
Yuki Kimoto authored on 2016-04-28
202
  my $end_commit = $git->get_commit($target_rep_info, $target_branch);
cleanup
Yuki Kimoto authored on 2013-05-13
203
  
204
  if (!$start_commit || !$end_commit) {
do success xt tests
Yuki Kimoto authored on 2016-03-25
205
    $self->reply->not_found;
cleanup
Yuki Kimoto authored on 2013-05-13
206
    return;
207
  }
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
208
  
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
209
  # Member projects
210
  my $member_projects = app->manager->member_projects($base_user_id, $base_project_id);
211
  unshift @$member_projects, $base_project;
212
  
fix compare branch link
Yuki Kimoto authored on 2016-04-28
213
  # Base branches
214
  my $base_branches = $git->branches($base_rep_info);
215
  @$base_branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$base_branches;
216

            
217
  # Target branches
218
  my $target_branches = $git->branches($target_rep_info);
219
  @$target_branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$target_branches;
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
220
  
add pull request form
Yuki Kimoto authored on 2016-04-12
221
  # Can open pull request
222
  my $can_open_pull_request;
223
  if (keys %$commits_date && $expand) {
224
    $can_open_pull_request = 1;
225
  }
226
  
cleanup merge and push logic
Yuki Kimoto authored on 2016-04-27
227
  # commit_body args
228
  my %commit_body_args = (
229
    id => $end_commit->{id},
230
    from_id => $start_commit->{id},
231
    rev => $end_commit->{id},
232
    from_rev => $start_commit->{id}
233
  );
234

            
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
235
  layout 'common', title => "Comparing $base_branch...$target_branch \x{30fb} $base_user_id/$base_project_id";
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
236
%>
237

            
cleanup compare page
Yuki Kimoto authored on 2013-04-12
238

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
239
%= javascript begin
240
  $(document).ready(function () {
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
241

            
242
    // Change base fork
243
    $('#base-fork-btn').on('click', function () {
244
      $('#base-fork-popup')
245
        .css('display', 'block')
246
        .css('top', '40px')
247
        .css('left', '10px')
248
      ;
249
    });
250
    $('#base-fork-popup').on('click', function () {
251
      $('#base-fork-popup').css('display', 'none');
252
    });
253
    // close popup
254
    $(document).click(function() { $('#base-fork-popup').hide(); });
255
    $('#base-fork-btn').click(function() { event.stopPropagation(); });
256
    $('#base-fork-popup').click(function() { event.stopPropagation(); });
257

            
258

            
259
    // Change head fork
260
    $('#head-fork-btn').on('click', function () {
261
      $('#head-fork-popup')
262
        .css('display', 'block')
263
        .css('top', '40px')
264
        .css('left', '10px')
265
      ;
266
    });
267
    $('#head-fork-popup').on('click', function () {
268
      $('#head-fork-popup').css('display', 'none');
269
    });
270
    // close popup
271
    $(document).click(function() { $('#head-fork-popup').hide(); });
272
    $('#head-fork-btn').click(function() { event.stopPropagation(); });
273
    $('#head-fork-popup').click(function() { event.stopPropagation(); });
274

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
275
    // Change base branch
276
    $('#base-branch-btn').on('click', function () {
277
      $('#base-branch-popup')
278
        .css('display', 'block')
279
        .css('top', '40px')
280
        .css('left', '10px')
281
      ;
282
    });
283
    $('#base-branch-close').on('click', function () {
284
      $('#base-branch-popup').css('display', 'none');
285
    });
286
    $('[name=base-branch]').on('keypress', function (e) {
287
      // Enter
288
      if (e.which == 13) {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
289
        var href;
improve compare page popup
Yuki Kimoto authored on 2016-04-28
290
        % if ($base_user_id eq $target_user_id) {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
291
          href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + $(this).val() + '...<%= $target_branch %>';
improve compare page popup
Yuki Kimoto authored on 2016-04-28
292
        % } else {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
293
          href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + $(this).val() + '...<%= $target_user_id %>:<%= $target_branch %>';
improve compare page popup
Yuki Kimoto authored on 2016-04-28
294
        % }
295
        
show not able to merge
Yuki Kimoto authored on 2016-04-18
296
        if (<%= $expand ? 1 : 0 %>) {
297
          href = href + '?expand=1';
298
        }
fix compare branch link
Yuki Kimoto authored on 2016-04-28
299
        
show not able to merge
Yuki Kimoto authored on 2016-04-18
300
        location.href = href;
improve compare page design
Yuki Kimoto authored on 2016-02-04
301
      }
302
    });
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
303
    // close popup
improve compare page popup
Yuki Kimoto authored on 2016-04-28
304
    $(document).click(function() { $('#base-branch-popup').hide(); });
305
    $('#base-branch-btn').click(function() { event.stopPropagation(); });
306
    $('#base-branch-popup').click(function() { event.stopPropagation(); });
show not able to merge
Yuki Kimoto authored on 2016-04-18
307
    
improve compare page design
Yuki Kimoto authored on 2016-02-04
308
    // Change compare branch
fix compare branch link
Yuki Kimoto authored on 2016-04-28
309
    $('#target-branch-btn').on('click', function () {
310
      $('#target-branch-popup')
improve compare page design
Yuki Kimoto authored on 2016-02-04
311
        .css('display', 'block')
312
        .css('top', '40px')
313
        .css('left', '96px')
314
      ;
315
    });
fix compare branch link
Yuki Kimoto authored on 2016-04-28
316
    $('#target-branch-close').on('click', function () {
317
      $('#target-branch-popup').css('display', 'none');
improve compare page design
Yuki Kimoto authored on 2016-02-04
318
    });
fix compare branch link
Yuki Kimoto authored on 2016-04-28
319
    $('[name=target-branch]').on('keypress', function (e) {
improve compare page design
Yuki Kimoto authored on 2016-02-04
320
      // Enter
321
      if (e.which == 13) {
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
322
        var href = '<%= url_for("/$base_user_id/$base_project_id/compare/") %>' + '<%= $base_branch %>...' + $(this).val();
show not able to merge
Yuki Kimoto authored on 2016-04-18
323
        if (<%= $expand ? 1 : 0 %>) {
324
          href = href + '?expand=1';
325
        }
326
        location.href = href;
improve compare page design
Yuki Kimoto authored on 2016-02-04
327
      }
improved compare page design
Yuki Kimoto authored on 2013-02-07
328
    });
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
329
    // close popup
fix compare branch link
Yuki Kimoto authored on 2016-04-28
330
    $(document).click(function() { $('#target-branch-popup').hide(); });
331
    $('#target-branch-btn').click(function() { event.stopPropagation(); });
332
    $('#target-branch-popup').click(function() { event.stopPropagation(); });
improve compare page popup
Yuki Kimoto authored on 2016-04-28
333

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
334
  });
335
% end
cleanup
Yuki Kimoto authored on 2013-02-04
336

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
337
%= include '/include/header';
cleanup
Yuki Kimoto authored on 2013-02-04
338

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
339
<div class="container">
add compare validation
Yuki Kimoto authored on 2016-05-04
340
  %= include '/include/errors', errors => $errors;
341
  
add pull request form
Yuki Kimoto authored on 2016-04-12
342
  <div class="topic1">
343
    % if ($can_open_pull_request) {
344
      Open a pull request
345
    % } else {
346
      Comparing changes
347
    % }
348
  </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
349
  <div class="compare-select">
350
    <div>
351
      <div>
improve compare page popup
Yuki Kimoto authored on 2016-04-28
352
        <div style="display:inline-block">
353
          % if ($base_user_id ne $target_user_id) {
354
            <button id="base-fork-btn" class="btn btn-small">
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
355
              <span>base fork:</span><b> <%= $base_project->{'user.id'} %>/<%= $base_project->{id} %></b><i class="icon-arrow-down"></i>
improve compare page popup
Yuki Kimoto authored on 2016-04-28
356
            </button>
357
          % }
358
          <button id="base-branch-btn" class="btn btn-small">
359
            <span>base:</span><b> <%= $base_branch %></b><i class="icon-arrow-down"></i>
360
          </button>
361
          ...
362
        </div>
complete pull request logic
Yuki Kimoto authored on 2016-04-28
363
        <div style="display:inline-block;margin-top:10px;">
improve compare page popup
Yuki Kimoto authored on 2016-04-28
364
          % if ($base_user_id ne $target_user_id) {
365
            <button id="head-fork-btn" class="btn btn-small">
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
366
              <span>head fork:</span><b> <%= $target_project->{'user.id'} %>/<%= $target_project->{id} %></b><i class="icon-arrow-down"></i>
improve compare page popup
Yuki Kimoto authored on 2016-04-28
367
            </button>
368
          % }
fix compare branch link
Yuki Kimoto authored on 2016-04-28
369
          <button id="target-branch-btn" class="btn btn-small">
improve compare page popup
Yuki Kimoto authored on 2016-04-28
370
            <span>compare:</span> <b><%= $target_branch %></b><i class="icon-arrow-down"></i>
371
          </button>
add automatical merge checki...
Yuki Kimoto authored on 2016-04-18
372
        
improve compare page popup
Yuki Kimoto authored on 2016-04-28
373
          % if ($can_open_pull_request) {
374
            % if ($merge_success) {
375
              <span style="margin-left:10px">
376
                <span style="color:green;font-weight:bold"><%= "\x{2714}" %>Able to merge.</span> These branches can be automatically merged.
377
              </span>
378
            % } else {
379
              <span style="margin-left:10px">
issue belong to project
Yuki Kimoto authored on 2016-06-11
380
                <span style="color:red;font-weight:bold">Not able to merge.</span> These branches can't be automatically merged.
improve compare page popup
Yuki Kimoto authored on 2016-04-28
381
              </span>
382
            % }
show not able to merge
Yuki Kimoto authored on 2016-04-18
383
          % }
improve compare page popup
Yuki Kimoto authored on 2016-04-28
384
        </div>
cleanup
Yuki Kimoto authored on 2013-03-15
385
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
386
    </div>
show not able to merge
Yuki Kimoto authored on 2016-04-18
387

            
388
    <div id="base-branch-popup" style="display:none;width:330px;position:absolute">
389
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
390
        <div style="overflow:hidden">
391
          <div style="float:left;width:90%;">
392
            <b>Choose a base branch</b>
393
          </div>
394
          <div style="float:left:width:10%;text-align:right;">
395
            <i id="base-branch-close" class="icon-remove-circle"></i>
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
396
          </div>
show pull request only when ...
Yuki Kimoto authored on 2016-04-18
397
        </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
398
      </div>
show not able to merge
Yuki Kimoto authored on 2016-04-18
399
      <div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0">
400
        %= text_field 'base-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker';
401
      </div>
402
      <div style="background:white;max-height:500px;overflow:auto;">
403
        <ul class="nav nav-tabs nav-stacked">
fix compare branch link
Yuki Kimoto authored on 2016-04-28
404
          % for (my $i = 0; $i < @$base_branches; $i++) {
405
            % my $branch = $base_branches->[$i];
show not able to merge
Yuki Kimoto authored on 2016-04-18
406
              <li>
fix compare branch link
Yuki Kimoto authored on 2016-04-28
407
                <%
408
                  my $url;
409
                  if ($base_user_id eq $target_user_id) {
410
                    $url = url_with("/$base_user_id/$base_project_id/compare/$branch->{name}...$target_branch");
411
                  }
412
                  else {
413
                    $url = url_with("/$base_user_id/$base_project_id/compare/$branch->{name}...$target_user_id:$target_branch");
414
                  }
415
                %>
show not able to merge
Yuki Kimoto authored on 2016-04-18
416
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;"
fix compare branch link
Yuki Kimoto authored on 2016-04-28
417
                  href="<%= $url  %>">
show not able to merge
Yuki Kimoto authored on 2016-04-18
418
                  <%= $branch->{name} %>
419
                </a>
420
              </li>
421
          % }
422
        </ul>
423
      </div>
424
    </div>
425

            
fix compare branch link
Yuki Kimoto authored on 2016-04-28
426
    <div id="target-branch-popup" style="display:none;width:330px;position:absolute">
improve compare page design
Yuki Kimoto authored on 2016-02-04
427
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
428
        <div style="overflow:hidden">
429
          <div style="float:left;width:90%;">
430
            <b>Choose a compare branch</b>
431
          </div>
432
          <div style="float:left:width:10%;text-align:right;">
fix compare branch link
Yuki Kimoto authored on 2016-04-28
433
            <i id="target-branch-close" class="icon-remove-circle"></i>
added compare branch popup t...
Yuki Kimoto authored on 2013-05-10
434
          </div>
435
        </div>
436
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
437
      <div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0">
fix compare branch link
Yuki Kimoto authored on 2016-04-28
438
        %= text_field 'target-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker';
improve compare page design
Yuki Kimoto authored on 2016-02-04
439
      </div>
440
      <div style="background:white;max-height:500px;overflow:auto;">
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
441
        <ul class="nav nav-tabs nav-stacked">
442
          % for (my $i = 0; $i < @$target_branches; $i++) {
443
            % my $target_branch = $target_branches->[$i];
444
              <li>
445
                <%
446
                  my $url;
447
                  if ($base_user_id eq $target_user_id) {
448
                    $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch->{name}");
449
                  }
450
                  else {
451
                    $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_user_id:$target_branch->{name}");
452
                  }
453
                %>
454
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>">
455
                  <%= $target_branch->{name} %>
456
                </a>
457
              </li>
458
          % }
459
        </ul>
460
      </div>
461
    </div>
462

            
463

            
464
    <div id="base-fork-popup" style="display:none;width:330px;position:absolute">
465
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
466
        <div style="overflow:hidden">
467
          <div style="float:left;width:90%;">
468
            <b>Choose a base fork</b>
469
          </div>
470
          <div style="float:left:width:10%;text-align:right;">
471
            <i id="member-project-close" class="icon-remove-circle"></i>
472
          </div>
473
        </div>
474
      </div>
475
      <div style="background:white;max-height:500px;overflow:auto;">
476
        <ul class="nav nav-tabs nav-stacked">
477
          % for (my $i = 0; $i < @$member_projects; $i++) {
478
            % my $member_project = $member_projects->[$i];
fix compare branch link
Yuki Kimoto authored on 2016-04-28
479
              <%
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
480
                my $member_user_id = $member_project->{'user.id'};
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
481
                my $member_project_id = $member_project->{id};
fix compare branch link
Yuki Kimoto authored on 2016-04-28
482
              %>
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
483
              <li>
484
                <%
485
                  my $url;
486
                  if ($member_user_id eq $target_user_id) {
487
                    $url = url_with("/$member_user_id/$member_project_id/compare/$base_branch...$target_branch");
488
                  }
489
                  else {
490
                    $url = url_with("/$member_user_id/$member_project_id/compare/$base_branch...$target_user_id:$target_branch");
491
                  }
492
                %>
493
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>">
494
                  <%= $member_user_id %>/<%= $member_project_id %>
495
                </a>
496
              </li>
497
          % }
498
        </ul>
499
      </div>
500
    </div>
501

            
502

            
503

            
504

            
505
    <div id="head-fork-popup" style="display:none;width:330px;position:absolute">
506
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
507
        <div style="overflow:hidden">
508
          <div style="float:left;width:90%;">
509
            <b>Choose a head fork</b>
510
          </div>
511
          <div style="float:left:width:10%;text-align:right;">
512
            <i id="member-project-close" class="icon-remove-circle"></i>
513
          </div>
514
        </div>
515
      </div>
516
      <div style="background:white;max-height:500px;overflow:auto;">
517
        <ul class="nav nav-tabs nav-stacked">
518
          % for (my $i = 0; $i < @$member_projects; $i++) {
519
            % my $member_project = $member_projects->[$i];
520
              <%
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
521
                my $member_user_id = $member_project->{'user.id'};
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
522
                my $member_project_id = $member_project->{id};
523
              %>
524
              <li>
525
                <%
526
                  my $url;
527
                  if ($member_user_id eq $base_user_id) {
528
                    $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch");
529
                  }
530
                  else {
531
                    $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$member_user_id:$target_branch");
532
                  }
533
                %>
534
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>">
535
                  <%= $member_user_id %>/<%= $member_project_id %>
536
                </a>
537
              </li>
538
          % }
539
        </ul>
improve compare page design
Yuki Kimoto authored on 2016-02-04
540
      </div>
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
541
    </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
542
  </div>
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
543
 
complete pull request logic
Yuki Kimoto authored on 2016-04-28
544
  % if (keys %$commits_date && $merge_success) {
add pull request form
Yuki Kimoto authored on 2016-04-12
545
    <div class="compare-open-pull-request">
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
546
      <form action="<%= url_for %>" method="post">
547
        <%= hidden_field op => 'create-pull-request' %>
add pull request form
Yuki Kimoto authored on 2016-04-12
548
        <div class="compare-open-pull-request-title">
cleanup methods
Yuki Kimoto authored on 2016-04-13
549
          <%= text_field 'title' => $commits->[0]{title_short}  %>
add pull request form
Yuki Kimoto authored on 2016-04-12
550
        </div>
551
        <div class="compare-open-pull-request-message">
552
          <%= text_area 'message' %>
553
        </div>
554
        <div class="compare-open-pull-request-button">
555
          <%= submit_button 'Create pull request', class => 'btn btn-success' %>
556
        </div>
557
      </form>
558
    </div>
559
  % }
added base branch popup to c...
Yuki Kimoto authored on 2013-05-10
560

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
561
  % if (keys %$commits_date) {
562
    <ul class="compare-header">
563
      <li>
564
        <b><%= @$commits %></b> <span>commit</span>
565
      </li>
566
      <li>
567
        <b><%= $authors_count %></b> <span>contributor</span>
568
      </li>
569
      <li>
570
        
571
      </li>
572
      <li>
573
        
574
      </li>
575
    </ul>
improved compare page design
Yuki Kimoto authored on 2013-02-07
576
    
improve compare page design
Yuki Kimoto authored on 2016-02-04
577
    <div class="commits">
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
578
      % for my $date (reverse sort keys %$commits_date) {
579
        % my $commits = $commits_date->{$date};
580
        
improve compare page design
Yuki Kimoto authored on 2016-02-04
581
        <div class="commit-date">
582
          <i class="icon-off"></i><span>Commits on <%= $date %></span>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
583
        </div>
584
        
improve compare page design
Yuki Kimoto authored on 2016-02-04
585
        <ul class="compare-commits-date-container">
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
586
          % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) {
add user page link from user...
Yuki Kimoto authored on 2016-04-11
587
            <%
fix mail bug
Yuki Kimoto authored on 2016-04-21
588
              my $commit_author_email = $commit->{author_email};
add user page link from user...
Yuki Kimoto authored on 2016-04-11
589
              my $commit_author_id = app->dbi->model('user')->select(
590
                'id',
fix mail bug
Yuki Kimoto authored on 2016-04-21
591
                where => {email => $commit_author_email}
add user page link from user...
Yuki Kimoto authored on 2016-04-11
592
              )->value;
593
            %>
improve compare page design
Yuki Kimoto authored on 2016-02-04
594
            <li>
595
              <div class="compare-commits-author">
add user page link from user...
Yuki Kimoto authored on 2016-04-11
596
                <span title="<%= $commit->{author_email} %>">
597
                  % if (defined $commit_author_id) {
598
                    <a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a>
599
                  % } else {
600
                    <%= $commit->{author_name} %>
601
                  % }
602
                </span>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
603
              </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
604
              <div class="compare-commits-commit-title">
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
605
                <a style="color:#333" href="<%= url_for("/$base_user_id/$base_project_id/commit/$commit->{id}") %>">
improve compare page design
Yuki Kimoto authored on 2016-02-04
606
                  <%= $commit->{title_short} %>
607
                </a>
608
              </div>
609
              <div class="compare-commits-commit-id">
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
610
                <a href="<%= url_for("/$base_user_id/$base_project_id/commit/$commit->{id}") %>">
improve compare page design
Yuki Kimoto authored on 2016-02-04
611
                  <%= substr($commit->{id}, 0, 7) %>
612
                </a>
613
              </div>
614
            </li>
improved branches page and c...
Yuki Kimoto authored on 2013-05-07
615
          % }
improve compare page design
Yuki Kimoto authored on 2016-02-04
616
        </ul>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
617
      % }
improve compare page design
Yuki Kimoto authored on 2016-02-04
618
    </div>
619
  
cleanup merge and push logic
Yuki Kimoto authored on 2016-04-27
620
    %= include '/include/commit_body', %commit_body_args;
improve compare page design
Yuki Kimoto authored on 2016-02-04
621
  % } else {
improve compare page
Yuki Kimoto authored on 2016-04-12
622
    <div class="compare-nothing">
623
      <div>
624
        <b><big>There isn't anything to compare.</big></b>
625
      </div>
626
      <div>
show not able to merge
Yuki Kimoto authored on 2016-04-18
627
        <b>
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
628
          <%= $base_branch %></b> is up to date with all commits from
629
          <b><%= $target_branch %></b>.
630
          Try <a href="<%= url_for("/$base_user_id/$base_project_id/compare/$target_branch...$base_branch") %>">switching the base</a> for your comparison.
improve compare page
Yuki Kimoto authored on 2016-04-12
631
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
632
    </div>
633
  % }
634
</div>
635
%= include '/include/footer';