docassemble

repository·master·Indexed 21 days ago

https://github.com/jhpyle/docassemble

A platform for automating the creation of complex documents and workflows, primarily used in legal and administrative contexts. It enables the creation of interactive interview-style applications to collect data and generate documents. The system includes base components via the docassemble.base package and integrates various web utilities such as the Are-You-Sure jQuery plugin for dirty form detection, Bootstrap Combobox, and bootstrap-fileinput.

Tokens
16.6K
Snippets
47
Records
75
Agent score
75%

What's inside docassemble

  1. Optional Dependent Plugins for bootstrap-fileinput

    master

    The following plugins extend the functionality of bootstrap-fileinput and must be loaded before fileinput.min.js:

    • piexif.min.js: Required for image resizing and auto-orienting/restoring EXIF data.
    • sortable.min.js: Required if you want to allow users to sort or rearrange files in the initial preview.
    • buffer.min.js & filetype.min.js: Required for advanced mime type parsing (ensures correct preview even if file extensions are incorrect).
  2. How to use custom labels with data-labelauty

    master

    You can provide custom labels for the unchecked and checked states using the data-labelauty attribute on your input elements. The default separator between the two labels is the pipe character |.

    ### Unchecked|Checked
    Use a separator to define different labels for each state:
    ```html
    <input type="checkbox" data-labelauty="Don't synchronize files|Synchronize my files"/>

    Permanent Message

    If you omit the separator, the text will act as a permanent label that does not change between states:

    <input type="checkbox" data-labelauty="Synchronize my files"/>

    Default Labels

    If you omit the data-labelauty attribute entirely, the plugin uses its default labels (typically "Checked" and "Unchecked").

    <input type="checkbox"/>
  3. Exclude jQuery from build (Browserify or Webpack)

    master

    Since jQuery is optional, you can exclude it from your bundle.

    Browserify: Use the -u flag to unregister jQuery:

    browserify --im -u jquery main.js > bundle.js

    Webpack: Add a stub to your resolve.alias section in the Webpack config, and create a stub module that exports null.

    Stub module (./jquery-stub.js):

    module.exports = null;

    Webpack Config:

    resolve: {
        alias: {
             "jquery": path.join(__dirname, "./jquery-stub.js")
        }
    }
  4. Pre-requisites for bootstrap-fileinput

    master

    Before using bootstrap-fileinput, ensure your environment meets the following requirements:

    1. Bootstrap: Supports Bootstrap 5.x (since v5.2.0), 4.x (since v4.4.4), and 3.x.
    2. jQuery: The latest version of jQuery is required.
    3. Browser Support:
      • Modern browsers supporting HTML5 (inputs and FileReader API), CSS3, and jQuery.
      • For Internet Explorer, version 10 or higher is required for full functionality. IE9 and below will function as a standard file input without multiple selection or the HTML5 FileReader API.
    4. AJAX Uploads: Requires browser support for HTML5 FormData and XHR2. If these are not supported, the plugin automatically degrades to standard form-based submission.
  5. Load assets for bootstrap-fileinput

    master

    To use the bootstrap-fileinput plugin, you must load assets in a specific order. The core requirements are Bootstrap (4.x, 5.x, or 3.3.x CSS), jQuery, and the plugin's own CSS and JS files.

    Required Order of Loading:

    1. Bootstrap CSS
    2. Bootstrap Icons CSS (or Font Awesome if using the fas theme)
    3. fileinput.min.css
    4. jQuery
    5. Advanced Mime Type Plugins (buffer.min.js and filetype.min.js) — Required for correct mime type parsing and previews.
    6. Optional Dependent Plugins (piexif.min.js or sortable.min.js) — Must be loaded BEFORE fileinput.min.js.
    7. Bootstrap JS Bundle (needed for zoom/detail modals)
    8. fileinput.min.js
    9. Theme/Locale files (optional)
    <!-- Example loading sequence -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.min.css">
    <link href="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.4/css/fileinput.min.css" rel="stylesheet" />
    
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.4/js/plugins/buffer.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.4/js/plugins/filetype.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.4/js/plugins/piexif.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.4/js/plugins/sortable.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/gh/kartik-v/bootstrap-fileinput@5.5.4/js/fileinput.min.js"></script>
  6. Install bootstrap-fileinput via NPM, Bower, or Composer

    master

    You can install the bootstrap-fileinput plugin using several package managers depending on your project environment.

    NPM

    Use the npm package manager:

    npm install bootstrap-fileinput

    Bower

    Use the bower package manager:

    bower install bootstrap-fileinput

    Composer

    Use the composer package manager by running the following command:

    php composer.phar require kartik-v/bootstrap-fileinput "@dev"

    Alternatively, add the following line to your composer.json file:

    "kartik-v/bootstrap-fileinput": "@dev"

    Manual Installation

    Download the source ZIP or TAR ball and extract the css and js folders directly into your project.

  7. Install the Are-You-Sure jQuery plugin

    master

    You can install are-you-sure using Bower or by manually including the standalone JavaScript file in your project.

    Manual Installation: Download jquery.are-you-sure.js and include it in your page. For better performance, consider concatenating it with your other JS files.

    Bower Installation:

    $ bower install jquery.are-you-sure

    Prerequisites:

    • jQuery version 1.4.2 or higher (2.0+ or 1.10+ recommended).

    Mobile Support: To provide experimental support for Mobile Safari (iOS), also include ays-beforeunload-shim.js in your page.

    #!/bin/bash
    $ bower install jquery.are-you-sure