Showing 6 changed files with 77 additions and 22 deletions
+3
lib/Gitprep.pm
... ...
@@ -195,6 +195,9 @@ EOS
195 195
     
196 196
     # Compare
197 197
     $r->get('/compare/(#rev1)...(#rev2)')->to('#compare');
198
+    
199
+    # Settings
200
+    $r->get('/settings')->to('#settings');
198 201
   }
199 202
 }
200 203
 
+8 -1
lib/Gitprep/Git.pm
... ...
@@ -461,8 +461,15 @@ sub difftree {
461 461
 sub no_merged_branches {
462 462
   my ($self, $user, $project) = @_;
463 463
   
464
+  return $self->branches($user, $project, {no_merged => 1});
465
+}
466
+
467
+sub branches {
468
+  my ($self, $user, $project, $opts) = @_;
469
+  
464 470
   # Command "git branch --no-merged"
465
-  my @cmd = $self->_cmd($user, $project, 'branch', '--no-merged');
471
+  my @cmd = $self->_cmd($user, $project, 'branch');
472
+  push @cmd, , '--no-merged' if $opts->{no_merged};
466 473
   open my $fh, '-|', @cmd or return;
467 474
   
468 475
   my @branch_names
+7 -16
templates/include/project_header.html.ep
... ...
@@ -1,16 +1,7 @@
1
-<div class="row" style="margin-bottom:10px">
2
-  <div class="span11">
3
-    <ul class="breadcrumb">
4
-      <li><a href="<%= url_for('/') %>">Home</a></li>
5
-      /
6
-      <li><a href="<%= url_for("/$user") %>"><%= $user %></a></li>
7
-      /
8
-      <li><a href="<%= url_for("/$user/$project") %>"><%= $project %></a></li>
9
-    </ul>
10
-  </div>
11
-  <div class="span1" style ="margin-top:4px">
12
-    <a class="btn" href="<%= url_for("/$user/$project/admin") %>">
13
-      Admin
14
-    </a>
15
-  </div>
16
-</div>
1
+<ul class="breadcrumb">
2
+  <li><a href="<%= url_for('/') %>">Home</a></li>
3
+  /
4
+  <li><a href="<%= url_for("/$user") %>"><%= $user %></a></li>
5
+  /
6
+  <li><a href="<%= url_for("/$user/$project") %>"><%= $project %></a></li>
7
+</ul>
+1 -1
templates/main/login.html.ep
... ...
@@ -98,7 +98,7 @@
98 98
   <div class="border-gray" style="padding-top:15px;padding-left:60px;width:300px;margin-left:auto;margin-right:auto">
99 99
     <form action="<%= url_for->query(op => 'login') %>" method="post">
100 100
       <div class="control-group">
101
-        <label class="control-label" for="user-name">user-name</label>
101
+        <label class="control-label" for="user-name">User name</label>
102 102
         <div class="controls">
103 103
           <%= input_tag id => $id, type => 'text', placeholder => 'User', id =>'user-name'%>
104 104
         </div>
+12 -4
templates/main/project.html.ep
... ...
@@ -107,10 +107,18 @@
107 107
     %= include '/include/project_header';
108 108
     
109 109
     % if ($state eq 'display') {
110
-      <h4 style="margin-top:0px">
111
-        <%= $desc %>
112
-      </h4>
113
-      
110
+      <div class="row">
111
+        <div class="span10">
112
+          <h4 style="margin-top:5px">
113
+            <%= $desc %>
114
+          </h4>
115
+        </div>
116
+        <div class="span2 text-right">
117
+          % if ($logined && $user eq session('user_id')) {
118
+            <a class="btn" href="<%= url_for("/$user/$project/settings") %>">Settings</a>
119
+          % }
120
+        </div>
121
+      </div>
114 122
       <div class="border-gray" style="padding:0 5px;margin-bottom:10px">
115 123
         <a class="btn" href="<%= url_for("/$user/$project/archive/master.zip") %>">
116 124
           <i class="icon-arrow-down"></i>ZIP
+46
templates/main/settings.html.ep
... ...
@@ -0,0 +1,46 @@
1
+<%
2
+  my $git = app->git;
3
+%>
4
+
5
+% layout 'common';
6
+  
7
+  %= include '/include/header';
8
+  
9
+  <div class="container">
10
+    %= include '/include/project_header';
11
+    
12
+    <div style="margin-bottom:20px">
13
+      <div class="border-gray bk-gray-light" style="padding-left:5px">
14
+        <h4>
15
+          Settings
16
+        </h4>
17
+      </div>
18
+      <div class="padding5 border-gray" style="border-top:none">
19
+        <div >Repository Name</div>
20
+        <div>
21
+          %= text_field 'project' => $project, style => 'margin-top:9px';
22
+          <a class="btn" href="#rename">Rename</a>
23
+        </div>
24
+      </div>
25
+      <div class="border-gray padding5" style="border-top:none">
26
+        Default Branch
27
+        % use D;d my $branches = $git->branches($user, $project);
28
+        % my $branch_names = [map { $_->{name} } @$branches];
29
+        %= select_field 'default_branch' => $branch_names, style => 'margin-top:5px';
30
+      </div>
31
+    </div>
32
+    
33
+    <div>
34
+      <div class="border-gray bk-gray-light" style="background-color:red;padding-left:5px">
35
+        <h4 style="color:white">Danger Zone</h4>
36
+      </div>
37
+      <div class="padding5 border-gray" style="border-top:none">
38
+        <div><b>Delete this repository</b></div>
39
+        <span class="muted">
40
+          Once you delete a repository, there is no going back.
41
+        </span>
42
+        <a style="color:red" class="btn" href="#delete">Delete this repository</a>
43
+    </div>
44
+  </div>
45
+  
46
+  %= include '/include/footer';