... | ... |
@@ -163,73 +163,78 @@ EOS |
163 | 163 |
$self->manager($manager); |
164 | 164 |
|
165 | 165 |
# Home |
166 |
- $r->get('/')->to('#home'); |
|
166 |
+ $r->get('/')->name('home'); |
|
167 | 167 |
|
168 | 168 |
# Start |
169 |
- $r->any('/_start')->to('#start'); |
|
169 |
+ $r->any('/_start')->name('_start'); |
|
170 | 170 |
|
171 | 171 |
# Sign in |
172 |
- $r->any('/_login')->to('#login'); |
|
172 |
+ $r->any('/_login')->name('login'); |
|
173 | 173 |
|
174 | 174 |
# Admin |
175 |
- $r->get('/_admin')->to('#admin'); |
|
175 |
+ $r->get('/_admin')->name('_admin'); |
|
176 | 176 |
|
177 | 177 |
# Admin |
178 | 178 |
{ |
179 |
- my $r = $r->route('/_admin')->to('admin#'); |
|
180 |
- |
|
181 |
- # Create new repository |
|
182 |
- $r->any('/create')->to('#create'); |
|
179 |
+ my $r = $r->route('/_admin')->to('_admin#'); |
|
180 |
+ |
|
181 |
+ # Users |
|
182 |
+ $r->any('/users')->to('#users'); |
|
183 | 183 |
|
184 | 184 |
# User |
185 |
- $r->any('/user')->to('#user'); |
|
185 |
+ { |
|
186 |
+ my $r = $r->route('/user')->to('_admin-user#'); |
|
187 |
+ |
|
188 |
+ # Create user |
|
189 |
+ $r->any('/create')->to('#create'); |
|
190 |
+ } |
|
186 | 191 |
} |
187 | 192 |
|
188 | 193 |
# User |
189 |
- $r->get('/:user')->to('#user'); |
|
194 |
+ $r->get('/:user')->name('user'); |
|
190 | 195 |
|
191 | 196 |
# Project |
192 | 197 |
{ |
193 | 198 |
my $r = $r->route('/:user/:project'); |
194 |
- $r->get('/')->to('#project'); |
|
199 |
+ $r->get('/')->name('project'); |
|
195 | 200 |
|
196 | 201 |
# Commit |
197 |
- $r->get('/commit/#diff')->to('#commit'); |
|
202 |
+ $r->get('/commit/#diff')->name('commit'); |
|
198 | 203 |
|
199 | 204 |
# Commits |
200 |
- $r->get('/commits/#rev', {id => 'HEAD'})->to('#commits'); |
|
201 |
- $r->get('/commits/#rev/(*blob)')->to('#commits'); |
|
205 |
+ $r->get('/commits/#rev', {id => 'HEAD'})->name('commits'); |
|
206 |
+ $r->get('/commits/#rev/(*blob)')->name('commits'); |
|
202 | 207 |
|
203 | 208 |
# Branches |
204 |
- $r->get('/branches')->to('#branches'); |
|
209 |
+ $r->get('/branches')->name('branches'); |
|
205 | 210 |
|
206 | 211 |
# Tags |
207 |
- $r->get('/tags')->to('#tags'); |
|
212 |
+ $r->get('/tags')->name('tags'); |
|
208 | 213 |
|
209 | 214 |
# Tree |
210 |
- $r->get('/tree/(*object)')->to('#tree'); |
|
215 |
+ $r->get('/tree/(*object)')->name('tree'); |
|
211 | 216 |
|
212 | 217 |
# Blob |
213 |
- $r->get('/blob/(*object)')->to('#blob'); |
|
218 |
+ $r->get('/blob/(*object)')->name('blob'); |
|
214 | 219 |
|
215 | 220 |
# Blob diff |
216 |
- $r->get('/blobdiff/(#diff)/(*file)')->to('#blobdiff'); |
|
221 |
+ $r->get('/blobdiff/(#diff)/(*file)')->name('blobdiff'); |
|
217 | 222 |
|
218 | 223 |
# Raw |
219 |
- $r->get('/raw/(*object)')->to('#raw'); |
|
224 |
+ $r->get('/raw/(*object)')->name('raw'); |
|
220 | 225 |
|
221 | 226 |
# Archive |
222 |
- $r->get('/archive/(#rev).tar.gz')->to('#archive', archive_type => 'tar'); |
|
223 |
- $r->get('/archive/(#rev).zip')->to('#archive', archive_type => 'zip'); |
|
227 |
+ $r->get('/archive/(#rev).tar.gz')->name('archive')->to(archive_type => 'tar'); |
|
228 |
+ $r->get('/archive/(#rev).zip')->name('archive')->to(archive_type => 'zip'); |
|
224 | 229 |
|
225 | 230 |
# Compare |
226 |
- $r->get('/compare/(#rev1)...(#rev2)')->to('#compare'); |
|
231 |
+ $r->get('/compare/(#rev1)...(#rev2)')->name('compare'); |
|
227 | 232 |
|
228 | 233 |
# Settings |
229 |
- $r->any('/settings')->to('#settings'); |
|
234 |
+ $r->any('/settings')->name('settings'); |
|
230 | 235 |
|
231 | 236 |
# Fork |
232 |
- $r->any('/fork')->to('#fork'); |
|
237 |
+ $r->any('/fork')->name('fork'); |
|
233 | 238 |
} |
234 | 239 |
} |
235 | 240 |
|
... | ... |
@@ -0,0 +1,10 @@ |
1 |
+% layout 'common'; |
|
2 |
+ |
|
3 |
+ %= include '/include/header'; |
|
4 |
+ <div class="container" style="min-heigth:500px"> |
|
5 |
+ <h3>Admin</h3> |
|
6 |
+ <ul class="nav nav-tabs nav-stacked"> |
|
7 |
+ <li><a href="<%= url_for('/_admin/users') %>">Users</a></li> |
|
8 |
+ </ul> |
|
9 |
+ </div> |
|
10 |
+ %= include '/include/footer'; |
... | ... |
@@ -1,14 +1,12 @@ |
1 | 1 |
<% |
2 |
- use Gitprep::API; |
|
3 | 2 |
use Mojo::Util 'md5_sum'; |
4 | 3 |
|
5 |
- my $api = Gitprep::API->new($self); |
|
4 |
+ my $api = gitprep_api; |
|
6 | 5 |
|
7 | 6 |
my $op = param('op') || ''; |
8 | 7 |
my $state = 'start'; |
9 | 8 |
|
10 | 9 |
my $errors; |
11 |
- my $users; |
|
12 | 10 |
if ($op eq 'create') { |
13 | 11 |
$state = 'create'; |
14 | 12 |
|
... | ... |
@@ -48,34 +46,32 @@ |
48 | 46 |
|
49 | 47 |
$self->flash(success => 1); |
50 | 48 |
$self->flash(id => $id); |
51 |
- $self->redirect_to('/_admin/user'); |
|
49 |
+ $self->redirect_to('current'); |
|
52 | 50 |
} |
53 | 51 |
else { |
54 | 52 |
$state = 'error'; |
55 | 53 |
$errors = $vresult->messages; |
56 | 54 |
} |
57 | 55 |
} |
58 |
- else { |
|
59 |
- $users = $api->users; |
|
60 |
- } |
|
61 | 56 |
%> |
62 | 57 |
|
63 |
-% layout 'common'; |
|
64 |
- |
|
65 | 58 |
% layout 'common'; |
66 | 59 |
|
67 | 60 |
%= include '/include/header'; |
68 | 61 |
|
69 |
- % my $id = ''; |
|
70 |
- % if (flash('success')) { |
|
71 |
- <br> |
|
72 |
- <b><center>Start up success! Please login as admin user.</center></b> |
|
73 |
- % $id = flash('id'); |
|
74 |
- % } |
|
62 |
+ <div class="container"> |
|
63 |
+ % my $id = ''; |
|
64 |
+ % if (flash('success')) { |
|
65 |
+ |
|
66 |
+ <div class="alert alert-success"> |
|
67 |
+ <button type="button" class="close" data-dismiss="alert">×</button> |
|
68 |
+ Success: User <b><%= flash('id') %></b> is created. |
|
69 |
+ </div> |
|
70 |
+ % } |
|
75 | 71 |
|
76 | 72 |
<div class="text-center"><h3>Create User</h3></div> |
77 | 73 |
<div class="well" style="background-color:white;padding-top:15px;padding-left:60px;width:300px;margin-left:auto;margin-right:auto"> |
78 |
- <form action="<%= url_for->query(op => 'login') %>" method="post"> |
|
74 |
+ <form action="<%= url_for->query(op => 'create') %>" method="post"> |
|
79 | 75 |
<div class="control-group"> |
80 | 76 |
<label class="control-label" for="user-name">User name</label> |
81 | 77 |
<div class="controls"> |
... | ... |
@@ -96,15 +92,6 @@ |
96 | 92 |
</div> |
97 | 93 |
</form> |
98 | 94 |
</div> |
95 |
+ <div class="text-center" style="margin-bottom:20px"><big><a href="/_admin/users">See Users</a></big></div> |
|
99 | 96 |
</div> |
100 |
- |
|
101 |
- <div class="container"> |
|
102 |
- <div class="text-center"><h3>Users</h3></div> |
|
103 |
- <div class="container"> |
|
104 |
- <ul class="nav nav-tabs nav-stacked"> |
|
105 |
- % for my $user (@$users) { |
|
106 |
- <li><a href="#"><%= $user->{id} %></a></li> |
|
107 |
- % } |
|
108 |
- </ul> |
|
109 |
- </div> |
|
110 |
- </div> |
|
97 |
+ %= include '/include/footer'; |
... | ... |
@@ -0,0 +1,23 @@ |
1 |
+<% |
|
2 |
+ my $api = gitprep_api; |
|
3 |
+ my $users = $api->users; |
|
4 |
+%> |
|
5 |
+ |
|
6 |
+% layout 'common'; |
|
7 |
+ |
|
8 |
+ %= include '/include/header'; |
|
9 |
+ |
|
10 |
+ <div class="container"> |
|
11 |
+ <div><h3>Admin Users</h3></div> |
|
12 |
+ <div style="margin-bottom:10px"><a class="btn" href="/_admin/user/create">Create User</a></div> |
|
13 |
+ <div class="container"> |
|
14 |
+ <ul class="nav nav-tabs nav-stacked"> |
|
15 |
+ % for my $user (@$users) { |
|
16 |
+ <li><a href="#"><%= $user->{id} %></a></li> |
|
17 |
+ % } |
|
18 |
+ </ul> |
|
19 |
+ </div> |
|
20 |
+ </div> |
|
21 |
+ <div class="text-center" style="margin-bottom:20px"><big><a href="/_admin">Admin page</a></big></div> |
|
22 |
+ |
|
23 |
+ %= include '/include/footer'; |
... | ... |
@@ -3,7 +3,7 @@ |
3 | 3 |
<head> |
4 | 4 |
<meta charset="UTF-8"> |
5 | 5 |
<meta name="robots" content="index, nofollow" > |
6 |
- <title>Git</title> |
|
6 |
+ <title>GitPrep</title> |
|
7 | 7 |
%= stylesheet '/css/bootstrap.css', rel => 'stylesheet', media => 'screen'; |
8 | 8 |
%= stylesheet '/js/google-code-prettify/prettify.css'; |
9 | 9 |
%= javascript '/js/jquery-1.9.0.min.js'; |
... | ... |
@@ -1,10 +0,0 @@ |
1 |
-% layout 'common'; |
|
2 |
- |
|
3 |
-<h2>Admin</h2> |
|
4 |
- |
|
5 |
-<table class="table"> |
|
6 |
- <tr> |
|
7 |
- <td><a href="<%= url_for('/_admin/user') %>">User</a></td> |
|
8 |
- </tr> |
|
9 |
-</table> |
|
10 |
- |