6 |
$u->load_by_cols( id => $user_id ); |
$u->load_by_cols( id => $user_id ); |
7 |
my $user = Jifty->web->new_action( |
my $user = Jifty->web->new_action( |
8 |
class => $u->id ? 'UpdateUser' : 'CreateUser', |
class => $u->id ? 'UpdateUser' : 'CreateUser', |
9 |
record => $u |
record => $u, |
10 |
|
moniker => 'edit_user', |
11 |
); |
); |
12 |
</%init> |
</%init> |
13 |
|
|
16 |
<% $user_id ? 'Change user' : 'Add new user' %> |
<% $user_id ? 'Change user' : 'Add new user' %> |
17 |
|
|
18 |
<% Jifty->web->form->start %> |
<% Jifty->web->form->start %> |
19 |
<% Jifty->web->form->next_page( url => '/transports' ) %> |
<% Jifty->web->form->next_page( url => $user_id ? '/users' : '/transports' ) %> |
20 |
<% $user->form_field('name') %> |
<% $user->form_field('name') %> |
21 |
<% $user->form_field('email') %> |
<% $user->form_field('email') %> |
22 |
<% $user->form_field('password') %> |
<% $user->form_field('password') %> |
23 |
<% $user->form_field('password_confirm', label => 'Re-enter password' ) %> |
<% $user->form_field('password_confirm', label => 'Re-enter password' ) %> |
24 |
|
% if (Jifty->web->current_user->admin) { |
25 |
<% $user->form_field('admin') %> |
<% $user->form_field('admin') %> |
26 |
<% $user->form_field('can_import') %> |
<% $user->form_field('can_import') %> |
27 |
<% Jifty->web->form->submit( label => $user_id ? 'Update user' : 'Add user' ) %> |
% } |
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 %> |
<% Jifty->web->form->end %> |
42 |
|
|
43 |
% if ($user_id) { |
% if ($user_id && Jifty->web->current_user->admin) { |
44 |
<% Jifty->web->region( |
<% Jifty->web->region( |
45 |
name => "user-landscape", |
name => "user-landscape", |
46 |
path => "/users/landscape", |
path => "/users/landscape", |
51 |
% } |
% } |
52 |
|
|
53 |
</div> |
</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> |