gitprep / templates / compare.html.ep /
Newer Older
675 lines | 23.809kb
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;
fix bug that new pull reqeus...
Yuki Kimoto authored on 2016-06-18
36
    $target_branch = $user_id_and_target_branch // $base_branch;
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
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,
fix pull reqeust error bug
Yuki Kimoto authored on 2016-08-19
84
            target_project => $target_project->{row_id},
add compare validation
Yuki Kimoto authored on 2016-05-04
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;
fix issue number bug
Yuki Kimoto authored on 2016-06-11
94
          $self->redirect_to("/$base_user_id/$base_project_id/pull/$issue->{number}");
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 issue number bug
Yuki Kimoto authored on 2016-06-11
101
          my $issue_number;
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
            
fix issue number bug
Yuki Kimoto authored on 2016-06-11
112
            # last pull request row id
fix compare page
Yuki Kimoto authored on 2016-06-11
113
            app->dbi->model('pull_request')->insert($new_pull_request);
114
            my $new_pull_request_row_id = app->dbi->execute("select LAST_INSERT_ROWID()")->value;
115
            
fix issue number bug
Yuki Kimoto authored on 2016-06-11
116
            # issue number
117
            $issue_number = app->dbi->model('issue')->select(
118
              'max(number)',
119
              where => {project => $project_row_id},
120
              append => 'group by project'
121
            )->value;
122
            $issue_number++;
123
            
fix compare page
Yuki Kimoto authored on 2016-06-11
124
            # New issue
125
            my $new_issue = {
add compare validation
Yuki Kimoto authored on 2016-05-04
126
              title => $title,
127
              open => 1,
128
              open_time => $now_epoch,
fix compare page
Yuki Kimoto authored on 2016-06-11
129
              open_user => $session_user_row_id,
fix issue number bug
Yuki Kimoto authored on 2016-06-11
130
              pull_request => $new_pull_request_row_id,
131
              project => $project_row_id,
132
              number => $issue_number
add compare validation
Yuki Kimoto authored on 2016-05-04
133
            };
fix compare page
Yuki Kimoto authored on 2016-06-11
134
            app->dbi->model('issue')->insert($new_issue);
fix issue number bug
Yuki Kimoto authored on 2016-06-11
135
            my $new_issue_row_id = app->dbi->execute("select LAST_INSERT_ROWID()")->value;
add compare validation
Yuki Kimoto authored on 2016-05-04
136
            
fix compare page
Yuki Kimoto authored on 2016-06-11
137
            # New issue message
138
            my $new_issue_message = {
fix pulls page
Yuki Kimoto authored on 2016-06-09
139
              issue => $new_issue_row_id,
fix compare page
Yuki Kimoto authored on 2016-06-11
140
              number => 1,
add compare validation
Yuki Kimoto authored on 2016-05-04
141
              message => $message,
142
              create_time => $now_epoch,
143
              update_time => $now_epoch,
144
              user => $session_user_row_id
145
            };
146
            
fix compare page
Yuki Kimoto authored on 2016-06-11
147
            app->dbi->model('issue_message')->insert($new_issue_message);
add compare validation
Yuki Kimoto authored on 2016-05-04
148
          });
fix create pull request logi...
Yuki Kimoto authored on 2016-04-23
149
          
fix issue number bug
Yuki Kimoto authored on 2016-06-11
150
          $self->redirect_to("/$base_user_id/$base_project_id/pull/$issue_number");
add compare validation
Yuki Kimoto authored on 2016-05-04
151
          return;
152
        }
153
      }
154
      else {
155
        $errors = $validation->messages;
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
156
      }
157
    }
158
  }
cleanup comapre
Yuki Kimoto authored on 2016-04-27
159

            
160
  # Can merge
fix compare branch link
Yuki Kimoto authored on 2016-04-28
161
  my $base_rep_info = app->rep_info($base_user_id, $base_project_id);
cleanup comapre
Yuki Kimoto authored on 2016-04-27
162
  my $merge_success;
fix compare branch link
Yuki Kimoto authored on 2016-04-28
163
  my $target_rep_info;
cleanup comapre
Yuki Kimoto authored on 2016-04-27
164
  if ($target_project) {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
165
    $target_rep_info = app->rep_info($target_user_id, $target_project->{id});
cleanup comapre
Yuki Kimoto authored on 2016-04-27
166
  }
167
  else {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
168
    $target_rep_info = $base_rep_info;
cleanup comapre
Yuki Kimoto authored on 2016-04-27
169
  }
170
    
171
  # Create working repository if it don't exist
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
172
  $self->app->manager->create_work_rep($base_user_id, $base_project_id);
cleanup comapre
Yuki Kimoto authored on 2016-04-27
173
  
174
  # Lock working repository
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
175
  my $work_rep_info = app->work_rep_info($base_user_id, $base_project_id);
cleanup comapre
Yuki Kimoto authored on 2016-04-27
176
  {
177
    my $lock_fh = $self->app->manager->lock_rep($work_rep_info);
178
    
179
    # Prepare merge
180
    $self->app->manager->prepare_merge(
181
      $work_rep_info,
fix compare branch link
Yuki Kimoto authored on 2016-04-28
182
      $base_rep_info,
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
183
      $base_branch,
fix compare branch link
Yuki Kimoto authored on 2016-04-28
184
      $target_rep_info,
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
185
      $target_branch
cleanup comapre
Yuki Kimoto authored on 2016-04-27
186
    );
187
    
188
    # Check merge automatically
189
    $merge_success = $self->app->manager->merge(
190
      $work_rep_info,
fix compare branch link
Yuki Kimoto authored on 2016-04-28
191
      $target_rep_info,
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
192
      $target_branch
cleanup comapre
Yuki Kimoto authored on 2016-04-27
193
    );
194
  }
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
195
  
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
196
  # Commits
fix compare page from forke...
Yuki Kimoto authored on 2016-08-20
197
  my $commits = $git->forward_commits(
198
    $work_rep_info,
199
    $base_rep_info,
200
    $base_branch,
201
    $target_rep_info,
202
    $target_branch
203
  );
204

            
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
205
  my $commits_count = @$commits;
206
  my $commits_date = {};
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
207
  my $authors = {};
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
208
  for my $commit (@$commits) {
support time zone
Yuki Kimoto authored on 2014-03-08
209
    my $date = $commit->{age_string_date_local};
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
210
    $commits_date->{$date} ||= [];
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
211
    $authors->{$commit->{author}} = 1;
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
212
    push @{$commits_date->{$date}}, $commit;
213
  }
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
214
  my $authors_count = keys %$authors;
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
215

            
216
  # Start commit
fix compare page from forke...
Yuki Kimoto authored on 2016-08-20
217
  my $start_commit_id = app->git->ref_to_object_id($base_rep_info, $base_branch);
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
218

            
219
  # End commit
fix compare page from forke...
Yuki Kimoto authored on 2016-08-20
220
  my $end_commit_id = app->git->ref_to_object_id($target_rep_info, $target_branch);
cleanup
Yuki Kimoto authored on 2013-05-13
221
  
fix compare page from forke...
Yuki Kimoto authored on 2016-08-20
222
  if (!$start_commit_id || !$end_commit_id) {
do success xt tests
Yuki Kimoto authored on 2016-03-25
223
    $self->reply->not_found;
cleanup
Yuki Kimoto authored on 2013-05-13
224
    return;
225
  }
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
226
  
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
227
  # Member projects
228
  my $member_projects = app->manager->member_projects($base_user_id, $base_project_id);
229
  unshift @$member_projects, $base_project;
230
  
fix compare branch link
Yuki Kimoto authored on 2016-04-28
231
  # Base branches
232
  my $base_branches = $git->branches($base_rep_info);
233
  @$base_branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$base_branches;
234

            
235
  # Target branches
236
  my $target_branches = $git->branches($target_rep_info);
237
  @$target_branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$target_branches;
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
238
  
add pull request form
Yuki Kimoto authored on 2016-04-12
239
  # Can open pull request
240
  my $can_open_pull_request;
241
  if (keys %$commits_date && $expand) {
242
    $can_open_pull_request = 1;
243
  }
244
  
cleanup merge and push logic
Yuki Kimoto authored on 2016-04-27
245
  # commit_body args
246
  my %commit_body_args = (
fix compare page from forke...
Yuki Kimoto authored on 2016-08-20
247
    rep_info => $work_rep_info,
248
    rev => $end_commit_id,
249
    from_rev => $start_commit_id
cleanup merge and push logic
Yuki Kimoto authored on 2016-04-27
250
  );
251

            
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
252
  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
253
%>
254

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

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

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

            
275

            
276
    // Change head fork
277
    $('#head-fork-btn').on('click', function () {
278
      $('#head-fork-popup')
279
        .css('display', 'block')
280
        .css('top', '40px')
281
        .css('left', '10px')
282
      ;
283
    });
284
    $('#head-fork-popup').on('click', function () {
285
      $('#head-fork-popup').css('display', 'none');
286
    });
287
    // close popup
288
    $(document).click(function() { $('#head-fork-popup').hide(); });
289
    $('#head-fork-btn').click(function() { event.stopPropagation(); });
290
    $('#head-fork-popup').click(function() { event.stopPropagation(); });
291

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
292
    // Change base branch
293
    $('#base-branch-btn').on('click', function () {
294
      $('#base-branch-popup')
295
        .css('display', 'block')
296
        .css('top', '40px')
297
        .css('left', '10px')
298
      ;
299
    });
300
    $('#base-branch-close').on('click', function () {
301
      $('#base-branch-popup').css('display', 'none');
302
    });
303
    $('[name=base-branch]').on('keypress', function (e) {
304
      // Enter
305
      if (e.which == 13) {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
306
        var href;
improve compare page popup
Yuki Kimoto authored on 2016-04-28
307
        % if ($base_user_id eq $target_user_id) {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
308
          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
309
        % } else {
fix compare branch link
Yuki Kimoto authored on 2016-04-28
310
          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
311
        % }
312
        
show not able to merge
Yuki Kimoto authored on 2016-04-18
313
        if (<%= $expand ? 1 : 0 %>) {
314
          href = href + '?expand=1';
315
        }
fix compare branch link
Yuki Kimoto authored on 2016-04-28
316
        
show not able to merge
Yuki Kimoto authored on 2016-04-18
317
        location.href = href;
improve compare page design
Yuki Kimoto authored on 2016-02-04
318
      }
319
    });
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
320
    // close popup
improve compare page popup
Yuki Kimoto authored on 2016-04-28
321
    $(document).click(function() { $('#base-branch-popup').hide(); });
322
    $('#base-branch-btn').click(function() { event.stopPropagation(); });
323
    $('#base-branch-popup').click(function() { event.stopPropagation(); });
show not able to merge
Yuki Kimoto authored on 2016-04-18
324
    
improve compare page design
Yuki Kimoto authored on 2016-02-04
325
    // Change compare branch
fix compare branch link
Yuki Kimoto authored on 2016-04-28
326
    $('#target-branch-btn').on('click', function () {
327
      $('#target-branch-popup')
improve compare page design
Yuki Kimoto authored on 2016-02-04
328
        .css('display', 'block')
329
        .css('top', '40px')
330
        .css('left', '96px')
331
      ;
332
    });
fix compare branch link
Yuki Kimoto authored on 2016-04-28
333
    $('#target-branch-close').on('click', function () {
334
      $('#target-branch-popup').css('display', 'none');
improve compare page design
Yuki Kimoto authored on 2016-02-04
335
    });
fix compare branch link
Yuki Kimoto authored on 2016-04-28
336
    $('[name=target-branch]').on('keypress', function (e) {
improve compare page design
Yuki Kimoto authored on 2016-02-04
337
      // Enter
338
      if (e.which == 13) {
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
339
        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
340
        if (<%= $expand ? 1 : 0 %>) {
341
          href = href + '?expand=1';
342
        }
343
        location.href = href;
improve compare page design
Yuki Kimoto authored on 2016-02-04
344
      }
improved compare page design
Yuki Kimoto authored on 2013-02-07
345
    });
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
346
    // close popup
fix compare branch link
Yuki Kimoto authored on 2016-04-28
347
    $(document).click(function() { $('#target-branch-popup').hide(); });
348
    $('#target-branch-btn').click(function() { event.stopPropagation(); });
349
    $('#target-branch-popup').click(function() { event.stopPropagation(); });
improve compare page popup
Yuki Kimoto authored on 2016-04-28
350

            
imrpvoe pull request form
Yuki Kimoto authored on 2016-07-09
351
    %= include '/include/add_issue_form_js';
improve compare page design
Yuki Kimoto authored on 2016-02-04
352
  });
353
% end
cleanup
Yuki Kimoto authored on 2013-02-04
354

            
add compare across forks btn...
Yuki Kimoto authored on 2016-08-18
355
%= javascript begin
356
  $(document).ready(function () {
357
    $('#comapre-across-btn').on('click', function () {
358
      $('#base-fork-btn').toggle();
359
      $('#head-fork-btn').toggle();
360
    });
361
  });
362
% end
363

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

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
366
<div class="container">
add compare validation
Yuki Kimoto authored on 2016-05-04
367
  %= include '/include/errors', errors => $errors;
368
  
add pull request form
Yuki Kimoto authored on 2016-04-12
369
  <div class="topic1">
370
    % if ($can_open_pull_request) {
371
      Open a pull request
372
    % } else {
add compare across forks btn...
Yuki Kimoto authored on 2016-08-18
373
      Compare changes
add pull request form
Yuki Kimoto authored on 2016-04-12
374
    % }
375
  </div>
add compare across forks btn...
Yuki Kimoto authored on 2016-08-18
376
  <div class="compare-desc">
377
    Compare changes across branches, commits, tags, and more below. If you need to, you can also <a href="javascript:void(0)" id="comapre-across-btn">compare across forks</a>.
378
  </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
379
  <div class="compare-select">
380
    <div>
381
      <div>
improve compare page popup
Yuki Kimoto authored on 2016-04-28
382
        <div style="display:inline-block">
add compare across forks btn...
Yuki Kimoto authored on 2016-08-18
383
          <button id="base-fork-btn" class="btn btn-small" style="<%= $base_user_id eq $target_user_id ? 'display:none' : '' %>">
384
            <span>base fork:</span><b> <%= $base_project->{'user.id'} %>/<%= $base_project->{id} %></b><i class="icon-arrow-down"></i>
385
          </button>
improve compare page popup
Yuki Kimoto authored on 2016-04-28
386
          <button id="base-branch-btn" class="btn btn-small">
387
            <span>base:</span><b> <%= $base_branch %></b><i class="icon-arrow-down"></i>
388
          </button>
389
          ...
390
        </div>
complete pull request logic
Yuki Kimoto authored on 2016-04-28
391
        <div style="display:inline-block;margin-top:10px;">
add compare across forks btn...
Yuki Kimoto authored on 2016-08-18
392
          <button id="head-fork-btn" class="btn btn-small" style="<%= $base_user_id eq $target_user_id ? 'display:none' : '' %>">
393
            <span>head fork:</span><b> <%= $target_project->{'user.id'} %>/<%= $target_project->{id} %></b><i class="icon-arrow-down"></i>
394
          </button>
fix compare branch link
Yuki Kimoto authored on 2016-04-28
395
          <button id="target-branch-btn" class="btn btn-small">
improve compare page popup
Yuki Kimoto authored on 2016-04-28
396
            <span>compare:</span> <b><%= $target_branch %></b><i class="icon-arrow-down"></i>
397
          </button>
add compare across forks btn...
Yuki Kimoto authored on 2016-08-18
398
          
improve compare page popup
Yuki Kimoto authored on 2016-04-28
399
          % if ($can_open_pull_request) {
400
            % if ($merge_success) {
401
              <span style="margin-left:10px">
402
                <span style="color:green;font-weight:bold"><%= "\x{2714}" %>Able to merge.</span> These branches can be automatically merged.
403
              </span>
404
            % } else {
405
              <span style="margin-left:10px">
issue belong to project
Yuki Kimoto authored on 2016-06-11
406
                <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
407
              </span>
408
            % }
show not able to merge
Yuki Kimoto authored on 2016-04-18
409
          % }
improve compare page popup
Yuki Kimoto authored on 2016-04-28
410
        </div>
cleanup
Yuki Kimoto authored on 2013-03-15
411
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
412
    </div>
show not able to merge
Yuki Kimoto authored on 2016-04-18
413

            
414
    <div id="base-branch-popup" style="display:none;width:330px;position:absolute">
415
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
416
        <div style="overflow:hidden">
417
          <div style="float:left;width:90%;">
418
            <b>Choose a base branch</b>
419
          </div>
420
          <div style="float:left:width:10%;text-align:right;">
421
            <i id="base-branch-close" class="icon-remove-circle"></i>
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
422
          </div>
show pull request only when ...
Yuki Kimoto authored on 2016-04-18
423
        </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
424
      </div>
show not able to merge
Yuki Kimoto authored on 2016-04-18
425
      <div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0">
426
        %= text_field 'base-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker';
427
      </div>
428
      <div style="background:white;max-height:500px;overflow:auto;">
429
        <ul class="nav nav-tabs nav-stacked">
fix compare branch link
Yuki Kimoto authored on 2016-04-28
430
          % for (my $i = 0; $i < @$base_branches; $i++) {
431
            % my $branch = $base_branches->[$i];
show not able to merge
Yuki Kimoto authored on 2016-04-18
432
              <li>
fix compare branch link
Yuki Kimoto authored on 2016-04-28
433
                <%
434
                  my $url;
435
                  if ($base_user_id eq $target_user_id) {
436
                    $url = url_with("/$base_user_id/$base_project_id/compare/$branch->{name}...$target_branch");
437
                  }
438
                  else {
439
                    $url = url_with("/$base_user_id/$base_project_id/compare/$branch->{name}...$target_user_id:$target_branch");
440
                  }
441
                %>
show not able to merge
Yuki Kimoto authored on 2016-04-18
442
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;"
fix compare branch link
Yuki Kimoto authored on 2016-04-28
443
                  href="<%= $url  %>">
show not able to merge
Yuki Kimoto authored on 2016-04-18
444
                  <%= $branch->{name} %>
445
                </a>
446
              </li>
447
          % }
448
        </ul>
449
      </div>
450
    </div>
451

            
fix compare branch link
Yuki Kimoto authored on 2016-04-28
452
    <div id="target-branch-popup" style="display:none;width:330px;position:absolute">
improve compare page design
Yuki Kimoto authored on 2016-02-04
453
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
454
        <div style="overflow:hidden">
455
          <div style="float:left;width:90%;">
456
            <b>Choose a compare branch</b>
457
          </div>
458
          <div style="float:left:width:10%;text-align:right;">
fix compare branch link
Yuki Kimoto authored on 2016-04-28
459
            <i id="target-branch-close" class="icon-remove-circle"></i>
added compare branch popup t...
Yuki Kimoto authored on 2013-05-10
460
          </div>
461
        </div>
462
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
463
      <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
464
        %= 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
465
      </div>
466
      <div style="background:white;max-height:500px;overflow:auto;">
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
467
        <ul class="nav nav-tabs nav-stacked">
468
          % for (my $i = 0; $i < @$target_branches; $i++) {
469
            % my $target_branch = $target_branches->[$i];
470
              <li>
471
                <%
472
                  my $url;
473
                  if ($base_user_id eq $target_user_id) {
474
                    $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch->{name}");
475
                  }
476
                  else {
477
                    $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_user_id:$target_branch->{name}");
478
                  }
479
                %>
480
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>">
481
                  <%= $target_branch->{name} %>
482
                </a>
483
              </li>
484
          % }
485
        </ul>
486
      </div>
487
    </div>
488

            
489

            
490
    <div id="base-fork-popup" style="display:none;width:330px;position:absolute">
491
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
492
        <div style="overflow:hidden">
493
          <div style="float:left;width:90%;">
494
            <b>Choose a base fork</b>
495
          </div>
496
          <div style="float:left:width:10%;text-align:right;">
497
            <i id="member-project-close" class="icon-remove-circle"></i>
498
          </div>
499
        </div>
500
      </div>
501
      <div style="background:white;max-height:500px;overflow:auto;">
502
        <ul class="nav nav-tabs nav-stacked">
503
          % for (my $i = 0; $i < @$member_projects; $i++) {
504
            % my $member_project = $member_projects->[$i];
fix compare branch link
Yuki Kimoto authored on 2016-04-28
505
              <%
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
506
                my $member_user_id = $member_project->{'user.id'};
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
507
                my $member_project_id = $member_project->{id};
fix compare branch link
Yuki Kimoto authored on 2016-04-28
508
              %>
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
509
              <li>
510
                <%
511
                  my $url;
512
                  if ($member_user_id eq $target_user_id) {
513
                    $url = url_with("/$member_user_id/$member_project_id/compare/$base_branch...$target_branch");
514
                  }
515
                  else {
516
                    $url = url_with("/$member_user_id/$member_project_id/compare/$base_branch...$target_user_id:$target_branch");
517
                  }
518
                %>
519
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>">
520
                  <%= $member_user_id %>/<%= $member_project_id %>
521
                </a>
522
              </li>
523
          % }
524
        </ul>
525
      </div>
526
    </div>
527

            
528

            
529

            
530

            
531
    <div id="head-fork-popup" style="display:none;width:330px;position:absolute">
532
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
533
        <div style="overflow:hidden">
534
          <div style="float:left;width:90%;">
535
            <b>Choose a head fork</b>
536
          </div>
537
          <div style="float:left:width:10%;text-align:right;">
538
            <i id="member-project-close" class="icon-remove-circle"></i>
539
          </div>
540
        </div>
541
      </div>
542
      <div style="background:white;max-height:500px;overflow:auto;">
543
        <ul class="nav nav-tabs nav-stacked">
544
          % for (my $i = 0; $i < @$member_projects; $i++) {
545
            % my $member_project = $member_projects->[$i];
546
              <%
remove table __ prefix
Yuki Kimoto authored on 2016-06-11
547
                my $member_user_id = $member_project->{'user.id'};
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
548
                my $member_project_id = $member_project->{id};
549
              %>
550
              <li>
551
                <%
552
                  my $url;
553
                  if ($member_user_id eq $base_user_id) {
554
                    $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$target_branch");
555
                  }
556
                  else {
557
                    $url = url_with("/$base_user_id/$base_project_id/compare/$base_branch...$member_user_id:$target_branch");
558
                  }
559
                %>
560
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= $url %>">
561
                  <%= $member_user_id %>/<%= $member_project_id %>
562
                </a>
563
              </li>
564
          % }
565
        </ul>
improve compare page design
Yuki Kimoto authored on 2016-02-04
566
      </div>
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
567
    </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
568
  </div>
fix compare base and head fo...
Yuki Kimoto authored on 2016-04-28
569
 
complete pull request logic
Yuki Kimoto authored on 2016-04-28
570
  % if (keys %$commits_date && $merge_success) {
imrpvoe pull request form
Yuki Kimoto authored on 2016-07-09
571
    <div class="issue-add-comment" style="width:80%">
add create pull request logi...
Yuki Kimoto authored on 2016-04-19
572
      <form action="<%= url_for %>" method="post">
573
        <%= hidden_field op => 'create-pull-request' %>
imrpvoe pull request form
Yuki Kimoto authored on 2016-07-09
574
        <div class="issue-add-comment-header">
575
          <div class="issue-add-comment-title">
576
            <%= text_field 'title' => $commits->[0]{title_short} %>
577
          </div>
cleanup issue preview
Yuki Kimoto authored on 2016-07-25
578
          <div class="issue-message-write-tab issue-add-comment-header-tab"><a href="javascript:void(0)">Write</a></div>
579
          <div class="issue-message-preview-tab issue-add-comment-header-tab"><a class="disable" href="javascript:void(0)">Preview</a></div>
580
          %= include '/include/issue_comment_icon';
add pull request form
Yuki Kimoto authored on 2016-04-12
581
        </div>
imrpvoe pull request form
Yuki Kimoto authored on 2016-07-09
582
        <div class="issue-add-comment-body">
cleanup issue preview
Yuki Kimoto authored on 2016-07-25
583
          <div class="issue-message-write-area issue-add-comment-message">
imrpvoe pull request form
Yuki Kimoto authored on 2016-07-09
584
            <%= text_area 'message' %>
585
          </div>
cleanup issue preview
Yuki Kimoto authored on 2016-07-25
586
          <div class="issue-message-preview-area issue-add-comment-preview markdown-body" style="padding:10px">
imrpvoe pull request form
Yuki Kimoto authored on 2016-07-09
587
          </div>
588
          <div class="issue-add-comment-bottom">
589
            <div class="issue-add-comment-button-left">
590
              Styling with Markdown is supported
591
            </div>
592
            <div class="issue-add-comment-button">
593
              <input type="submit" value="Create pull request" class="btn btn-success">
594
            </div>
595
          </div>
add pull request form
Yuki Kimoto authored on 2016-04-12
596
        </div>
597
      </form>
598
    </div>
599
  % }
added base branch popup to c...
Yuki Kimoto authored on 2013-05-10
600

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
601
  % if (keys %$commits_date) {
602
    <ul class="compare-header">
603
      <li>
604
        <b><%= @$commits %></b> <span>commit</span>
605
      </li>
606
      <li>
607
        <b><%= $authors_count %></b> <span>contributor</span>
608
      </li>
609
      <li>
610
        
611
      </li>
612
      <li>
613
        
614
      </li>
615
    </ul>
improved compare page design
Yuki Kimoto authored on 2013-02-07
616
    
improve compare page design
Yuki Kimoto authored on 2016-02-04
617
    <div class="commits">
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
618
      % for my $date (reverse sort keys %$commits_date) {
619
        % my $commits = $commits_date->{$date};
620
        
improve compare page design
Yuki Kimoto authored on 2016-02-04
621
        <div class="commit-date">
622
          <i class="icon-off"></i><span>Commits on <%= $date %></span>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
623
        </div>
624
        
improve compare page design
Yuki Kimoto authored on 2016-02-04
625
        <ul class="compare-commits-date-container">
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
626
          % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) {
add user page link from user...
Yuki Kimoto authored on 2016-04-11
627
            <%
fix mail bug
Yuki Kimoto authored on 2016-04-21
628
              my $commit_author_email = $commit->{author_email};
add user page link from user...
Yuki Kimoto authored on 2016-04-11
629
              my $commit_author_id = app->dbi->model('user')->select(
630
                'id',
fix mail bug
Yuki Kimoto authored on 2016-04-21
631
                where => {email => $commit_author_email}
add user page link from user...
Yuki Kimoto authored on 2016-04-11
632
              )->value;
633
            %>
improve compare page design
Yuki Kimoto authored on 2016-02-04
634
            <li>
635
              <div class="compare-commits-author">
add user page link from user...
Yuki Kimoto authored on 2016-04-11
636
                <span title="<%= $commit->{author_email} %>">
637
                  % if (defined $commit_author_id) {
638
                    <a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a>
639
                  % } else {
640
                    <%= $commit->{author_name} %>
641
                  % }
642
                </span>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
643
              </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
644
              <div class="compare-commits-commit-title">
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
645
                <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
646
                  <%= $commit->{title_short} %>
647
                </a>
648
              </div>
649
              <div class="compare-commits-commit-id">
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
650
                <a href="<%= url_for("/$base_user_id/$base_project_id/commit/$commit->{id}") %>">
improve compare page design
Yuki Kimoto authored on 2016-02-04
651
                  <%= substr($commit->{id}, 0, 7) %>
652
                </a>
653
              </div>
654
            </li>
improved branches page and c...
Yuki Kimoto authored on 2013-05-07
655
          % }
improve compare page design
Yuki Kimoto authored on 2016-02-04
656
        </ul>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
657
      % }
improve compare page design
Yuki Kimoto authored on 2016-02-04
658
    </div>
659
  
cleanup merge and push logic
Yuki Kimoto authored on 2016-04-27
660
    %= include '/include/commit_body', %commit_body_args;
improve compare page design
Yuki Kimoto authored on 2016-02-04
661
  % } else {
improve compare page
Yuki Kimoto authored on 2016-04-12
662
    <div class="compare-nothing">
663
      <div>
664
        <b><big>There isn't anything to compare.</big></b>
665
      </div>
666
      <div>
show not able to merge
Yuki Kimoto authored on 2016-04-18
667
        <b>
fix pull_request table bug
Yuki Kimoto authored on 2016-04-27
668
          <%= $base_branch %></b> is up to date with all commits from
669
          <b><%= $target_branch %></b>.
670
          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
671
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
672
    </div>
673
  % }
674
</div>
675
%= include '/include/footer';