37 |
} |
} |
38 |
}; |
}; |
39 |
|
|
40 |
|
sub codepress { |
41 |
|
return { render_as => 'Textarea' }; |
42 |
|
return { |
43 |
|
render_as => 'Jifty::Plugin::CodePress::Textarea', |
44 |
|
submit => { |
45 |
|
onclick => [ |
46 |
|
{ beforeclick => 'CodePress.beforeSubmit();' }, |
47 |
|
], |
48 |
|
}, |
49 |
|
}; |
50 |
|
} |
51 |
|
|
52 |
private template 'code_editor' => sub { |
private template 'code_editor' => sub { |
53 |
my $op = 'Create'; |
my $op = 'Create'; |
54 |
my $code = Perly::Model::Code->new(); |
my $code = Perly::Model::Code->new(); |
57 |
warn "loaded ", length( $code->source ), " bytes"; |
warn "loaded ", length( $code->source ), " bytes"; |
58 |
$op = 'Update'; |
$op = 'Update'; |
59 |
} |
} |
60 |
|
|
61 |
|
warn "## editor: ", dump( codepress ); |
62 |
|
|
63 |
form { |
form { |
64 |
my $action = new_action( class => $op . 'Code', arguments => { $code ? $code->as_hash : undef } ); |
my $action = new_action( class => $op . 'Code', arguments => { $code ? $code->as_hash : undef } ); |
65 |
render_param( $action => 'name' ); |
render_param( $action => 'name' ); |
66 |
render_param( $action => 'source', cols => 80, rows => 25, language => 'perl', render_as => 'Jifty::Plugin::CodePress::Textarea' ); |
render_param( $action => 'source', cols => 80, rows => 25, language => 'perl', render_as => codepress->{render_as} ); |
67 |
#render_action( $action => [ 'source' => { cols => 80, rows => 30 }, ] ); |
#render_action( $action => [ 'source' => { cols => 80, rows => 30 }, ] ); |
68 |
form_submit( |
form_submit( label => _($op), %{ codepress->{submit} } ); |
|
label => _($op), |
|
|
onclick => [ |
|
|
{ beforeclick => "CodePress.beforeSubmit();" }, |
|
|
], |
|
|
); |
|
69 |
# IE problem http://support.microsoft.com/kb/281197 |
# IE problem http://support.microsoft.com/kb/281197 |
70 |
form_next_page( url => '/run/code=' . $action->argument_value('id') ); |
form_next_page( url => '/run/code=' . $action->argument_value('id') ); |
71 |
} |
} |