1 |
<%args> |
2 |
$user_id => 0 |
3 |
</%args> |
4 |
<%init> |
5 |
my $u = Transports::Model::User->new(); |
6 |
$u->load_by_cols( id => $user_id ); |
7 |
my $user = Jifty->web->new_action( |
8 |
class => $u->id ? 'UpdateUser' : 'CreateUser', |
9 |
record => $u, |
10 |
moniker => 'edit_user', |
11 |
); |
12 |
</%init> |
13 |
|
14 |
<div class="boxed boxed-yellow"> |
15 |
|
16 |
<% $user_id ? 'Change user' : 'Add new user' %> |
17 |
|
18 |
<% Jifty->web->form->start %> |
19 |
<% Jifty->web->form->next_page( url => $user_id ? '/users' : '/transports' ) %> |
20 |
<% $user->form_field('name') %> |
21 |
<% $user->form_field('email') %> |
22 |
<% $user->form_field('password') %> |
23 |
<% $user->form_field('password_confirm', label => 'Re-enter password' ) %> |
24 |
% if (Jifty->web->current_user->admin) { |
25 |
<% $user->form_field('admin') %> |
26 |
<% $user->form_field('can_import') %> |
27 |
% } |
28 |
|
29 |
<input type="hidden" name="user_id" value="<% $user_id %>"/> |
30 |
<div class="submit_button"> |
31 |
<% Jifty->web->link( |
32 |
label => $user_id ? 'Update user' : 'Add user', |
33 |
onclick => [ |
34 |
{ submit => $user }, |
35 |
{ replace_with => '/users/form', |
36 |
args => { foo => 42 } |
37 |
} |
38 |
] |
39 |
) %> |
40 |
</div> |
41 |
<% Jifty->web->form->end %> |
42 |
|
43 |
% if ($user_id && Jifty->web->current_user->admin) { |
44 |
<% Jifty->web->region( |
45 |
name => "user-landscape", |
46 |
path => "/users/landscape", |
47 |
defaults => { |
48 |
user_id => $user_id, |
49 |
}, |
50 |
) %> |
51 |
% } |
52 |
|
53 |
</div> |
54 |
|
55 |
|
56 |
<div class="cl"> |
57 |
Back to <% Jifty->web->link( |
58 |
label => 'list of all users', |
59 |
onclick => { |
60 |
replace_with => '/users/all', |
61 |
} |
62 |
) %> |
63 |
</div> |