App-AutoCRUD
view release on metacpan or search on metacpan
lib/App/AutoCRUD/View/Json.pm view on Meta::CPAN
convert_blessed => 1 }} );
sub render {
my ($self, $data, $context) = @_;
# encode output
my $json_maker = JSON::MaybeXS->new(%{$self->{json_args}});
my $output = $json_maker->encode($data);
return [200, ['Content-type' => 'application/json; charset=UTF-8'],
[$output] ];
}
1;
__END__
lib/App/AutoCRUD/View/TT.pm view on Meta::CPAN
);
my $renderer = Template->new(%tt_args);
my $template = $context->template
or die "no template for TT view";
$renderer->process("src/$template",
{data => $data, c => $context},
\my $output)
or die $renderer->error;
return [200, ['Content-type' => 'text/html; charset=utf-8',
'X-UA-Compatible' => "IE=edge", # enforce latest MSIE rendering
],
[encode_utf8($output)] ];
}
sub default_dashed_args {
my ($self, $context) = @_;
return (-page_index => 1,
lib/App/AutoCRUD/View/Tsv.pm view on Meta::CPAN
my $cols = $colgroup->{columns};
push @headers, map {$_->{COLUMN_NAME}} @$cols;
}
# assemble header row and data rows
no warnings 'uninitialized';
my $str = join("\n", join("\t", @headers),
map {join("\t", @{$_}{@headers})} @{$data->{rows}});
# return Plack response
return [200, ['Content-type' => 'text/tab-separated-values; charset=utf-16'],
[encode("utf16", $str)] ];
}
1;
__END__
lib/App/AutoCRUD/share/templates/src/table/insert.tt view on Meta::CPAN
<div class="actions">
<a href="descr">describe</a> |
<a href="search">search</a> this table
</div>
<h1>Insert into [% data.table %]</h1>
<form action="[% dsbase _ 'table/' _ data.table _ '/insert' %]"
method="POST" id='insert_form' accept-charset='utf-8'>
<div id="TN_tree">
[% USE group_iter = iterator(data.colgroups) %]
[% FOREACH group IN group_iter %]
<div class="TN_node">
<span class="TN_label groupname">[% group.name %]</span>
<div class="TN_content">
[% FOREACH col IN group.columns;
SET col_name = col.COLUMN_NAME %]
<div class="TN_leaf">
lib/App/AutoCRUD/share/templates/src/table/update.tt view on Meta::CPAN
[%# ---------- start body ---------- %]
<div class="actions">
<a href="descr">describe</a> |
<a href="search">search</a> this table
</div>
<h1>Update [% data.table %]</h1>
<form action="update" method="POST" id='update_form' accept-charset='utf-8'
[% "onsubmit='return confirm_n_ary_operation(this,\"update\")'"
IF ! data.where_pk %]>
<div id="TN_tree">
[% FOREACH multi_cols_key IN data.multi_cols_keys %]
<div class="TN_node">
<span class="TN_label groupname">Multi-column keys</span>
<div class="TN_content">
<div class="TN_leaf">
( run in 0.262 second using v1.01-cache-2.11-cpan-4d50c553e7e )