gitprep / templates / tree.html.ep /
Newer Older
205 lines | 6.363kb
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 project header color
Yuki Kimoto authored on 2016-09-14
92
      <h3 class="tree-description">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
93
        <%= $desc %>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
94
        % if (defined $website_url && length $website_url) {
improve project header color
Yuki Kimoto authored on 2016-09-14
95
          <a href="<%= $website_url %>">website</a>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
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
        <ul class="commits-count">
102
          <li>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
103
            % 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
104
            <a href="<%= url_for($commits_url) %>">
105
              <span class="commits-count-number">
improve tree page design
Yuki Kimoto authored on 2016-11-29
106
                <i class="icon-repeat" style="position:relative;top:-1px"></i>
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
107
                <%= $commits_number %>
108
              </span>
109
              <span class="commits-count-type">
110
                commits
111
              </span>
112
            </a>
113
          </li>
114
          <li>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
115
            <a href="<%= url_for("/$user_id/$project_id/branches") %>">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
116
              <span class="commits-count-number">
improve tree page design
Yuki Kimoto authored on 2016-11-29
117
                <i class="icon-indent-left" style="position:relative;top:-1px"></i>
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
118
                <%= $branches_count %>
119
              </span>
120
              <span class="commits-count-type">
121
                branches
122
              </span>
123
            </a>
124
          </li>
125
          <li>
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
126
            <a href="<%= url_for("/$user_id/$project_id/tags") %>">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
127
              <span class="commits-count-number">
improve tree page design
Yuki Kimoto authored on 2016-11-29
128
                <i class="icon-tags" style="position:relative;top:-1px"></i>
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
129
                <%= $tags_count %>
130
              </span>
131
              <span class="commits-count-type">
132
                releases
133
              </span>
134
            </a>
135
          </li>
136
        </ul>
137
      % }
138

            
139
      <div style="margin-bottom:5px;">
improve branch select design
Yuki Kimoto authored on 2015-12-19
140
        % my $display = defined $dir && length $dir ? 'tree' : 'tree_top';
improve branch select design
Yuki Kimoto authored on 2016-01-06
141
        %= 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
142
      </div>
143
      
144
      <div style="margin-bottom:30px">
fix tree page link bug
Yuki Kimoto authored on 2015-12-19
145
        %= include '/include/tree', dir => $dir;
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
146
      </div>
147
      
fix readme bug
Yuki Kimoto authored on 2015-12-19
148
      %= include '/include/readme', dir => $dir;
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
149
      
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
150
    % } elsif ($state eq 'init' && $api->logined($user_id)) {
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
151
      
improve design
Yuki Kimoto authored on 2016-02-09
152
      <h4 class="topic1">SSH</h4>
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
153
      
154
      <div class="text-center" style="margin-bottom:10px">
155
        <b>Create a new repository on the command line via ssh</b>
156
      </div>
157
      
improve design
Yuki Kimoto authored on 2016-02-09
158
      <pre class="command-line">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
159
touch README
160
git init
161
git add README
162
git commit -m "first commit"
163
git remote add origin <%= $ssh_rep_url %>
164
git push -u origin master</pre>
165
      
166
      <div class="text-center" style="margin-bottom:10px">
167
        <b>Push an existing repository from the command line via ssh</b>
168
      </div>
169
      
improve design
Yuki Kimoto authored on 2016-02-09
170
      <pre class="command-line">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
171
git remote add origin <%= $ssh_rep_url %>
172
git push -u origin master</pre>
173

            
174
      <hr>
175

            
add website URL settings. yo...
Yuki Kimoto authored on 2016-08-17
176
      % my $http_rep_url = url_for("$user_id/$project_id.git")->to_abs;
improve design
Yuki Kimoto authored on 2016-02-09
177
      <h4 class="topic1"><%= uc url_for->to_abs->scheme %></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 <%= url_for->to_abs->scheme %></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 <%= $http_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 <%= url_for->to_abs->scheme %></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 <%= $http_rep_url %>
197
git push -u origin master</pre>
198
    % } else {
improve design
Yuki Kimoto authored on 2016-02-09
199
      <div class="not-yet-created">
improve commits header desig...
Yuki Kimoto authored on 2015-12-19
200
        <b>Repository is not yet created.</b>
201
      </div>
202
    % }
cleanup
Yuki Kimoto authored on 2013-01-28
203
  </div>
204
  
205
  %= include '/include/footer';