gitprep / templates / tree.html.ep /
Newer Older
230 lines | 6.611kb
cleanup
Yuki Kimoto authored on 2013-01-28
1
<%
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
2
  use Text::Markdown::Hoedown;
3

            
4
  my $state;
5

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

            
9
  # Git
revert encoding support
Yuki Kimoto authored on 2013-11-22
10
  my $git = app->git;
cleanup
Yuki Kimoto authored on 2013-01-28
11
  
12
  # Parameters
13
  my $user = param('user');
cleanup, rename repository t...
Yuki Kimoto authored on 2013-01-29
14
  my $project = param('project');
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) {
20
    ($rev, $dir) = $git->parse_rev_path($user, $project, $rev_dir);
21
  }
22
  else {
23
    $rev = app->manager->default_branch($user, $project);
24
  }
25
  
26
  unless (app->manager->exists_project($user, $project)) {
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
32
  my $desc = $git->description($user, $project);
33
  
34
  # Check exsitence
35
  my $commits_number;
36
  if ($git->exists_branch($user, $project)) {
37
    # Commit
38
    my $commit = $git->get_commit($user, $project, $rev);
39
    
40
    # Tree
fix tree bug and improve tre...
Yuki Kimoto authored on 2015-12-19
41
    my $trees;
42
    if (defined $dir && length $dir) {
43
      $trees = $git->trees($user, $project, $rev, $dir);
44
    }
45
    else {
46
      $trees = $git->trees($user, $project, $rev);
47
    }
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
48
    # Commits number
49
    $commits_number = $git->commits_number($user, $project, $rev);
50
    
51
    # Variable for included template
52
    stash(
53
      commit => $commit,
54
      trees => $trees,
55
      rev => $rev,
56
      title => "$user/$project",
57
    );
58
    
59
    $state = 'display';
60
  }
61
  else { $state = 'init' }
62

            
63
  my $url = url_for->to_abs;
64
  $url->base(undef);
65
  my $ssh_port = config->{basic}{ssh_port};
66
  my $rep_home = app->git->rep_home;
67
  my $execute_user = getpwuid($>);
68
  my $ssh_rep_url_base = defined app->config->{basic}{'ssh_rep_url_base'}
69
    ? app->config->{basic}{'ssh_rep_url_base'} : $rep_home;
70
  my $ssh_rep_url = "ssh://$execute_user\@" . $url->host
71
    . ($ssh_port ? ":$ssh_port" : '') . "$ssh_rep_url_base/$user/$project.git";
72

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

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

            
199
      <hr>
200

            
201
      % my $http_rep_url = url_for("$user/$project.git")->to_abs;
improve design
Yuki Kimoto authored on 2016-02-09
202
      <h4 class="topic1"><%= uc url_for->to_abs->scheme %></h4>
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
203

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