gitprep / templates / commit.html.ep /
Newer Older
158 lines | 5.193kb
cleanup
Yuki Kimoto authored on 2013-01-28
1
<%
2
  # API
cleanup
Yuki Kimoto authored on 2013-03-19
3
  my $api = gitprep_api;
cleanup
Yuki Kimoto authored on 2013-01-28
4
  
cleanup
Yuki Kimoto authored on 2013-02-01
5
  # Paramters
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
6
  my $user_id = param('user');
7
  my $project_id = param('project');
cleanup
Yuki Kimoto authored on 2013-02-01
8
  my $diff = param('diff');
cleanup
Yuki Kimoto authored on 2013-05-31
9
  my ($from_rev, $rev) = $diff =~ /(.+)\.\.(.+)/;
10
  $rev = $diff unless defined $rev;
cleanup
Yuki Kimoto authored on 2013-01-28
11
  
12
  # Git
revert encoding support
Yuki Kimoto authored on 2013-11-22
13
  my $git = app->git;
cleanup
Yuki Kimoto authored on 2013-02-01
14
  
cleanup
Yuki Kimoto authored on 2013-01-28
15
  # Commit
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
16
  my $commit = $git->get_commit(app->rep_info($user_id, $project_id), $rev);
remove warning
Yuki Kimoto authored on 2014-02-17
17
  
cleanup
Yuki Kimoto authored on 2013-05-13
18
  unless ($commit) {
do success xt tests
Yuki Kimoto authored on 2016-03-25
19
    $self->reply->not_found;
cleanup
Yuki Kimoto authored on 2013-05-13
20
    return;
21
  }
cleanup
Yuki Kimoto authored on 2013-01-28
22
  my $author_date
23
    = $git->parse_date($commit->{author_epoch}, $commit->{author_tz});
cleanup
Yuki Kimoto authored on 2013-02-01
24
  my $committer_date
25
    = $git->parse_date($commit->{committer_epoch}, $commit->{committer_tz});
cleanup
Yuki Kimoto authored on 2013-01-28
26
  $commit->{author_date} = $git->timestamp($author_date);
27
  $commit->{committer_date} = $git->timestamp($committer_date);
cleanup
Yuki Kimoto authored on 2013-05-31
28
  $from_rev = $commit->{parent} unless defined $from_rev;
add title
Yuki Kimoto authored on 2013-06-12
29
  my $commit_short_id = substr($commit->{id}, 0, 7, );
fix mail bug
Yuki Kimoto authored on 2016-04-21
30
  my $commit_author_email = $commit->{author_email};
add user page link from user...
Yuki Kimoto authored on 2016-04-11
31
  my $commit_author_id = app->dbi->model('user')->select(
32
    'id',
fix mail bug
Yuki Kimoto authored on 2016-04-21
33
    where => {email => $commit_author_email}
add user page link from user...
Yuki Kimoto authored on 2016-04-11
34
  )->value;
impved merge commit logic
Yuki Kimoto authored on 2013-06-01
35
  
added branch and tag refs to...
Yuki Kimoto authored on 2013-04-26
36
  # Branches
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
37
  my $branch_refs = $git->references(app->rep_info($user_id, $project_id), 'heads');
added branch and tag refs to...
Yuki Kimoto authored on 2013-04-26
38
  my $branches = $branch_refs->{$commit->{id}} || [];
39
  
40
  # Tags
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
41
  my $tag_refs = $git->references(app->rep_info($user_id, $project_id), 'tags');
improved commit page design
Yuki Kimoto authored on 2013-04-26
42
  my $tags = $tag_refs->{$commit->{id}} || [];
added branch and tag refs to...
Yuki Kimoto authored on 2013-04-26
43
  
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
44
  # commit_body args
45
  my %commit_body_args = (
46
    user => $user_id,
47
    project => $project_id,
cleanup
Yuki Kimoto authored on 2013-05-31
48
    rev => $rev,
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
49
    from_rev => $from_rev
improved commit page blobdif...
Yuki Kimoto authored on 2013-02-01
50
  );
cleanup
Yuki Kimoto authored on 2013-01-28
51

            
improve commits page design
Yuki Kimoto authored on 2016-02-01
52
  layout 'common', title => "$commit->{title_short} \x{30fb} $commit_short_id";
53
%>
add diff status bar to commi...
Yuki Kimoto authored on 2013-05-30
54

            
improve commits page design
Yuki Kimoto authored on 2016-02-01
55
%= include '/include/header';
copy gitweblite soruce code
root authored on 2012-11-23
56

            
improve commits page design
Yuki Kimoto authored on 2016-02-01
57
<div class="container">
58
  <ul class="commits-summary">
59
    <li>
60
      <ul class="commits-summary-header">
61
        <li>
62
          <div>
fixed commit page comment bu...
Yuki Kimoto authored on 2013-04-26
63
            % if ($commit->{title_short} eq $commit->{title}) {
64
              <b><%= $commit->{title_short} %></b>;
65
            % } else {
66
              <%
67
                my $title_short = $commit->{title_short};
68
                $title_short =~ s/\.\.\.\s*$//;
69
                my $title_tail = $commit->{title};
70
                $title_tail =~ s/^\Q$title_short//;
71
                $title_tail =~ s/^\s+//;
72
              %>
improve commits page design
Yuki Kimoto authored on 2016-02-01
73
              <p><b><%= $title_short %>...</b></p>
74
              <p>...<%= $title_tail %></p>
cleanup
Yuki Kimoto authored on 2013-03-15
75
            % }
improve commits page design
Yuki Kimoto authored on 2016-02-01
76
          </div>
77

            
78
          % if (@{$commit->{comment}} > 1) {
fixed commit page comment bu...
Yuki Kimoto authored on 2013-04-26
79
            <div>
improve commits page design
Yuki Kimoto authored on 2016-02-01
80
              % for (my $i = 1; $i < @{$commit->{comment}}; $i++) {
81
                <div>
82
                  <%= $commit->{comment}[$i] %>
83
                </div>
84
              % }
fixed commit page comment bu...
Yuki Kimoto authored on 2013-04-26
85
            </div>
86
          % }
improve commits page design
Yuki Kimoto authored on 2016-02-01
87
          % if (@$branches || @$tags) {
improved commit page parents...
Yuki Kimoto authored on 2013-06-02
88
            <div>
improve commits page design
Yuki Kimoto authored on 2016-02-01
89
              % for my $branch (@$branches) {
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
90
                <i class="icon-share-alt" style="padding-right:1px"></i><a href="<%= url_for("/$user_id/$project_id/tree/$branch") %>"><%= $branch %></a>
improve commits page design
Yuki Kimoto authored on 2016-02-01
91
              % }
improved commit page parents...
Yuki Kimoto authored on 2013-06-02
92
              
improve commits page design
Yuki Kimoto authored on 2016-02-01
93
              % for my $tag (@$tags) {
94
                <span style="padding-left:5px">
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
95
                  <i class="icon-tag" style="padding-right:2px"></i><a href="<%= url_for("/$user_id/$project_id/tree/$tag") %>"><%= $tag %></a>
improve commits page design
Yuki Kimoto authored on 2016-02-01
96
                </span>
97
              % }
improved commit page parents...
Yuki Kimoto authored on 2013-06-02
98
            </div>
fixed commit page comment bu...
Yuki Kimoto authored on 2013-04-26
99
          % }
improve commits page design
Yuki Kimoto authored on 2016-02-01
100
        </li>
101
        <li class="last-child">
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
102
          <a class="btn btn-primary" href="<%= url_for("/$user_id/$project_id/tree/$commit->{id}") %>">
improve commits page design
Yuki Kimoto authored on 2016-02-01
103
            Browse files
104
          </a>
105
        </li>
106
      </ul>
107
    </li>
108
    <li class="last-child">
improve commit page design
Yuki Kimoto authored on 2016-02-02
109
      <ul class="commits-summary-body">
110
        <li>
add user page link from user...
Yuki Kimoto authored on 2016-04-11
111
          <span class="commits-summary-author">
112
            % if (defined $commit_author_id) {
113
              <a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a>
114
            % } else {
115
              <%= $commit->{author_name} %>
116
            % }
117
          </span>
improve commit page design
Yuki Kimoto authored on 2016-02-02
118
          <span>commited on <span title="<%= $commit->{age_string_datetime_local} %>"><%= $commit->{age_string_date_local} %></span>
119
        </li>
120
        <li class="last-child">
121
          % my $parents = $commit->{parents};
122
          
123
          % if (@$parents == 0) {
124
            <div class="commits-summary-parent">
125
              <span>0 parent</span>
126
            </div>
127
          % } elsif (@$parents == 1) {
128
            <div class="commits-summary-parent">
129
              <span>1 parent</span>
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
130
              <a href="<%= url_for("/$user_id/$project_id/commit/$parents->[0]") %>">
improve commit page design
Yuki Kimoto authored on 2016-02-02
131
                <%= substr($parents->[0], 0, 7) %>
132
              </a>
133
            </div>
134
          % } else {
135
            <div class="commits-summary-parent">
136
              <span>2 parents</span>:
137
              
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
138
              <a class="font-black" href="<%= url_for("/$user_id/$project_id/commit/$parents->[0]") %>">
improve commit page design
Yuki Kimoto authored on 2016-02-02
139
                <%= substr($parents->[0], 0, 7) %>
140
              </a>
141
              +
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
142
              <a class="font-black" href="<%= url_for("/$user_id/$project_id/commit/$parents->[1]") %>">
improve commit page design
Yuki Kimoto authored on 2016-02-02
143
                <%= substr($parents->[1], 0, 7) %>
144
              </a>
145
            </div>
146
          % }
147
          <div class="commits-summary-commit-id">
148
            commit <span><%= $commit->{id} %></span>
improve commits page design
Yuki Kimoto authored on 2016-02-01
149
          </div>
improve commit page design
Yuki Kimoto authored on 2016-02-02
150
        </li>
151
      </ul>
improve commits page design
Yuki Kimoto authored on 2016-02-01
152
    </li>
153
  </ul>
154

            
cleanup commit_body logic
Yuki Kimoto authored on 2016-08-22
155
  %= include '/include/commit_body', %commit_body_args;
improve commits page design
Yuki Kimoto authored on 2016-02-01
156
</div>
157

            
158
%= include '/include/footer';