Ado
view release on metacpan or search on metacpan
- Removed plugin "vest" listed in etc/ado.conf but not yet on CPAN.
0.64 2014-09-21
- Preparing for the first Ado plugin - Ado::Plugin::Vest,
that will be an example of how to build applications on Ado.
- Upgraded to Mojolicious::Plugin::SemanticUI 0.05.
- Renamed method PERL_FILES to PERL_DIRS in Ado::Build.
- Importing PERL_DIRS in Ado::BuildPlugin so it can be used
for plugins like Ado::Build is used for installing Ado.
- Upgraded to Mojolicious 5.42.
- Fixed bug in Ado::Control::validate_input().
- Added dummy records in tables groups and users.
- Test::AdoPlugin is deprecated.
- In Ado::Plugin::initialise() now we also check for plugin specific
public folder and add it to Ado $app->static->paths.
- Downgraded to Module::Build 0.42.
0.63 2014-09-09
- Deleted public/vendor/Semantic-UI.
- Now example pages depend on Mojolicious::Plugin::SemanticUI,
but you can just comment 'SemanticUI' in ado.conf and it will not be loaded.
- Removed $ADO_HOME (by popular demand)
and symplified installation process a lot.
- Improved Manual.pod/README.
0.21 2013-12-28 03:37:42 CET
- Added build action submit (draft).
- Added build action "perltidy" - see Ado::Build.
deleted: bin/ado_perltidy
Thanks to Vulcho Nedelchev(WEBY) for the inspiration.
- Improved list_for_json in Ado::Control.
- Implemented validate_input in Ado::Control.
- Implemented Test::AdoPlugin.
- Huge enhancements in documentation
(mostly in Ado::Manual::Contributing).
- Shut up "Wide character in print" from Pod::Spelling.
0.20 2013-12-24 03:22:10 CET
- Removed dependency IO::Socket::SSL - not mandatory yet
- Upgraded to Mojolicious 4.63
- Enhanced Ado::Manual
- Skipping pod-coverage.t under Perl 5.014
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
#load routes defined in ado.conf
sub load_routes {
my ($app, $config_routes) = @_;
$config_routes ||= $app->config('routes') || [];
my $routes = $app->routes;
# Hide Ado::Control methods and attributes from router.
$routes->hide(
qw(
debug config require_format list_for_json
validate_input
)
);
foreach my $route (@$config_routes) {
my ($pattern, $over, $to, $via, $params) =
($route->{route}, $route->{over}, $route->{to}, $route->{via}, $route->{params});
next unless $to;
my $r = $params ? $routes->route($pattern, %$params) : $routes->route($pattern);
lib/Ado/Command/generate/crud.pm view on Meta::CPAN
return $c->respond_to(
json => {data => $data},
html => {data => $data}
);
}
# Reads a resource from table <%= $a->{t} %>. A naive example.
sub read {
my $c = shift;
#This could be validated by a stricter route
my ($id) = $c->stash('id') =~/(\d+)/;
my $data = $table_class->find($id)->data;
$c->debug('$data:'.$c->dumper($data));
return $c->respond_to(
json => {article => $data},
html => {article => $data}
);
}
lib/Ado/Control.pm view on Meta::CPAN
}
: ()
),
],
data => $data,
($meta ? (meta => $meta) : ())
},
};
} # end sub list_for_json
#validates input parameters given a rules template
sub validate_input {
my ($c, $template) = @_;
my $v = $c->validation;
my $errors = {};
foreach my $param (keys %$template) {
my $checks = $template->{$param};
$checks || next; #false or undefined?!?
#field
my $f =
$checks->{required}
lib/Ado/Control.pm view on Meta::CPAN
} #end foreach my $param
return {
( !!keys %{$errors}
? ( errors => $errors,
json => {
status => 'error',
code => 400,
message => $errors,
data => 'validate_input'
}
)
: (output => $v->output)
)
};
}
sub user {
my ($c, $user) = @_;
state $delete_fields = [qw(login_password created_by changed_by disabled start_date email)];
lib/Ado/Control.pm view on Meta::CPAN
$c->require_formats('json') || return;
$c->debug('rendering json only');
#your stuff here...
return;
}
This method exists only to show more descriptive message with available
formats to the end user and to give a chance to user agents to go to the
preferred resource URL.
=head2 validate_input
Uses L<Mojolicious::Controller/validation> to validate all input parameters at
once given a validation template. The template consists of keys matching the
input parameters to be validated. The values are HASH references describing
the rules. Each rule name corresponds to a method/check in
L<Mojolicious::Validator/CHECKS>. You can use your own checks if you add them
using L<Mojolicious::Validator/add_check>.
Returns a HASH reference. In case of errors it contains C<errors> and C<json>
HASH references. In case of success contains only C<output> HASH reference
from L<Mojolicious::Validator::Validation/output>.
my $rules = {
to_uid => {
'required' => 1, like => qr/^\d{1,20}$/
},
subject => {
'required' => 1, like => qr/^.{1,255}$/
},
#...
}
my $result = $c->validate_input($rules);
#400 Bad Request
return $c->render(
status => 400,
json => $result->{json}
) if $result->{errors};
=head2 user
Returns the current user. This is the user C<guest> for not authenticated
( run in 0.436 second using v1.01-cache-2.11-cpan-4d50c553e7e )