Showing 6 changed files with 28 additions and 4 deletions
+1
templates/fork.html.ep
... ...
@@ -37,6 +37,7 @@
37 37
       return $self->res->body;
38 38
     }
39 39
     else {
40
+      flash('original_project', "$user/$project");
40 41
       $self->redirect_to("/$login_user/$project");
41 42
       return 1;
42 43
     }
+1 -1
templates/include/header.html.ep
... ...
@@ -16,7 +16,7 @@
16 16
           </div>
17 17
           % unless ($user eq 'admin') {
18 18
             <a class="btn btn-small" href="<%= url_for("/_admin/create") %>">Create a new repo</a>
19
-            <a class="btn btn-small" href="<%= url_for("/$user/_settings") %>">Account settings</a>
19
+            <a class="btn btn-small" href="<%= url_for("/$user/_settings") %>">Account Settings</a>
20 20
           % }
21 21
           % my $url = url_with->to_abs;
22 22
           <a class="btn btn-small" href="<%= url_for("/_logout?from=$url") %>">Sign out</a>
+4 -2
templates/include/project_header.html.ep
... ...
@@ -1,6 +1,8 @@
1 1
 <%
2 2
   my $api = gitprep_api;
3 3
   my $logined = $api->logined;
4
+  my $current_user = session('user');
5
+  my $user = stash('user');
4 6
 %>
5 7
 
6 8
 <div class="row">
... ...
@@ -14,10 +16,10 @@
14 16
     </ul>
15 17
   </div>
16 18
   <div class="span1">
17
-    % if ($logined) {
19
+    % if ($logined && $current_user ne $user ) {
18 20
       <a href="<%= url_for("/$user/$project/fork") %>" class="btn">Fork</a>
19 21
     % } else {
20
-      <a href="#" class="btn disabled">Fork</a>
22
+      <btn class="btn disabled" disabled>Fork</a>
21 23
     % }
22 24
   </div>
23 25
 </div>
+1 -1
templates/project-settings.html.ep
... ...
@@ -160,7 +160,7 @@
160 160
         };
161 161
         $.post(url, data, function (result) {
162 162
           if (result.ok) {
163
-            location.href = "<%= url_for("/$user") %>";
163
+            location.href = "<%= url_for("/$user")->query(deleted_project => $project) %>";
164 164
           }
165 165
           else {
166 166
             $('#modal-message-text').text('Error:' + result.message);
+7
templates/project.html.ep
... ...
@@ -110,6 +110,13 @@
110 110
   %= include '/include/header';
111 111
   
112 112
   <div class="container">
113
+    % if (my $original_project = flash('original_project')) {
114
+      <div class="alert alert-success">
115
+        <button type="button" class="close" data-dismiss="alert">&times;</button>
116
+        Repository is forked from <%= $original_project %>.
117
+      </div>
118
+    % }
119
+    
113 120
     %= include '/include/project_header';
114 121
 
115 122
     <div class="row">
+14
templates/user.html.ep
... ...
@@ -1,4 +1,11 @@
1 1
 <%
2
+  # Redirect for project delete
3
+  if (my $deleted_project = param('deleted_project')) {
4
+    flash('deleted_project', $deleted_project);
5
+    $self->redirect_to('current');
6
+    return 1;
7
+  }
8
+  
2 9
   my $user = param('user');
3 10
   
4 11
   # Projects
... ...
@@ -10,6 +17,13 @@
10 17
 
11 18
   <div class="container">
12 19
     <div>
20
+      % if (my $deleted_project = flash('deleted_project')) {
21
+        <div class="alert alert-success">
22
+          <button type="button" class="close" data-dismiss="alert">&times;</button>
23
+          Repository <%= $deleted_project %> is deleted.
24
+        </div>
25
+      % }
26
+    
13 27
       <ul class="breadcrumb" style="margin-top:10px">
14 28
         <li><a href="<%= url_for('/') %>">Home</a></li>
15 29
         /