gitprep / templates / issues.html.ep /
Newer Older
132 lines | 4.512kb
add issue page
Yuki Kimoto authored on 2016-06-06
1
<%
2
  # API
3
  my $api = gitprep_api;
4

            
5
  # Parameters
6
  my $user_id = param('user');
7
  my $project_id = param('project');
8
  
add issues page
Yuki Kimoto authored on 2016-06-18
9
  my $is = param('is') // '';
add issue page
Yuki Kimoto authored on 2016-06-06
10
  
add issues page
Yuki Kimoto authored on 2016-06-18
11
  my $open = $is eq 'closed' ? 0 : 1;
12
  
13
  # Git
14
  my $git = $self->app->git;
15
  
fix issue count bugs
Yuki Kimoto authored on 2016-08-23
16
  # Project row id
17
  my $project_row_id = $api->get_project_row_id($user_id, $project_id);
18
  
add issues page
Yuki Kimoto authored on 2016-06-18
19
  # Issues(which don't have pull request)
20
  my $issues = app->dbi->model('issue')->select(
21
    [
22
      {__MY__ => '*'},
23
      {open_user => ['id']},
24
    ],
25
    where => [
fix issue count bugs
Yuki Kimoto authored on 2016-08-23
26
      ['and', ':issue.open{=}', 'pull_request = 0', ':project{=}'],
27
      {'issue.open' => $open, project => $project_row_id}
add issues page
Yuki Kimoto authored on 2016-06-18
28
    ]
29
  )->all;
30
  
31
  # Open count
add open issue count to head...
Yuki Kimoto authored on 2016-08-23
32
  my $open_count = $api->get_open_issue_count($user_id, $project_id);
add issues page
Yuki Kimoto authored on 2016-06-18
33
  
34
  # Close count
add open issue count to head...
Yuki Kimoto authored on 2016-08-23
35
  my $close_count = $api->get_close_issue_count($user_id, $project_id);
add label initialize logic
Yuki Kimoto authored on 2016-07-26
36
  
37
  # Initialize labels if there are no labels
fix for bug #117 as suggeste...
Bernhard Pfeifer authored on 2016-09-28
38
  my $labels_count = app->dbi->model('label')->select('count(*)', where => {'user.id' => $user_id, 'project.id' => $project_id})->value;
add label initialize logic
Yuki Kimoto authored on 2016-07-26
39
  if ($labels_count == 0) {
40
    my @labels = (
41
      {id => 'bug', color => '#fc2929'},
42
      {id => 'duplicate', color => '#cccccc'},
43
      {id => 'enhancement', color => '#84b6eb'},
44
      {id => 'invalid', color => '#e6e6e6'},
45
      {id => 'question', color => '#cc317c'},
46
      {id => 'wontfix', color => '#ffffff'}
47
    );
48
    for my $label (@labels) {
49
      my $project_row_id = app->dbi->model('project')->select(
50
        'project.row_id',
51
        where => {'user.id' => $user_id, 'project.id' => $project_id}
52
      )->value;
53
      $label->{project} = $project_row_id;
54
      app->dbi->model('label')->insert($label);
55
    }
56
  }
add issue page
Yuki Kimoto authored on 2016-06-06
57

            
support markdown table
Yuki Kimoto authored on 2016-06-18
58
  layout 'common', title => "Issues - $user_id/$project_id";
59
%>
add issue page
Yuki Kimoto authored on 2016-06-06
60
  
61
  %= include '/include/header';
62
  
63
  <div class="container">
add labels page
Yuki Kimoto authored on 2016-07-25
64
    <div class="issues-button-container">
65
      <div class="issues-button-container-left">
66
        <div class="issues-labels"><a href="<%= url_for("/$user_id/$project_id/labels") %>">Labels</a></div>
67
      </div>
68
      <div class="issues-button-container-right">
add labels to issues
Yuki Kimoto authored on 2016-08-02
69
        % if ($api->logined) {
70
          <a href="<%= url_for("/$user_id/$project_id/issues/new") %>" class="btn btn-success">New issue</a>
71
        % }
add labels page
Yuki Kimoto authored on 2016-07-25
72
      </div>
add issues page
Yuki Kimoto authored on 2016-06-18
73
    </div>
add labels page
Yuki Kimoto authored on 2016-07-25
74
    <div class="issues">
75
      <div class="issues-header">
add issues page
Yuki Kimoto authored on 2016-06-18
76
        % if ($open) {
77
          <b><%= $open_count %> Open</b>
78
          <a href="<%= url_with->query([is => 'closed']) %>" style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</a>
79
        % } else {
80
          <a  style="margin-left:5px;color:#767676" href="<%= url_with->query([is => undef]) %>"><%= $open_count %> Open</a>
81
          <b>
82
            <span style="margin-left:5px;color:#767676"><%= "\x{2714}" %><%= $close_count %> Closed</span>
83
          </b>
84
        % }
85
      </div>
add labels page
Yuki Kimoto authored on 2016-07-25
86
      <div class="issues-body">
add issues page
Yuki Kimoto authored on 2016-06-18
87
        % if (@$issues) {
88
          <ul>
89
            % for my $issue (@$issues) {
add labels to issues
Yuki Kimoto authored on 2016-08-02
90
              <%
91
                my $issue_labels = app->dbi->model('issue_label')->select(
92
                  {label => ['id', 'color']},
93
                  where => {issue => $issue->{row_id}}
94
                )->all;
95
              %>
96

            
add issues page
Yuki Kimoto authored on 2016-06-18
97
              <%
98
                my $open_time = $issue->{open_time};
99
                my $open_time_age = Time::Moment->now->epoch - $open_time;
100
                my $open_time_age_string = $self->app->git->_age_string($open_time_age);
101
              %>
102
              <li>
add labels page
Yuki Kimoto authored on 2016-07-25
103
                <div class="issues-title">
fix issues link bugs
Yuki Kimoto authored on 2016-08-03
104
                  <a href="<%= url_for("/$user_id/$project_id/issues/$issue->{number}") %>">
add issues page
Yuki Kimoto authored on 2016-06-18
105
                    <b><%= $issue->{title} %></b>
106
                  </a>
add labels to issues
Yuki Kimoto authored on 2016-08-02
107
                  <ul class="issues-label-pallet">
108
                    % for my $issue_label (@$issue_labels) {
109
                      <li style="background:<%= $issue_label->{'label.color'} %>">
110
                        <%= $issue_label->{'label.id'} %>
111
                      </li>
112
                    % }
113
                  </ul>
add issues page
Yuki Kimoto authored on 2016-06-18
114
                </div>
add labels page
Yuki Kimoto authored on 2016-07-25
115
                <div class="issues-description">
add issues page
Yuki Kimoto authored on 2016-06-18
116
                  #<%= $issue->{number} %> <%= $issue->{open} ? 'opened' : 'closed' %>
117
                  <%= $open_time_age_string %>
118
                  by <%= $issue->{'open_user.id'} %>
119
                </div>
120
              </li>
121
            % }
122
          </ul>
123
        % } else {
add labels page
Yuki Kimoto authored on 2016-07-25
124
          <div class="issues-no-request">
add issues page
Yuki Kimoto authored on 2016-06-18
125
            <div style="font-size:18px"><b>There aren’t any issues.</b></div>
126
          </div>
127
        % }
128
      </div>
129
    </div>
add issue page
Yuki Kimoto authored on 2016-06-06
130
  </div>
131
  
132
  %= include '/include/footer';