gitprep / templates / commits.html.ep /
Newer Older
201 lines | 6.762kb
added Commits link
Yuki Kimoto authored on 2012-11-28
1
<%
2
  # API
cleanup
Yuki Kimoto authored on 2013-03-19
3
  my $api = gitprep_api;
cleanup commits page
Yuki Kimoto authored on 2013-01-29
4

            
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
5
  # Git
revert encoding support
Yuki Kimoto authored on 2013-11-22
6
  my $git = $self->app->git;
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
7

            
cleanup commits page
Yuki Kimoto authored on 2013-01-29
8
  # Parameters
added Commits link
Yuki Kimoto authored on 2012-11-28
9
  my $user = param('user');
cleanup, rename repository t...
Yuki Kimoto authored on 2013-01-29
10
  my $project = param('project');
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
11
  my $rev_file = param('rev_file');
add atom feed part
Yuki Kimoto authored on 2014-10-02
12
  
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
13
  my $render_atom_feed = $rev_file =~ s/\.atom$// ? 1 : 0;
add atom feed part
Yuki Kimoto authored on 2014-10-02
14
  
cleanup parse_rev_path
Yuki Kimoto authored on 2016-04-16
15
  my ($rev, $file) = $git->parse_rev_path(app->rep_info($user, $project), $rev_file);
added commits page pagenatio...
Yuki Kimoto authored on 2012-12-04
16
  my $page = param('page') || 0;
added Commits link
Yuki Kimoto authored on 2012-11-28
17
  
18
  # Commit
cleanup methods
Yuki Kimoto authored on 2016-04-16
19
  my $commit = $git->get_commit(app->rep_info($user, $project), $rev);
add atom feed part
Yuki Kimoto authored on 2014-10-02
20

            
21
  # Not found
22
  unless ($commit) {
do success xt tests
Yuki Kimoto authored on 2016-03-25
23
    $self->reply->not_found;
add atom feed part
Yuki Kimoto authored on 2014-10-02
24
    return;
25
  }
add user page link from user...
Yuki Kimoto authored on 2016-04-11
26
  my $commit_author_mail = $commit->{author_email};
27
  my $commit_author_id = app->dbi->model('user')->select(
28
    'id',
29
    where => {mail => $commit_author_mail}
30
  )->value;
add atom feed part
Yuki Kimoto authored on 2014-10-02
31
    
added Commits link
Yuki Kimoto authored on 2012-11-28
32
  # Commits
improved commits page design
Yuki Kimoto authored on 2012-12-03
33
  my $page_count = 30;
cleanup
Yuki Kimoto authored on 2013-04-30
34
  my $commits = $git->get_commits(
cleanup import_branch
Yuki Kimoto authored on 2016-04-16
35
    app->rep_info($user, $project),
cleanup
Yuki Kimoto authored on 2013-03-19
36
    $commit->{id},
37
    $page_count,
38
    $page_count * $page,
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
39
    $file
cleanup
Yuki Kimoto authored on 2013-03-19
40
  );
added commits page pagenatio...
Yuki Kimoto authored on 2012-12-04
41
  my $commits_count = @$commits;
improved commits page design
Yuki Kimoto authored on 2012-12-03
42
  my $commits_date = {};
added Commits link
Yuki Kimoto authored on 2012-11-28
43
  for my $commit (@$commits) {
support time zone
Yuki Kimoto authored on 2014-03-08
44
    my $date = $commit->{age_string_date_local};
improved commits page design
Yuki Kimoto authored on 2012-12-03
45
    $commits_date->{$date} ||= [];
46
    push @{$commits_date->{$date}}, $commit;
added Commits link
Yuki Kimoto authored on 2012-11-28
47
  }
48
  
added commits page header an...
Yuki Kimoto authored on 2012-11-30
49
  # Global variable
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
50
  stash(user => $user, project => $project, rev => $rev);
add atom feed part
Yuki Kimoto authored on 2014-10-02
51
  
add time zone to commit time
Yuki Kimoto authored on 2014-10-03
52
  # Render atom xml feed
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
53
  if ($render_atom_feed) {
54
    # Add updated date time
55
    for my $commit (@$commits) {
56
      my $committer_epoch = $commit->{committer_epoch};
57
      my $committer_tz = $commit->{committer_tz};
58
      
59
      my $time_zone_second;
60
      my $time_zone;
61
      if ($committer_tz =~ /^(\+|\-)([0-9]{2})([0-9]{2})$/) {
62
        my $time_zone_sign = $1;
63
        my $time_zone_hour = $2;
64
        my $time_zone_min = $3;
65
        $time_zone_second = $time_zone_sign . ($time_zone_hour * (60 * 60) + $time_zone_min * 60);
66
        $time_zone = sprintf("$time_zone_sign%02d:%02d", $time_zone_hour, $time_zone_min);
67
      }
68

            
69
      # updated datetime
70
      my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($committer_epoch + $time_zone_second);
71
      my $updated = sprintf('%4d-%02d-%02dT%02d:%02d:%02d', 1900 + $year, $mon + 1, $mday, $hour, $min, $sec);
72
      $updated .= $time_zone;
73
      
74
      $commit->{updated} = $updated;
75
    }
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
76
  }
add commits atom alternate t...
Yuki Kimoto authored on 2014-12-03
77
  
78
  # Set stash
79
  stash(
80
    user => $user,
81
    project => $project,
82
    rev => $rev
83
  );
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
84
#%>
85
% if ($render_atom_feed) {
86
<%
fix atom feed content type t...
Yuki Kimoto authored on 2014-11-17
87
    $self->res->headers->content_type('application/atom+xml;charset=UTF-8');
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
88
    # Create atom feed
fix atom feed url bug
Yuki Kimoto authored on 2014-12-02
89
    my $alternate_url = url_with;
90
    my $alternate_url_path_parts = $alternate_url->path->parts;
91
    $alternate_url_path_parts->[-1] =~ s/\.atom$//;
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
92
#%>
add space before ?>
Yuki Kimoto authored on 2014-11-17
93
<?xml version="1.0" encoding="UTF-8" ?>
add atom feed part
Yuki Kimoto authored on 2014-10-02
94
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xml:lang="en-US">
fix atom feed bug
Yuki Kimoto authored on 2014-11-17
95
  <id>tag:gitprep,2008:/<%= $user %>/<%= $project %>/commits/<%= $rev_file %></id>
fix atom feed url bug
Yuki Kimoto authored on 2014-12-02
96
  <link type="text/html" rel="alternate" href="<%= $alternate_url->to_abs %>"/>
97
  <link type="application/atom+xml" rel="self" href="<%= url_with->to_abs %>"/>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
98
  <title>Recent Commits to <%= "$project:$rev" %></title>
99
  <updated><%= $commits->[0]->{updated} %></updated>
add atom feed part
Yuki Kimoto authored on 2014-10-02
100

            
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
101
    % for my $commit (@$commits) {
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
102
  <entry>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
103
    <id>tag:gitprep,2008:Grit::Commit/<%= $commit->{id} %></id>
cleanup commits atom page
Yuki Kimoto authored on 2014-12-03
104
    <link type="text/html" rel="alternate" href="<%= url_for("/$user/$project/commit/$commit->{id}")->to_abs %>" />
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
105
    <title>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
106
        <%= $commit->{title} %>
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
107
    </title>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
108
    <updated><%= $commit->{updated} %></updated>
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
109
    <author>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
110
      <name><%= $user %></name>
cleanup commits atom page
Yuki Kimoto authored on 2014-12-03
111
      <uri><%= url_for("/$user")->to_abs %></uri>
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
112
    </author>
113
    <content type="html">
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
114
      <%= "<pre style='white-space:pre-wrap;width:81ex'>$commit->{title}</pre>" %>
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
115
    </content>
116
  </entry>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
117
    % }
add atom feed part
Yuki Kimoto authored on 2014-10-02
118
</feed>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
119
% } else {
120
  % layout 'common', title => "Commit History \x{30fb} $user/$project";
add atom feed part
Yuki Kimoto authored on 2014-10-02
121
    
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
122
    %= include '/include/header';
added commits page header an...
Yuki Kimoto authored on 2012-11-30
123

            
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
124
    <div class="container">
improve commits page design
Yuki Kimoto authored on 2016-01-11
125
      <div>
improve branch_select design
Yuki Kimoto authored on 2015-12-18
126
        %= include '/include/branch_select', display => 'commits';
127
      </div>
improve commits page design
Yuki Kimoto authored on 2016-01-11
128
      
129
      <div class="commits">
130
        % for my $date (reverse sort keys %$commits_date) {
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
131
          % my $commits = $commits_date->{$date};
improve commits page design
Yuki Kimoto authored on 2016-01-11
132
          <div class="commit-date">
133
            <i class="icon-off"></i><span>Commits on <%= $date %></span>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
134
          </div>
improve commits page design
Yuki Kimoto authored on 2016-01-11
135

            
136
          <ul class="commits-date-container">
137
            % my $num = 0;
138
            % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) {
139
              <li>
140
                <div class="commit-left">
141
                  <div class="commit-left-title">
142
                    <a href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
143
                      <b><%= $commit->{title_short} %></b>
144
                    </a>
145
                  </div>
146
                  <div class="commit-left-author">
add user page link from user...
Yuki Kimoto authored on 2016-04-11
147
                    <span title="<%= $commit->{author_email} %>">
148
                      % if (defined $commit_author_id) {
149
                        <a href="<%= url_for("/$commit_author_id") %>"><%= $commit_author_id %></a>
150
                      % } else {
151
                        <%= $commit->{author_name} %>
152
                      % }
153
                    </span>
improve commits page design
Yuki Kimoto authored on 2016-01-11
154
                    <span class="muted" title="<%= $commit->{age_string_datetime_local} %>"><%= $commit->{age_string} %></span>
155
                  </div>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
156
                </div>
improve commits page design
Yuki Kimoto authored on 2016-01-11
157
                <div class="commit-right">
158
                  <div class="commit-right-container">
159
                    <div class="commit-right-commit-id">
160
                      <a href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
161
                        <%= substr($commit->{id}, 0, 7) %>
162
                      </a>
163
                    </div>
164
                    <div class="commit-right-browse-repository">
165
                      <a title="Browse the repository at this point in the history" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
166
                        &lt;&gt;
167
                      </a>
168
                    </div>
169
                  </div>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
170
                </div>
improve commits page design
Yuki Kimoto authored on 2016-01-11
171
                % $num++;
172
              </li>
173
            % }
174
          </ul>
175
        % }
176
      </div>
177
      
improve pagenation design
Yuki Kimoto authored on 2016-01-11
178
      <div class="pagenation-container">
179
        <ul class="pagenation">
180
          % if ($page == 0) {
181
            <li><span>Newer</span></li>
182
          % } else {
183
            % my $newer_page = $page - 1;
184
            <li>
185
              <a href="<%= url_for("/$user/$project/commits/$rev?page=$newer_page") %>">Newer</a>
186
            </li>
187
          % }
188
          % if ($commits_count < $page_count) {
189
            <li><span>Older</span></li>
190
          % } else {
191
            % my $older_page = $page + 1;
192
            <li>
193
              <a href="<%= url_for("/$user/$project/commits/$rev?page=$older_page") %>">Older</a>
194
            </li>
195
          % }
196
        </ul>
197
      </div>
fix atom bug(order, escape, ...
Yuki Kimoto authored on 2014-11-17
198
    </div>
199
    
200
    %= include '/include/footer';
201
% }