Ado

 view release on metacpan or  search on metacpan

.perltidyrc  view on Meta::CPAN

-nolq    # Don't outdent long quoted strings
-wbb="% + - * / x != == >= <= =~ < > | & **= += *= &= <<= &&= -= /= |= >>= ||= .= %= ^= x="
         # Break before all operators

# Extras/overrides/deviations from Perl Best Practices
--warning-output                      # Show warnings
--maximum-consecutive-blank-lines=2   # Default is 1
--nohanging-side-comments             # Troublesome for commented out code

-isbc   # Block comments may only be indented if they have some space characters before the #
# We use version control, so just rewrite the file and do not keep backup if there are no errors
-b -bext='/'

# For the up-tight folk :)
-pt=2    # High parenthesis tightness
-bt=2    # High brace tightness
-sbt=2   # High square bracket tightness

Changes  view on Meta::CPAN

  - Happy Christmass and New Year!
  - Applied for Grant from TPF:
    http://news.perlfoundation.org/2015/01/grant-proposal-ado---a-rapid-a.html
    This proposal will be used as roadmap.
  - Fixed typo in Ado::Build SYNOPSIS. Thanks RSAVAGE, WEBY.
  - Do not use deprecated in Mojolicious 5.73 $c->render_exception()
    and $c->render_not_found(). Use $c->reply->not_found() and
    $c->reply->exception() instead.
  - Started cleanups:
    Removed templates/добре/ок.html.ep just to reduce
    http://cpants.cpanauthors.org/dist/Ado/errors
  - Noted in etc/ado.conf that arbitrary Perl code can be executed
    when connecting to the database.
  - POD improvements and cleanups.
  - Upgraded to Mojolicious::Plugin::SemanticUI 0.11.

0.76 2014-12-14
  - Cleaned up Login form. It is used for local login only.
  - Not using flags for languages. Language menu is now a dropdown menu.
  - Upgraded to Mojolicious::Plugin::DSC 1.000 to be able to execute
    perl code upon connecting to the database.

lib/Ado/Command.pm  view on Meta::CPAN


Should get options from the commandline and populate C<$self-E<gt>args>.
Must return C<$self>.

=head2 run

A default C<$command-E<gt>run(@args)> method for all Ado::Command commands.
This is the entry point to your mini application.
Looks for subcommands/actions which are looked up in
the C<--do> commands line argument and executed.
Dies with an error message advising you to implement the subcommand
if it is not found in  C<$self-E<gt>config-E<gt>{actions}>.
Override it if you want specific behavior.

    # as bin/ado alabala --do action --param1 value
    Ado::Command::alabala->run(@ARGV);
    #or from a controller
    Ado::Command::alabala->run(
      --do => action => --param1 => 'value' );

=head2 config

lib/Ado/Command/generate/crud.pm  view on Meta::CPAN

    my $res;
    eval {
      $res = $table_class->create(
        title     => $v->param('title'),
        body      => $v->param('body'),
        user_id   => $c->user->id,
        group_id  => $c->user->group_id,
        deleted   => 0,
        #permissions => '-rwxr-xr-x',
        );
    }||$c->stash(error=>$@);#very rude!!!
        $c->debug('$error:'.$c->stash('error')) if $c->stash('error');

    my $data = $res->data;

    return $c->respond_to(
        json => {data => $data},
        html => {data => $data}
    );
}

# Reads a resource from table <%= $a->{t} %>. A naive example.

lib/Ado/Command/generate/crud.pm  view on Meta::CPAN

    my $v = $c->validation;
    my ($id) = $c->stash('id') =~/(\d+)/;
    my $res = $table_class->find($id);
    $c->reply->not_found() unless $res->data;
    $c->debug('$data:'.$c->dumper($res->data));

    if($v->has_data && $res->data){
        $v->optional('title')->size(3, 50);
        $v->optional('body')->size(3, 1 * 1024 * 1024);#1MB
        $res->title($v->param('title'))->body($v->param('body'))
         ->update() unless $v->has_error;
    }
    my $data = $res->data;
    return $c->respond_to(
        json => {article => $data},
        html => {article => $data}
    );
}

# "Deletes" a resource from table <%= $a->{t} %>.
sub delete {

lib/Ado/Command/generate/crud.pm  view on Meta::CPAN

@@ update_template
% $a = shift;
<article>
  Create your form for updating a resource here.
</article>


@@ delete_template
% $a = shift;
<article>
  <section class="ui error form segment"><%%= $message %></section>
</article>


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}
          ? $v->required($param)
          : $v->optional($param);
        foreach my $check (keys %$checks) {
            next if $check eq 'required';
            if (ref $$checks{$check} eq 'HASH') {
                $f->$check(%{$checks->{$check}});
            }
            elsif (ref $$checks{$check} eq 'ARRAY') {
                $f->$check(@{$checks->{$check}});
            }
            else { $f->$check($checks->{$check}) }
        }    #end foreach my $check
        $errors->{$param} = $f->error($param)
          if $f->error($param);

    }    #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) = @_;

lib/Ado/Control.pm  view on Meta::CPAN


=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
users. Note that this instance is not meant for manipulation and some fields
are not available for security reasons. The fields are: C<login_password
created_by changed_by disabled start_date>. TODO: move as much as possible
checks and fields retrieval in SQL, not in Perl.


lib/Ado/Control/Doc.pm  view on Meta::CPAN

}

#prepare a title for the html>head
sub _set_title {
    my ($c, $document) = @_;
    my $title = $document->find('h1,h2,h3')->[0];

    if (not $title) {
        $title = 'Няма Заглавие!';
        $c->title($title);
        $document->at('article')->prepend_content(qq|<h1 class="error">$title</h1>|);
    }
    else {
        $c->title($title->text);
    }
    return;
}

1;


lib/Ado/I18n/bg.pm  view on Meta::CPAN

package Ado::I18n::bg;
use Mojo::Base 'Ado::I18n';
use I18N::LangTags::List;
our %Lexicon = (    ##no critic(ProhibitPackageVars)
    hello          => 'Здрасти, [_1]!',
    Login          => 'Вписване',
    Logout         => 'Изход',
    Help           => 'Помощ',
    login_name     => 'Потребител',
    login_password => 'Парола',
    login_field_error =>
      'Моля въведете валидна стойност за полето "[_1]"!',
    first_name   => 'Име',
    last_name    => 'Фамилия',
    email        => 'Е-поща',
    title        => 'Заглавие/Име',
    tags         => 'Етикети',
    time_created => 'Created on',
    sorting      => 'Подредба',
    data_type    => 'Тип',
    data_format  => 'Формат',

lib/Ado/I18n/de.pm  view on Meta::CPAN

package Ado::I18n::de;
use Mojo::Base 'Ado::I18n';
use I18N::LangTags::List;
our %Lexicon = (    ##no critic(ProhibitPackageVars)
    hello             => 'Hallo [_1],',
    Logout            => 'Ausloggen',
    login_name        => 'Benutzer',
    login_password    => 'Passwort',
    login_field_error => 'Bitte gültigen Wert in Feld "[_1]" eintragen!',
    first_name        => 'Vorname',
    last_name         => 'Nachname',
    title             => 'Titel/Name',
    tags              => 'Tags',
    time_created      => 'Angelegt am',
    tstamp            => 'Verändert am',
    body              => 'Inhalt (body)',
    invisible         => 'Versteckt',
    language          => 'Sprache',
    group_id          => 'Gruppe',

lib/Ado/I18n/en.pm  view on Meta::CPAN

package Ado::I18n::en;
use Mojo::Base 'Ado::I18n';
use I18N::LangTags::List;
our %Lexicon = (    ##no critic(ProhibitPackageVars)
    hello             => 'Hello [_1],',
    Logout            => 'Sign out',
    login_name        => 'User',
    login_password    => 'Password',
    login_field_error => 'Please enter a valid value for the field "[_1]"!',
    first_name        => 'First Name',
    last_name         => 'Last Name',
    title             => 'Title/Name',
    tags              => 'Tags',
    time_created      => 'Created on',
    tstamp            => 'Changed on',
    body              => 'Content (body)',
    invisible         => 'Invisible',
    language          => 'Language',
    group_id          => 'Group',

lib/Ado/Model/Users.pm  view on Meta::CPAN

        );

        #And link them additionally
        Ado::Model::UserGroup->create(
            user_id  => $user->id,
            group_id => $group->id
        );
        $dbix->commit;
    };
    unless ($try) {
        $dbix->rollback or croak($dbix->error);
        carp("ERROR adding user(rolling back):[$@]");
    }
    return $user;
}

#Add an existing user to a potentially not existing group(create the group)
sub add_to_group {
    my $self = shift;
    my $args = $self->_get_obj_args(@_);
    state $dbix = $self->dbix;

lib/Ado/Model/Users.pm  view on Meta::CPAN

        }

        #Link them
        Ado::Model::UserGroup->create(
            user_id  => $self->id,
            group_id => $ingroup->id
        );
        $dbix->commit;
    };
    unless ($try) {
        $dbix->rollback or croak($dbix->error);
        carp("ERROR adding user to group (rolling back):[$@]");
    }
    return $ingroup;
}

__PACKAGE__->SQL(SELECT_group_names => <<"SQL");
    SELECT name FROM groups
        WHERE id IN (SELECT group_id FROM user_group WHERE user_id=?)
SQL

lib/Ado/Plugin/AdoHelpers.pm  view on Meta::CPAN

    return eval {
        $dbh->begin_work;
        for my $st (split /;/smx, $SQL) {
            $last_statement = $st;
            $dbh->do($st) if ($st =~ /\S+/smx);
        }
        $dbh->commit;
    } || do {
        my $e = "\nError in statement:$last_statement\n$@";
        my $e2;
        eval { $dbh->rollback } || ($e2 = $/ . 'Additionally we have a rollback error:' . $@);
        $app->log->error($e . ($e2 ? $e2 : ''));
        Carp::croak($e . ($e2 ? $e2 : ''));
    };
}

sub register {
    my ($self, $app, $conf) = shift->initialise(@_);

    # Add helpers
    $app->helper(user => sub { shift->user(@_) });

lib/Ado/Plugin/Auth.pm  view on Meta::CPAN

            $c->app->plugins->emit_hook(after_login => $c);

            # Redirect to referrer page with a 302 response
            $c->debug('redirecting to ' . $c->session('over_route'))
              if $Ado::Control::DEV_MODE;
            $c->redirect_to($c->session('over_route'));
            return;
        }
        else {
            unless ($c->res->code // '' eq '403') {
                $c->stash(error_login => 'Wrong credentials! Please try again!');
                $c->render(status => 401, template => 'login');
                return;
            }
        }
    }
    else {
        $c->app->log->error("Error calling \$login_helper:[$login_helper][$@]");
        $c->stash(error_login => 'Please choose one of the supported login methods.');
        $c->render(status => 401, template => 'login');
        return;
    }
    return;
}

#used as helper 'login_ado' returns 1 on success, '' otherwise
sub _login_ado {
    my ($c) = @_;

    #1. do basic validation first
    my $val = $c->validation;
    return '' unless $val->has_data;
    if ($val->csrf_protect->has_error('csrf_token')) {
        delete $c->session->{csrf_token};
        $c->render(error_login => 'Bad CSRF token!', status => 403, template => 'login');
        return '';
    }
    my $_checks = Ado::Model::Users->CHECKS;
    $val->required('login_name')->like($_checks->{login_name}{allow});
    $val->required('digest')->like(qr/^[0-9a-f]{40}$/);
    if ($val->has_error) {
        delete $c->session->{csrf_token};
        return '';
    }

    #2. find the user and do logical checks
    my $login_name = $val->param('login_name');
    my $user       = Ado::Model::Users->by_login_name($login_name);
    if ((not $user->id) or $user->disabled) {
        delete $c->session->{csrf_token};
        $c->stash(error_login_name => "No such user '$login_name'!");
        return '';
    }

    #3. really authnticate the user
    my $checksum = Mojo::Util::sha1_hex($c->session->{csrf_token} . $user->login_password);
    if ($checksum eq $val->param('digest')) {
        $c->session(login_name => $user->login_name);
        $c->user($user);
        $c->app->log->info('$user ' . $user->login_name . ' logged in!');
        delete $c->session->{csrf_token};

lib/Ado/Plugin/Auth.pm  view on Meta::CPAN

sub _login_google {
    my ($c) = @_;
    state $app = $c->app;
    my $provider  = $c->param('auth_method');
    my $providers = $app->config('Ado::Plugin::Auth')->{providers};

    #second call should get the token it self
    my $response = $c->oauth2->get_token($provider, $providers->{$provider});
    do {
        $c->debug("in _login_google \$response: " . $c->dumper($response));
        $c->debug("in _login_google error from provider: " . ($c->param('error') || 'no error'));
    } if $Ado::Control::DEV_MODE;
    if ($response->{access_token}) {    #Athenticate, create and login the user.
        return _create_or_authenticate_google_user(
            $c,
            $response->{access_token},
            $providers->{$provider}
        );
    }
    else {
        #Redirect to front-page and say sorry
        # We are very sorry but we need to know you are a reasonable human being.
        $c->flash(error_login => $c->l('oauth2_sorry[_1]', ucfirst($provider))
              . ($c->param('error') || ''));
        $c->app->log->error('error_response:' . $c->dumper($response));
        $c->res->code(307);    #307 Temporary Redirect
        $c->redirect_to('/');
    }
    return;
}

#used as helper within login()
# this method is called as return_url after the user
# agrees or denies access for the application
sub _login_facebook {
    my ($c) = @_;
    state $app = $c->app;
    my $provider  = $c->param('auth_method');
    my $providers = $app->config('Ado::Plugin::Auth')->{providers};

    #second call should get the token it self
    my $response = $c->oauth2->get_token($provider, $providers->{$provider});
    do {
        $c->debug("in _login_facebook \$response: " . $c->dumper($response));
        $c->debug(
            "in _login_facebook error from provider: " . ($c->param('error') || 'no error'));
    } if $Ado::Control::DEV_MODE;
    if ($response->{access_token}) {    #Athenticate, create and login the user.
        return _create_or_authenticate_facebook_user(
            $c,
            $response->{access_token},
            $providers->{$provider}
        );
    }
    else {
        #Redirect to front-page and say sorry
        # We are very sorry but we need to know you are a reasonable human being.
        $c->flash(error_login => $c->l('oauth2_sorry[_1]', ucfirst($provider))
              . ($c->param('error') || ''));
        $c->app->log->error('error_response:' . $c->dumper($response));
        $c->res->code(307);    #307 Temporary Redirect
        $c->redirect_to('/');
    }
    return;

}

sub _authenticate_oauth2_user {
    my ($c, $user, $time) = @_;
    if (   $user->disabled

lib/Ado/Plugin/Auth.pm  view on Meta::CPAN

    state $app = $c->app;
    if (my $user = Ado::Model::Users->add(_user_info_to_args($user_info, $provider))) {
        $app->plugins->emit_hook(after_user_add => $c, $user, $user_info);
        $c->user($user);
        $c->session(login_name => $user->login_name);
        $app->log->info($user->description . ' New $user ' . $user->login_name . ' logged in!');
        $c->flash(login_message => $c->l('oauth2_wellcome[_1]', $user->name));
        $c->redirect_to('/');
        return 1;
    }
    $app->log->error($@);
    return;
}

#next two methods
#(_create_or_authenticate_facebook_user and _create_or_authenticate_google_user)
# exist only because we pass different parameters in the form
# which are specific to the provider.
# TODO: think of a way to map the generation of the form arguments to the
# specific provider so we can dramatically reduce the number of provider
# specific subroutines

lib/Ado/Plugin/I18n.pm  view on Meta::CPAN

    $config->{language_from_host}    //= 1;
    $config->{language_from_param}   //= 1;
    $config->{language_from_cookie}  //= 1;
    $config->{language_from_headers} //= 1;
    $config->{language_param}        //= 'language';

    #Allow other namespaces too
    $config->{namespace} ||= 'Ado::I18n';

    my $e = Mojo::Loader::load_class($config->{namespace});
    $app->log->error(qq{Loading "$config->{namespace}" failed: $e}) if $e;

    # Defaults for $c->stash so templates without controllers can be used
    $app->defaults(language => '', language_from => '');

    #Add helpers
    $app->helper(language => \&language);
    $app->helper(l        => \&_maketext);

    #default routes including language placeholder.
    $app->load_routes($self->routes);

public/doc/bg/no_title.md  view on Meta::CPAN

This Document is for testing purposes only. 
It displays a "Няма Заглавие!" error title and h1 tag.

public/doc/en/no_title.md  view on Meta::CPAN

This Document is for testing purposes only. 
It displays a "No Title!" error title and h1 tag.

public/js/help_toc.js  view on Meta::CPAN

  //Set onclick behavior for all #toc and prev,next links  
  $(toc_links_selector+',.right.menu a').on('click',function(){
    var _link = this;
    $.get(_link.href)
    .done(function( data ) {
      $('article.main').remove();
      $('main').append(data);
      $('article.main div.ui.hidden').remove();
    }) .fail(function() {
        //TODO: I18N
        $('#error_loading_page .content p')
          .text('Error loading page"'+$(_link).attr('title')+'!"');
        $('#error_loading_page').modal('show');
    });
    if($( window ).width()<=640)
      $('#toc').sidebar('hide','slow');
    set_right_menu_arrows($(this))
    return false;
  });

  //Get and append the main.container with the cover page
  if(!$('article').length){
    //show the sidebar

public/vendor/pagedown/Markdown.Editor.js  view on Meta::CPAN

        // isCancel is true if we don't care about the input text.
        // isCancel is false if we are going to keep the text.
        var close = function (isCancel) {
            util.removeEvent(doc.body, "keydown", checkEscape);
            var text = input.value;

            if (isCancel) {
                text = null;
            }
            else {
                // Fixes common pasting errors.
                text = text.replace(/^http:\/\/(https?|ftp):\/\//, '$1://');
                if (!/^(?:https?|ftp):\/\//.test(text))
                    text = 'http://' + text;
            }

            dialog.parentNode.removeChild(dialog);

            callback(text);
            return false;
        };

t/ado/etc/plugins/bar.alabala.dummy  view on Meta::CPAN

#syntax error
{
  "s":"fsdfs
};

t/ado/lib/Ado/Plugin/Bar.pm  view on Meta::CPAN

#t/ado/lib/Ado/Plugin/Bar.pm
package Ado::Plugin::Bar;
use Mojo::Base 'Ado::Plugin';

#For testing syntax error in config files
has ext => 'dummy';
has config_classes => sub { {dummy => 'Mojolicious::Plugin::Config'} };

sub register {
    my ($self, $app, $config) = shift->initialise(@_);

    # Do plugin specific stuff
    # here...
    # ...
    return $self;

t/command/adduser.t  view on Meta::CPAN

    '-l'           => 'Last',
    '-p'           => 'asdasd',
};

subtest 'Ado::Command::adduser/stderr_invalid_arguments' => \&stderr_invalid_arguments;
sub add_ { $app->start('adduser', %$opt_) }

sub stderr_invalid_arguments {
    stderr_like(\&add_, qr/ERROR adding user.+Key 'name'/sm, 'invalid group name');

    #TODO: Add user friendly error messages when creating a user.
    # and find why sometime with invalid arguments, user gets created
}

#Going deeper
subtest 'Ado::Command::adduser/direct_usage' => \&direct_usage;

sub direct_usage {
    isa_ok(my $command = $class->new(), $class);
    like((eval { $command->init() }, $@), qr/^\s*?USAGE/, 'init croaks "USAGE..."');
    ok($command->init(%$opt, '--login_password' => '--------'), "\$command->init");

t/command/version.t  view on Meta::CPAN

eval "use Test::Output;";

plan skip_all => "Test::Output required for this test" if $@;

# skip this test when offline
{
    my $ua = Mojo::UserAgent->new(max_redirects => 10);
    $ua->proxy->detect;
    my $tx = $ua->get('api.metacpan.org');
    if (not $tx->success) {
        plan(skip_all => $tx->error);

        #plan(skip_all => "Because we are offline.");
    }
}

use_ok('Ado');
my $ACV = 'Ado::Command::version';
use_ok('Ado::Command::version');
isa_ok($ACV->new(), 'Ado::Command');

t/plugin/auth-01.t  view on Meta::CPAN

$t->get_ok('/login/ado', {Referer => $test_auth_url})->status_is(200)
  ->element_exists('section.ui.login_form form#login_form')
  ->text_like('form#login_form .ui.header:nth-child(1)' => qr'Sign in')
  ->element_exists('#login_name')->element_exists('#login_password');

#try unexisting login method
my $help_url = $t->ua->server->url->path('/help');
$t->get_ok('/login/alabala', {Referer => $help_url})->status_is(401)
  ->element_exists_not('input[name="_method"][checked="checked"]');
$t->post_ok('/login/alabala', {Referer => $help_url})->status_is(401)
  ->text_like('.ui.error.message' => qr/of the supported login methods/);

#try condition (redirects to /login url)
my $login_url =
  $t->get_ok('/test/authenticateduser')->status_is(302)->header_like('Location' => qr|/login$|)
  ->tx->res->headers->header('Location');

#login after following the Location header (redirect)
$t->get_ok($login_url);

#get the csrf fields

t/plugin/auth-01.t  view on Meta::CPAN

#try with no data
$t->post_ok($login_url)->status_is(401, 'No $val->has_data');

#try with unexisting user
$t->get_ok($login_url);
$form_hash->{login_name} = 'alabala';
$form_hash->{csrf_token} = $t->tx->res->dom->at('#login_form [name="csrf_token"]')->{value};
$form_hash->{digest} =
  Mojo::Util::sha1_hex($form_hash->{csrf_token} . Mojo::Util::sha1_hex('' . 'wrong_pass'));
$t->post_ok($login_url => {} => form => $form_hash)->status_is(401, 'No such user $login_name')
  ->text_like('#error_login',      qr'Wrong credentials! Please try again!')
  ->text_like('#error_login_name', qr"No such user '$form_hash->{login_name}'!");

done_testing;

t/plugin/example-01.t  view on Meta::CPAN

        routes     => [{route => '/a', to => 'a#b', over => 'a'}],

    },
    'No mode specific file - ok!'
);

#dying plugin
like(
    ((eval { $app->plugin('bar') }) || $@),
    qr/Can't load configuration from.+bar.alabala.dummy/,
    'mode specific with syntax error'
);

done_testing;

t/plugin/markdown_renderer.t  view on Meta::CPAN

  ->text_is('title' => 'Съдържание')->content_like(qr/<aside.+id="toc"/, '<aside> ok')
  ->content_unlike(qr/<article.+id="/, 'no article in toc page ok');

#help created already
$t->get_ok('/help/bg/toc.md')->status_is(200)->text_is('h1' => 'Съдържание')
  ->text_is('title' => 'Съдържание');

#no_title
$t->get_ok('/help/bg/no_title.md')->status_is(200)
  ->text_is('title'    => 'Няма Заглавие!')
  ->text_is('h1.error' => 'Няма Заглавие!')
  ->content_like(qr/<article/, '<article> ok');

#all pages in toc
my $dom = $t->tx->res->dom;
$dom->find('#toc a')->each(
    sub {
        my $a    = shift;
        my $text = $a->text();
        $t->get_ok("$a->{href}")->status_is(200)->text_is('title' => $text)
          ->text_is('article h1' => $text);

templates/articles/show.html.ep  view on Meta::CPAN

% head_javascript($sui_path.'/sidebar.min.js');
    <%= include 'articles/menu' %>
    <article class="ui main container pusher">
      <%= include 'partials/adobar' %>
      <div class="ui black right attached launch fixed button"><i class="sidebar icon"></i></div>

%if(stash->{html}){
  % title(eval{Mojo::DOM->new(stash->{html})->find('h1,h2,h3')->[0]->text}||'No title');
  %== stash->{html}
%}else {
<div class="ui error message">
  <h1 class="header">Not Found</h1>
  <p>The file "<%= $html_file %>" could not be found!</p>
</div>
%}
    </article> 
%=javascript begin
$('.ui.sidebar.menu')
  .sidebar({
    context: '.ui.pushable'
  })

templates/default/index.html.ep  view on Meta::CPAN

<%
head_css([
    $sui_path.'/header.min.css',
    $sui_path.'/icon.min.css', $sui_path.'/image.min.css',
    $sui_path.'/divider.min.css',
]);
head_javascript([$sui_path.'/popup.min.js']);
%>
<main class="ui">
<article class="ui main container">
% if(flash 'error'){
  <div class="ui error message">
    <div class="header">Error!</div><p><%= flash 'error'%></p>
  </div>
% }
% if(flash 'login_message'){
  <div class="ui success huge center message"><i class="close icon"></i>
%= flash 'login_message' 
  </div>
% }
  <h1><%= l 'hello', user->name %></h1>
%= include 'default/index_text', home => app->home, variant => $language;
</article> 

templates/doc/show.html.ep  view on Meta::CPAN

      </a>
    </div>
  </div>

  <%==$document %>
</main>

<!-- Modal box shown when a page cannot be loaded, e.g. Server is down.
  See help_toc.js.
 -->
<div class="ui modal hidden" id="error_loading_page">
  <i class="close icon"></i>
  <div class="ui inverted red block header">
  % # Messages will be I18N-ed via JS or Perl on a per-case basis
    Error loading page!
  </div>
  <div class="content">
    <div class="center">
      <p></p>
    </div>
  </div>

templates/partials/apache2htaccess.ep  view on Meta::CPAN


  % if($has_msfcgi){
    # Use your own perl. You may need to fix paths if they contain spaces.
    # Using Mojo::Server::FastCGI. 
    # Uncomment the following (and comment any previous "FcgidWrapper")
    # if you prefer Mojo::Server::FastCGI.
    <%= $plackup? '#':''%> FcgidWrapper "<%= "$args->{perl} $root/bin/$moniker" %> fastcgi"
  % }
</IfModule>
% }
# Make Ado handle any 404 errors.
ErrorDocument 404 /bin/<%=$moniker%>
DirectoryIndex /bin/<%=$moniker%>

#Some more security. Redefine the mime type for the most common types of scripts
AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

templates/partials/apache2vhost.ep  view on Meta::CPAN

		# Make sure to set the proper user and group
		SuexecUserGroup <%= $$args{user} %> <%= $$args{group} %> 
	</IfModule>
% }
  ServerName <%=$$args{ServerName}%>
  ServerAlias <%=$$args{ServerAlias}%>
  ServerAdmin <%=$$args{ServerAdmin}%>
  DocumentRoot <%=$$args{DocumentRoot}%>

  # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
  # error, crit, alert, emerg.
  # It is also possible to configure the loglevel for particular
  # modules, e.g.
  #LogLevel info ssl:warn rewrite:trace3
  LogLevel debug

  ErrorLog  <%=$$args{DocumentRoot}%>/log/apache2_error.log
  CustomLog <%=$$args{DocumentRoot}%>/log/apache2_access.log combined
  
  # Use .htaccess files for overriding and never show them.
  AccessFileName .htaccess
  <FilesMatch "^\.ht">
	  #2.2 configuration:
	  <IfModule !mod_authz_core.c>
	    Order deny,allow
	    Deny from all
	  </IfModule>

templates/partials/login_form.html.ep  view on Meta::CPAN

    $sui_path.'/form.min.js', 'vendor/crypto-js/rollups/sha1.js',
    'js/auth.js',
    ]);
%>

  <form class="ui form segment" method="POST" 
    action="<%=url_for('login/ado') %>" id="login_form">
    <div class="ui header">
    %=  l('Sign in') 
    </div>
    % if(stash->{error_login}) {
    <div id="error_login" class="ui error message" style="display:block">
      <%= stash->{error_login} %></div>
    % }
    <div class="field">
      <label for="login_name"><%=ucfirst l('login_name')%></label>
      <div class="ui left labeled icon input">
        %= text_field 'login_name', placeholder => l('login_name'), id => 'login_name', required => ''
        <i class="user icon"></i>
        <div class="ui corner label"><i class="icon asterisk"></i></div>
        % if(stash->{error_login_name}) {
        <div id="error_login_name" class="ui error message" style="display:block">
          <%= stash->{error_login_name} %>
        </div>
        % }
      </div>
    </div>
    <div class="field">
      <label for="login_password"><%=l('login_password')%></label>
      <div class="ui left labeled icon input">
        <input type="password" name="login_password" id="login_password" required="" />
        <i class="lock icon"></i>
        <div class="ui corner label"><i class="icon asterisk"></i></div>



( run in 0.794 second using v1.01-cache-2.11-cpan-65fba6d93b7 )