gitprep / templates / tree.html.ep /
Newer Older
236 lines | 7.21kb
cleanup
Yuki Kimoto authored on 2013-01-28
1
<%
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
2
  my $state;
3

            
cleanup
Yuki Kimoto authored on 2013-01-28
4
  # API
cleanup
Yuki Kimoto authored on 2013-03-19
5
  my $api = gitprep_api;
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
6

            
7
  # Git
revert encoding support
Yuki Kimoto authored on 2013-11-22
8
  my $git = app->git;
cleanup
Yuki Kimoto authored on 2013-01-28
9
  
10
  # Parameters
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
11
  my $user_id = param('user');
12
  my $project_id = param('project');
13
  
14
  my $project_row_id = $api->get_project_row_id($user_id, $project_id);
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
15
  
16
  my $rev;
17
  my $dir;
added branch long name featu...
Yuki Kimoto authored on 2013-05-12
18
  my $rev_dir = param('rev_dir');
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
19
  if (defined $rev_dir) {
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
20
    ($rev, $dir) = $git->parse_rev_path(app->rep_info($user_id, $project_id), $rev_dir);
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
21
  }
22
  else {
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
23
    $rev = app->manager->default_branch($user_id, $project_id);
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
24
  }
25
  
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
26
  unless (app->manager->exists_project($user_id, $project_id)) {
do success xt tests
Yuki Kimoto authored on 2016-03-25
27
    $self->reply->not_found;
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
28
    return;
29
  }
30

            
31
  # Repository description
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
32
  my $desc = $git->description(app->rep_info($user_id, $project_id));
33
  my $website_url = app->dbi->model('project')->select('website_url', where => {row_id => $project_row_id})->value;
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
34
  
35
  # Check exsitence
36
  my $commits_number;
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
37
  if ($git->exists_branch(app->rep_info($user_id, $project_id))) {
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
38
    # Commit
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
39
    my $commit = $git->get_commit(app->rep_info($user_id, $project_id), $rev);
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
40
    
41
    # Tree
fix tree bug and improve tre...
Yuki Kimoto authored on 2015-12-19
42
    my $trees;
43
    if (defined $dir && length $dir) {
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
44
      $trees = $git->trees(app->rep_info($user_id, $project_id), $rev, $dir);
fix tree bug and improve tre...
Yuki Kimoto authored on 2015-12-19
45
    }
46
    else {
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
47
      $trees = $git->trees(app->rep_info($user_id, $project_id), $rev);
fix tree bug and improve tre...
Yuki Kimoto authored on 2015-12-19
48
    }
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
49
    # Commits number
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
50
    $commits_number = $git->commits_number(app->rep_info($user_id, $project_id), $rev);
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
51
    
52
    # Variable for included template
53
    stash(
54
      commit => $commit,
55
      trees => $trees,
56
      rev => $rev,
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
57
      title => "$user_id/$project_id",
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
58
    );
59
    
60
    $state = 'display';
61
  }
62
  else { $state = 'init' }
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
63
  
64
  my $is_project_top_page = !(defined $dir && length $dir);
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
65

            
66
  my $url = url_for->to_abs;
67
  $url->base(undef);
68
  my $ssh_port = config->{basic}{ssh_port};
cleanup ->rep_home
Yuki Kimoto authored on 2016-04-14
69
  my $rep_home = app->rep_home;
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
70
  my $execute_user = getpwuid($>);
71
  my $ssh_rep_url_base = defined app->config->{basic}{'ssh_rep_url_base'}
72
    ? app->config->{basic}{'ssh_rep_url_base'} : $rep_home;
73
  my $ssh_rep_url = "ssh://$execute_user\@" . $url->host
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
74
    . ($ssh_port ? ":$ssh_port" : '') . "$ssh_rep_url_base/$user_id/$project_id.git";
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
75

            
76
  my $branches = stash('branches');
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
77
  my $branches_count = app->git->branches_count($self->app->rep_info($user_id, $project_id));
78
  my $default_branch_name = app->manager->default_branch($user_id, $project_id);
79
  my $tags_count = app->git->tags_count(app->rep_info($user_id, $project_id));
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
80
  
81
  my $logined = $api->logined;
82
  
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
83
  layout 'common', title => "$user_id/$project_id";
cleanup
Yuki Kimoto authored on 2013-01-28
84
%>
85
  
86
  %= include '/include/header';
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
87
  
cleanup tree page
Yuki Kimoto authored on 2013-03-15
88
  <div class="container">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
89
    %= include '/include/message', message => flash('message');
improve CGI performace and d...
Yuki Kimoto authored on 2013-09-06
90
    
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
91
    % if ($is_project_top_page) {
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
92
      <h3 style="font-weight:normal;color:#666;margin:20px 0px 20px 0;font-size:16px;line-height:0">
93
        <%= $desc %>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
94
        % if (defined $website_url && length $website_url) {
95
          <a href="<%= $website_url %>"><%= $website_url %></a>
96
        % }
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
97
      </h3>
98
    % }
99
    % if ($state eq 'display') {
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
100
      % if ($is_project_top_page) {
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
101
        %= stylesheet begin
102
          .commits-count {
103
            margin:0;
104
            border-radius: 3px 3px 0 0;
105
            border: 1px solid #ddd;
106
            border-bottom:none;
107
          }
108
          
109
          .commits-count li {
110
            display:inline-block;
111
            width:25%;
112
            margin-left:0px;
113
            list-style-type: none;
114
            padding:0;
115
            text-align:center;
116
          }
117
          .commits-count li a {
118
            width:100%;
119
            display:block;
120
            padding:10px 0;
121
            color:#767676;
122
          }
123
          .commits-count li a:hover {
124
            color:#4078c0;
125
            text-decoration:none;
126
          }
127
        % end
128
        
129
        <ul class="commits-count">
130
          <li>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
131
            % my $commits_url = "/$user_id/$project_id/commits/" . ((defined $rev && length $rev) ? $rev : $default_branch_name);
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
132
            <a href="<%= url_for($commits_url) %>">
133
              <span class="commits-count-number">
134
                <i class="icon-repeat"></i>
135
                <%= $commits_number %>
136
              </span>
137
              <span class="commits-count-type">
138
                commits
139
              </span>
140
            </a>
141
          </li>
142
          <li>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
143
            <a href="<%= url_for("/$user_id/$project_id/branches") %>">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
144
              <span class="commits-count-number">
145
                <i class="icon-indent-left"></i>
146
                <%= $branches_count %>
147
              </span>
148
              <span class="commits-count-type">
149
                branches
150
              </span>
151
            </a>
152
          </li>
153
          <li>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
154
            <a href="<%= url_for("/$user_id/$project_id/tags") %>">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
155
              <span class="commits-count-number">
156
                <i class="icon-tags"></i>
157
                <%= $tags_count %>
158
              </span>
159
              <span class="commits-count-type">
160
                releases
161
              </span>
162
            </a>
163
          </li>
164
        </ul>
165
        <div style="border-radius:0 0 3px 3px;border: 1px solid #ddd;min-height:8px;border-top:none;margin-bottom:15px;background:#0298c3">
166
          
167
        </div>
168
      % }
169

            
170
      <div style="margin-bottom:5px;">
improve branch select design
Yuki Kimoto authored on 2015-12-19
171
        % my $display = defined $dir && length $dir ? 'tree' : 'tree_top';
improve branch select design
Yuki Kimoto authored on 2016-01-06
172
        %= include '/include/branch_select', display => $display, Path => $dir, ssh_rep_url => $ssh_rep_url;
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
173
      </div>
174
      
175
      <div style="margin-bottom:30px">
fix tree page link bug
Yuki Kimoto authored on 2015-12-19
176
        %= include '/include/tree', dir => $dir;
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
177
      </div>
178
      
fix readme bug
Yuki Kimoto authored on 2015-12-19
179
      %= include '/include/readme', dir => $dir;
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
180
      
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
181
    % } elsif ($state eq 'init' && $api->logined($user_id)) {
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
182
      
improve design
Yuki Kimoto authored on 2016-02-09
183
      <h4 class="topic1">SSH</h4>
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
184
      
185
      <div class="text-center" style="margin-bottom:10px">
186
        <b>Create a new repository on the command line via ssh</b>
187
      </div>
188
      
improve design
Yuki Kimoto authored on 2016-02-09
189
      <pre class="command-line">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
190
touch README
191
git init
192
git add README
193
git commit -m "first commit"
194
git remote add origin <%= $ssh_rep_url %>
195
git push -u origin master</pre>
196
      
197
      <div class="text-center" style="margin-bottom:10px">
198
        <b>Push an existing repository from the command line via ssh</b>
199
      </div>
200
      
improve design
Yuki Kimoto authored on 2016-02-09
201
      <pre class="command-line">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
202
git remote add origin <%= $ssh_rep_url %>
203
git push -u origin master</pre>
204

            
205
      <hr>
206

            
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
207
      % my $http_rep_url = url_for("$user_id/$project_id.git")->to_abs;
improve design
Yuki Kimoto authored on 2016-02-09
208
      <h4 class="topic1"><%= uc url_for->to_abs->scheme %></h4>
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
209

            
210
      <div class="text-center" style="margin-bottom:10px">
211
        <b>Create a new repository on the command line via <%= url_for->to_abs->scheme %></b>
212
      </div>
213
      
improve design
Yuki Kimoto authored on 2016-02-09
214
      <pre class="command-line">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
215
touch README
216
git init
217
git add README
218
git commit -m "first commit"
219
git remote add origin <%= $http_rep_url %>
220
git push -u origin master</pre>
221
      
222
      <div class="text-center" style="margin-bottom:10px">
223
        <b>Push an existing repository from the command line via <%= url_for->to_abs->scheme %></b>
224
      </div>
225
      
improve design
Yuki Kimoto authored on 2016-02-09
226
      <pre class="command-line">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
227
git remote add origin <%= $http_rep_url %>
228
git push -u origin master</pre>
229
    % } else {
improve design
Yuki Kimoto authored on 2016-02-09
230
      <div class="not-yet-created">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
231
        <b>Repository is not yet created.</b>
232
      </div>
233
    % }
cleanup
Yuki Kimoto authored on 2013-01-28
234
  </div>
235
  
236
  %= include '/include/footer';