The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Yancy::Plugin::Editor - Yancy content editor, admin, and management application

VERSION

version 1.030

SYNOPSIS

    use Mojolicious::Lite;
    plugin Yancy => {
        backend => 'sqlite://myapp.db',
        read_schema => 1,
        editor => {
            # XXX
        },
    };

DESCRIPTION

XXX

CONFIGURATION

This plugin has the following configuration options.

XXX schema openapi default_controller backend moniker

route

A base route to add Yancy to. This allows you to customize the URL and add authentication or authorization. Defaults to allowing access to the Yancy web application under /yancy, and the REST API under /yancy/api.

return_to

The URL to use for the "Back to Application" link. Defaults to /.

HELPERS

yancy.editor.include

    $app->yancy->editor->include( $template_name );

Include a template in the editor, before the rest of the editor. Use this to add your own Vue.JS components to the editor.

yancy.editor.menu

    $app->yancy->editor->menu( $category, $title, $config );

Add a menu item to the editor. The $category is the title of the category in the sidebar. $title is the title of the menu item. $config is a hash reference with the following keys:

component

The name of a Vue.JS component to display for this menu item. The component will take up the entire main area of the application, and will be kept active even after another menu item is selected.

Yancy plugins should use the category Plugins. Other categories are available for custom applications.

    app->yancy->editor->include( 'plugin/editor/custom_element' );
    app->yancy->editor->menu(
        'Plugins', 'Custom Item',
        {
            component => 'custom-element',
        },
    );
    __END__
    @@ plugin/editor/custom_element.html.ep
    <template id="custom-element-template">
        <div :id="'custom-element'">
            Hello, world!
        </div>
    </template>
    %= javascript begin
        Vue.component( 'custom-element', {
            template: '#custom-element-template',
        } );
    % end

<img alt="screenshot of yancy editor showing custom element" src="https://raw.github.com/preaction/Yancy/master/eg/doc-site/public/screenshot-custom-element.png?raw=true" />

yancy.editor.route

Get the route where the editor will appear.

yancy.editor.openapi

    my $openapi = $c->yancy->openapi;

Get the Mojolicious::Plugin::OpenAPI object containing the OpenAPI interface for this Yancy API.

TEMPLATES

yancy/editor.html.ep

This is the main Yancy web application. You should not override this. If you need to, consider filing a bug report or feature request.

SEE ALSO

Yancy::Help::Config, Mojolicious::Plugin::Yancy, Yancy

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.