gitprep / templates / compare.html.ep /
Newer Older
221 lines | 7.197kb
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
6
  my $user = param('user');
7
  my $project = param('project');
cleanup
Yuki Kimoto authored on 2013-05-31
8
  my $from_rev = param('rev1');
9
  my $rev = param('rev2');
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
10
  my $page = param('page') || 0;
11
  
12
  # Git
revert encoding support
Yuki Kimoto authored on 2013-11-22
13
  my $git = $self->app->git;
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
14
  
15
  # Commits
cleanup
Yuki Kimoto authored on 2013-05-31
16
  my $commits = $git->forward_commits($user, $project, $from_rev, $rev);
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
17
  my $commits_count = @$commits;
18
  my $commits_date = {};
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
19
  my $authors = {};
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
20
  for my $commit (@$commits) {
support time zone
Yuki Kimoto authored on 2014-03-08
21
    my $date = $commit->{age_string_date_local};
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
22
    $commits_date->{$date} ||= [];
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
23
    $authors->{$commit->{author}} = 1;
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
24
    push @{$commits_date->{$date}}, $commit;
25
  }
improved compare page commit...
Yuki Kimoto authored on 2013-02-06
26
  my $authors_count = keys %$authors;
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
27

            
28
  # Start commit
cleanup
Yuki Kimoto authored on 2013-05-31
29
  my $start_commit = $git->separated_commit($user, $project, $from_rev, $rev);
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
30

            
31
  # End commit
cleanup
Yuki Kimoto authored on 2013-05-31
32
  my $end_commit = $git->get_commit($user, $project, $rev);
cleanup
Yuki Kimoto authored on 2013-05-13
33
  
34
  if (!$start_commit || !$end_commit) {
do success xt tests
Yuki Kimoto authored on 2016-03-25
35
    $self->reply->not_found;
cleanup
Yuki Kimoto authored on 2013-05-13
36
    return;
37
  }
added compare page file chan...
Yuki Kimoto authored on 2013-02-07
38
  
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
39
  # Branches
40
  my $branches = $git->branches($user, $project);
41
  @$branches = sort { $a->{commit}{age} <=> $b->{commit}{age} } @$branches;
42
  
improve compare page design
Yuki Kimoto authored on 2016-02-04
43
  # Variables
44
  stash id => $end_commit->{id};
45
  stash from_id => $start_commit->{id};
46
  stash rev => $end_commit->{id};
47
  stash from_rev => $start_commit->{id};
48

            
49
  layout 'common', title => "Comparing $rev1...$rev2 \x{30fb} $user/$project";
added feature that get branc...
Yuki Kimoto authored on 2013-02-04
50
%>
51

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

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
53
%= javascript begin
54
  $(document).ready(function () {
55
    
56
    // Change base branch
57
    $('#base-branch-btn').on('click', function () {
58
      $('#base-branch-popup')
59
        .css('display', 'block')
60
        .css('top', '40px')
61
        .css('left', '10px')
62
      ;
63
    });
64
    $('#base-branch-close').on('click', function () {
65
      $('#base-branch-popup').css('display', 'none');
66
    });
67
    $('[name=base-branch]').on('keypress', function (e) {
68
      // Enter
69
      if (e.which == 13) {
70
        location.href = '<%= url_for("/$user/$project/compare/") %>' + $(this).val() + '...<%= $rev %>';
71
      }
72
    });
added compare branch popup t...
Yuki Kimoto authored on 2013-05-10
73

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
74
    // Change compare branch
75
    $('#compare-branch-btn').on('click', function () {
76
      $('#compare-branch-popup')
77
        .css('display', 'block')
78
        .css('top', '40px')
79
        .css('left', '96px')
80
      ;
81
    });
82
    $('#compare-branch-close').on('click', function () {
83
      $('#compare-branch-popup').css('display', 'none');
84
    });
85
    $('[name=compare-branch]').on('keypress', function (e) {
86
      // Enter
87
      if (e.which == 13) {
88
        location.href = '<%= url_for("/$user/$project/compare/") %>' + '<%= $from_rev %>...' + $(this).val();
89
      }
improved compare page design
Yuki Kimoto authored on 2013-02-07
90
    });
improve compare page design
Yuki Kimoto authored on 2016-02-04
91
  });
92
% end
cleanup
Yuki Kimoto authored on 2013-02-04
93

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

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
96
<div class="container">
97
  <div class="topic1">Compare View</div>
98
  <div class="compare-select">
99
    <div>
100
      <div>
101
        <button id="base-branch-btn" class="btn btn-small">
102
          <span>base:</span><b> <%= $from_rev %></b><i class="icon-arrow-down"></i>
103
        </button>
104
        ...
105
        <button id="compare-branch-btn" class="btn btn-small">
106
          <span>compare:</span> <b><%= $rev %></b><i class="icon-arrow-down"></i>
107
        </button>
cleanup
Yuki Kimoto authored on 2013-03-15
108
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
109
    </div>
added base branch popup to c...
Yuki Kimoto authored on 2013-05-10
110

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
111
    <div id="base-branch-popup" style="display:none;width:330px;position:absolute">
112
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
113
        <div style="overflow:hidden">
114
          <div style="float:left;width:90%;">
115
            <b>Choose a base branch</b>
116
          </div>
117
          <div style="float:left:width:10%;text-align:right;">
118
            <i id="base-branch-close" class="icon-remove-circle"></i>
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
119
          </div>
120
        </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
121
      </div>
122
      <div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0">
123
        %= text_field 'base-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker';
124
      </div>
125
      <div style="background:white;max-height:500px;overflow:auto;">
added base branch popup to c...
Yuki Kimoto authored on 2013-05-10
126
        <ul class="nav nav-tabs nav-stacked">
127
          % for (my $i = 0; $i < @$branches; $i++) {
128
            % my $branch = $branches->[$i];
129
              <li>
cleanup
Yuki Kimoto authored on 2013-05-31
130
                <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= url_for("/$user/$project/compare/$branch->{name}...$rev") %>">
added base branch popup to c...
Yuki Kimoto authored on 2013-05-10
131
                  <%= $branch->{name} %>
132
                </a>
133
              </li>
134
          % }
135
        </ul>
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
136
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
137
    </div>
added compare branch popup t...
Yuki Kimoto authored on 2013-05-10
138

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
139
    <div id="compare-branch-popup" style="display:none;width:330px;position:absolute">
140
      <div class="radius-top border-gray" style="background:#E6E6FA;padding:10px">
141
        <div style="overflow:hidden">
142
          <div style="float:left;width:90%;">
143
            <b>Choose a compare branch</b>
144
          </div>
145
          <div style="float:left:width:10%;text-align:right;">
146
            <i id="compare-branch-close" class="icon-remove-circle"></i>
added compare branch popup t...
Yuki Kimoto authored on 2013-05-10
147
          </div>
148
        </div>
149
      </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
150
      <div class="border-gray" style="background:#F5F5F5;border-top:none;border-bottom:none;text-align:center;padding:10px 0">
151
        %= text_field 'compare-branch', style => 'margin-bottom:0;width:270px', placeholder => 'Branch, tag, commit, or history marker';
152
      </div>
153
      <div style="background:white;max-height:500px;overflow:auto;">
154
      <ul class="nav nav-tabs nav-stacked">
155
        % for (my $i = 0; $i < @$branches; $i++) {
156
          % my $branch = $branches->[$i];
157
            <li>
158
              <a style="border-top-left-radius:0px;border-top-right-radius:0px;" href="<%= url_for("/$user/$project/compare/$from_rev...$branch->{name}") %>">
159
                <%= $branch->{name} %>
160
              </a>
161
            </li>
162
        % }
163
      </ul>
164
      </div>
added base branch selection ...
Yuki Kimoto authored on 2013-05-10
165
    </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
166
  </div>
added base branch popup to c...
Yuki Kimoto authored on 2013-05-10
167

            
improve compare page design
Yuki Kimoto authored on 2016-02-04
168
  % if (keys %$commits_date) {
169
    <ul class="compare-header">
170
      <li>
171
        <b><%= @$commits %></b> <span>commit</span>
172
      </li>
173
      <li>
174
        <b><%= $authors_count %></b> <span>contributor</span>
175
      </li>
176
      <li>
177
        
178
      </li>
179
      <li>
180
        
181
      </li>
182
    </ul>
improved compare page design
Yuki Kimoto authored on 2013-02-07
183
    
improve compare page design
Yuki Kimoto authored on 2016-02-04
184
    <div class="commits">
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
185
      % for my $date (reverse sort keys %$commits_date) {
186
        % my $commits = $commits_date->{$date};
187
        
improve compare page design
Yuki Kimoto authored on 2016-02-04
188
        <div class="commit-date">
189
          <i class="icon-off"></i><span>Commits on <%= $date %></span>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
190
        </div>
191
        
improve compare page design
Yuki Kimoto authored on 2016-02-04
192
        <ul class="compare-commits-date-container">
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
193
          % for my $commit (sort {$b->{author_epoch} <=> $a->{author_epoch}} @$commits) {
improve compare page design
Yuki Kimoto authored on 2016-02-04
194
            <li>
195
              <div class="compare-commits-author">
196
                <span title="<%= $commit->{author_email} %>"><%= $commit->{author_name} %></span>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
197
              </div>
improve compare page design
Yuki Kimoto authored on 2016-02-04
198
              <div class="compare-commits-commit-title">
199
                <a style="color:#333" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
200
                  <%= $commit->{title_short} %>
201
                </a>
202
              </div>
203
              <div class="compare-commits-commit-id">
204
                <a href="<%= url_for("/$user/$project/commit/$commit->{id}") %>">
205
                  <%= substr($commit->{id}, 0, 7) %>
206
                </a>
207
              </div>
208
            </li>
improved branches page and c...
Yuki Kimoto authored on 2013-05-07
209
          % }
improve compare page design
Yuki Kimoto authored on 2016-02-04
210
        </ul>
expand compare page tabs
Yuki Kimoto authored on 2013-08-10
211
      % }
improve compare page design
Yuki Kimoto authored on 2016-02-04
212
    </div>
213
  
214
    %= include '/include/commit_body';
215
  % } else {
216
    <div>
217
      <b>There isn't anything to compare.</b>
218
    </div>
219
  % }
220
</div>
221
%= include '/include/footer';