The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
% use Mojo::JSON 'j';
% title 'Galileo Setup - Configure';
% layout 'basic';

%= form_for 'store_config' => method => 'POST', class => 'form-horizontal' => begin
  % my $config = app->config;

  <legend>Database Connection</legend>
  %= control_group for => 'db_dsn', label => 'Connection String (DSN)' => begin
    %= text_field 'db_dsn', value => $config->{db_dsn}, class => 'input-block-level'
  % end
  %= control_group for => 'db_username', label => 'Username' => begin
    %= text_field 'db_username', value => $config->{db_username}, class => 'input-block-level'
  % end
  %= control_group for => 'db_password', label => 'Password' => begin
    %= input_tag 'db_password', value => $config->{db_password}, type => 'password', class => 'input-block-level'
  % end
  %= control_group for => 'db_options', label => 'Options (JSON hash)' => begin
    %= text_field 'db_options', value => j($config->{db_options}), class => 'input-block-level'
  % end
  %= control_group for => 'db_schema', label => 'Schema Class' => begin
    %= text_field 'db_schema', value => $config->{db_schema}, class => 'input-block-level'
  % end

  <legend>Additional Files</legend>

  %= control_group for => 'files', label => 'Extra Static Paths (JSON array)' => begin
    %= text_field 'extra_static_paths', value => j($config->{extra_static_paths}), class => 'input-block-level'
  % end
  %= control_group for => 'extra_js', label => 'Extra Javascript Files (JSON array)' => begin
    %= text_field 'extra_js', value => j($config->{extra_js}), class => 'input-block-level'
  % end
  %= control_group for => 'extra_css', label => 'Extra Stylesheet files (JSON array)' => begin
    %= text_field 'extra_css', value => j($config->{extra_css}), class => 'input-block-level'
  % end
  %= control_group for => 'upload_path', label => 'Upload Path' => begin
    %= text_field 'upload_path', value => $config->{upload_path}, class => 'input-block-level'
  % end

  <legend>Other Options</legend>

  %= control_group for => 'sanitize', label => 'Use Sanitizing Editor' => begin
    % if($config->{sanitize}){
      %= check_box 'sanitize', value => 1, checked => 'checked'
    % } else {
      %= check_box 'sanitize', value => 1
    % }
    %= hidden_field 'sanitize' => 0
  % end
  %= control_group for => 'files', label => 'Pagedown Extra Options (JSON hash)' => begin
    %= text_field 'pagedown_extra_options', value => j($config->{pagedown_extra_options}), class => 'input-block-level'
  % end
  %= control_group for => 'secrets', label => 'Application Secrets (JSON array)' => begin
    %= text_field 'secrets', value => j($config->{secrets}), class => 'input-block-level'
  % end
  %= control_group for => 'submit-button', begin
    <button class="btn" id="submit-button" type="submit">Save</button>
    %= link_to 'Cancel' => '/' => class => 'btn'
  % end
% end