gitprep / templates / commits.html.ep /
Newer Older
196 lines | 6.546kb
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
  
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
15
  my ($rev, $file) = $git->parse_rev_path($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
rename parse_commit to get_c...
Yuki Kimoto authored on 2013-05-01
19
  my $commit = $git->get_commit($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
  }
26
    
added Commits link
Yuki Kimoto authored on 2012-11-28
27
  # Commits
improved commits page design
Yuki Kimoto authored on 2012-12-03
28
  my $page_count = 30;
cleanup
Yuki Kimoto authored on 2013-04-30
29
  my $commits = $git->get_commits(
cleanup
Yuki Kimoto authored on 2013-03-19
30
    $user,
31
    $project,
32
    $commit->{id},
33
    $page_count,
34
    $page_count * $page,
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
35
    $file
cleanup
Yuki Kimoto authored on 2013-03-19
36
  );
added commits page pagenatio...
Yuki Kimoto authored on 2012-12-04
37
  my $commits_count = @$commits;
improved commits page design
Yuki Kimoto authored on 2012-12-03
38
  my $commits_date = {};
added Commits link
Yuki Kimoto authored on 2012-11-28
39
  for my $commit (@$commits) {
support time zone
Yuki Kimoto authored on 2014-03-08
40
    my $date = $commit->{age_string_date_local};
improved commits page design
Yuki Kimoto authored on 2012-12-03
41
    $commits_date->{$date} ||= [];
42
    push @{$commits_date->{$date}}, $commit;
added Commits link
Yuki Kimoto authored on 2012-11-28
43
  }
44
  
added commits page header an...
Yuki Kimoto authored on 2012-11-30
45
  # Global variable
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
46
  stash(user => $user, project => $project, rev => $rev);
add atom feed part
Yuki Kimoto authored on 2014-10-02
47
  
add time zone to commit time
Yuki Kimoto authored on 2014-10-03
48
  # Render atom xml feed
support atom feed of commits...
Yuki Kimoto authored on 2014-10-03
49
  if ($render_atom_feed) {
50
    # Add updated date time
51
    for my $commit (@$commits) {
52
      my $committer_epoch = $commit->{committer_epoch};
53
      my $committer_tz = $commit->{committer_tz};
54
      
55
      my $time_zone_second;
56
      my $time_zone;
57
      if ($committer_tz =~ /^(\+|\-)([0-9]{2})([0-9]{2})$/) {
58
        my $time_zone_sign = $1;
59
        my $time_zone_hour = $2;
60
        my $time_zone_min = $3;
61
        $time_zone_second = $time_zone_sign . ($time_zone_hour * (60 * 60) + $time_zone_min * 60);
62
        $time_zone = sprintf("$time_zone_sign%02d:%02d", $time_zone_hour, $time_zone_min);
63
      }
64

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

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

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

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