A small plugin for Frappe that adds the support of customizations to the attach control.

Overview

Frappe Better Attach Control

A small plugin for Frappe that adds the support of customizations to the attach control.

Table of Contents


Requirements

  • Frappe >= v13.0.0

Setup

Install

  1. Get the plugin from Github

(Required only once)

bench get-app https://github.com/kid1194/frappe-better-attach-control

  1. Install the plugin on any instance/site you want

bench --site [sitename] install-app frappe_better_attach_control

  1. Check the usage section below

Update

  1. Go to the app directory (frappe-bench/apps/frappe_better_attach_control) and execute:

git pull

  1. Go back to the frappe-bench directory and execute:

bench --site [sitename] migrate

  1. In case you need to restart bench, execute:

bench restart

Uninstall

  1. Uninstall the plugin from the instance/site

bench --site [sitename] uninstall-app frappe_better_attach_control

  1. Uninstall the plugin from bench

bench remove-app frappe_better_attach_control


Usage

  1. Go to Customization > Customize Form
  2. Enter the form type/name (Ex: 'User')
  3. Scroll down to the form fields area and edit the Attach or Attach Image fields you want
  4. In the options property of the fields, add a JSON object of the customizations you want. Example: {"allowed_file_types": ["jpg", "png", "gif"]}

Available Options

upload_notes

Upload text to be displayed.

Example: "Only allowed to upload images and video, with maximum size of 2MB"

Default: ""

allow_multiple

Allow multiple uploads.

⚠️ (Field value is a JSON array of files url)

Default: false

max_file_size

Maximum file size (in bytes) that is allowed to be uploaded.

Example: 2048 for 2KB

Default: Value of maximum file size in Frappe's settings

allowed_file_types

Array of allowed file types (mimes) or extensions to upload.

Example: ["image/*", "video/*", ".pdf", ".doc"]

Default: null or ["image/*"]

max_number_of_files

Maximum number of files allowed to be uploaded if multiple upload is allowed.

⚠️ (Bypassing the maximum attachments of doctype might not work)

Example: 4

Default: Value of maximum attachments set for the doctype

crop_image_aspect_ratio

Crop aspect ratio for images (Frappe >= v14.0.0).

Example: 1 or 16/9 or 4/3

Default: 1


Supported Fields

  • Attach
  • Attach Image

ToDo

  • HTML display for multiple files upload in Attach control
  • Display popover for multiple files upload in Attach Image control

License

MIT

You might also like...

Adds promise support (rejects(), doesNotReject()) to tape by decorating it using tape-promise.

Tape With Promises Adds promise support (rejects(), doesNotReject()) to tape by decorating it using tape-promise. Install npm install --save-dev @smal

Mar 21, 2022

Adds support for Blade templates to Prettier. (work in progress)

Laravel Blade support for Prettier ⚠️ This plugin is still a work-in-progress. If you're trying it out, please keep this in mind. This package include

Sep 20, 2022

A small javascript DOM manipulation library based on Jquery's syntax. Acts as a small utility library with the most common functions.

Quantdom JS Quantdom is a very small (about 600 bytes when ran through terser & gzipped) dom danipulation library that uuses a Jquery like syntax and

Aug 16, 2022

✏️ A small jQuery extension to turn a static HTML table into an editable one. For quickly populating a small table with JSON data, letting the user modify it with validation, and then getting JSON data back out.

jquery-editable-table A small jQuery extension to turn an HTML table editable for fast data entry and validation Demo 👉 https://jsfiddle.net/torrobin

Jul 31, 2022

It’s a Ticketing software for small companies which are into customer support.

It’s a Ticketing software for small companies which are into customer support.

What is VueTicket? The VueTicket is an Ticketing Application for small companies which are into customer support. Technologies Used • ASP.NET Core 5.0

Nov 27, 2022

This Plugin adds shortcodes with various prewritten phrases to improve quality and productivity of your writing.

Obsidian Phrasebank This Plugin adds shortcodes with various prewritten phrases to improve quality and productivity of your writing. Example :intro_pr

Jan 1, 2023

Obsidian plugin that adds autocomplete and auto-formatting to frontmatter tags.

Obsidian plugin that adds autocomplete and auto-formatting to frontmatter tags.

Obsidian Front Matter Tag Wizard Tired of having to type # to get tag autocompletion in your Obsidian note front matter? I feel your pain. This plugin

Nov 5, 2022

A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view.

A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view.

Strapi Preview Button A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view. Get Started Features I

Dec 30, 2022

This plugin for Obsidian adds commands for increasing/decreasing the blockquote level of the current line or selection(s).

This plugin for Obsidian adds commands for increasing/decreasing the blockquote level of the current line or selection(s).

Blockquote Levels This plugin for Obsidian adds commands for increasing/decreasing the blockquote level of the current line or selection(s). Usage The

Dec 19, 2022
Comments
  • Error while getting branch v2-beta

    Error while getting branch v2-beta

    find the log below... the error seems to be a build error

    Getting frappe-better-attach-control
    $ git clone https://github.com/kid1194/frappe-better-attach-control --branch v2-beta --depth 1 --origin upstream
    Cloning into 'frappe-better-attach-control'...
    remote: Enumerating objects: 59, done.
    remote: Counting objects: 100% (59/59), done.
    remote: Compressing objects: 100% (41/41), done.
    remote: Total 59 (delta 15), reused 40 (delta 10), pack-reused 0
    Receiving objects: 100% (59/59), 31.04 KiB | 836.00 KiB/s, done.
    Resolving deltas: 100% (15/15), done.
    Ignoring dependencies of https://github.com/kid1194/frappe-better-attach-control. To install dependencies use --resolve-deps
    Installing frappe_better_attach_control
    $ /home/frappe/frappe-bench/env/bin/python -m pip install --quiet --upgrade -e /home/frappe/frappe-bench/apps/frappe_better_attach_control 
    $ bench build --app frappe_better_attach_control
    ✔ Application Assets Linked                                                                                                                                   
    
    
    yarn run v1.22.19
    warning ../../package.json: No license field
    $ node esbuild --production --apps frappe_better_attach_control --run-build-command
    ✘ [ERROR] No matching export in "../frappe_better_attach_control/frappe_better_attach_control/public/js/filetypes/audio.js" for import "default"
    
        ../frappe_better_attach_control/frappe_better_attach_control/public/js/filetypes/index.js:8:7:
          8 │ import is_audio from './audio.js';
            ╵        ~~~~~~~~
    
    ✘ [ERROR] No matching export in "../frappe_better_attach_control/frappe_better_attach_control/public/js/filetypes/pdocument.js" for import "default"
    
        ../frappe_better_attach_control/frappe_better_attach_control/public/js/filetypes/index.js:11:7:
          11 │ import is_pdocument from './pdocument.js';
             ╵        ~~~~~~~~~~~~
    
     ERROR  There were some problems during build
    
    Error: Build failed with 2 errors:
    ../frappe_better_attach_control/frappe_better_attach_control/public/js/filetypes/index.js:8:7: ERROR: No matching export in "../frappe_better_attach_control/frappe_better_attach_control/public/js/filetypes/audio.js" for import "default"
    ../frappe_better_attach_control/frappe_better_attach_control/public/js/filetypes/index.js:11:7: ERROR: No matching export in "../frappe_better_attach_control/frappe_better_attach_control/public/js/filetypes/pdocument.js" for import "default"
        at failureErrorWithLog (/home/frappe/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:1600:15)
        at /home/frappe/frappe-bench/apps/frappe/node_modules/esbuild/lib/main.js:1246:28
        at processTicksAndRejections (node:internal/process/task_queues:96:5)
    Terminated
    error Command failed with exit code 143.
    info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    Traceback (most recent call last):
      File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
        exec(code, run_globals)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 109, in <module>
        main()
      File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
        click.Group(commands=commands)(prog_name="bench")
      File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 829, in __call__
        return self.main(*args, **kwargs)
      File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 782, in main
        rv = self.invoke(ctx)
      File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke
        return callback(*args, **kwargs)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 82, in build
        bundle(mode, apps=apps, hard_link=hard_link, verbose=verbose, skip_frappe=skip_frappe)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/build.py", line 257, in bundle
        frappe.commands.popen(command, cwd=frappe_app_path, env=get_node_env(), raise_err=True)
      File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 98, in popen
        raise subprocess.CalledProcessError(return_, command)
    subprocess.CalledProcessError: Command 'yarn run production --apps frappe_better_attach_control --run-build-command' returned non-zero exit status 143.
    ERROR: 
    Traceback (most recent call last):
      File "/home/frappe/.local/bin/bench", line 8, in <module>
        sys.exit(cli())
      File "/home/frappe/.local/lib/python3.10/site-packages/bench/cli.py", line 127, in cli
        bench_command()
      File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
        return self.main(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
        rv = self.invoke(ctx)
      File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
        return _process_result(sub_ctx.command.invoke(sub_ctx))
      File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
        return __callback(*args, **kwargs)
      File "/home/frappe/.local/lib/python3.10/site-packages/bench/commands/make.py", line 159, in get_app
        get_app(
      File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 432, in get_app
        app.install(verbose=verbose, skip_assets=skip_assets, restart_bench=restart_bench)
      File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/render.py", line 126, in wrapper_fn
        return fn(*args, **kwargs)
      File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 230, in install
        install_app(
      File "/home/frappe/.local/lib/python3.10/site-packages/bench/app.py", line 574, in install_app
        build_assets(bench_path=bench_path, app=app)
      File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/bench.py", line 330, in build_assets
        exec_cmd(command, cwd=bench_path, env={"BENCH_DEVELOPER": "1"})
      File "/home/frappe/.local/lib/python3.10/site-packages/bench/utils/__init__.py", line 155, in exec_cmd
        raise CommandFailedError
    bench.exceptions.CommandFailedError
    
    bug 
    opened by chechani 1
  • Image Not Attaching

    Image Not Attaching

    Okay so we installed the master branch and we can't get attach any document/ image to the upload button. The standard behavior is for the attached file to link to the upload button.

    bug 
    opened by woakes070048 1
Releases(v2.0.0-beta-4)
Owner
Ameen Ahmed
Ameen Ahmed
Its a Advanced Content Management System built on top of Frappe.

Go1 CMS Go1 CMS - Its a Advanced Content Management System built on top of Frappe with Advanced Page builder. Lead your business towards the future of

null 20 Dec 29, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Web based application that uses playerctl in it backend to control remotely your audio using the frontend as remote control.

Linux Remote This is a web based application that uses playerctl in it backend to control remotely your audio using the frontend as remote control. Do

Gabriel Guerra 4 Jul 6, 2022
A three.js and roslibjs powered web-control for zju fast-drone-250 for laptop-free flight control

Web Control for ZJU Fast-Drone-250 A three.js and roslibjs powered web-control for zju fast-drone-250 for laptop-free flight control (tested on Xiaomi

null 6 Nov 11, 2022
This is a Homebridge plugin that adds HomeKit support to Tidbyt devices.

Tidbyt Platform Plugin This is a Homebridge plugin that adds HomeKit support to Tidbyt devices. Built with node-tidbyt. This project is not endorsed o

Nicholas Penree 18 Nov 20, 2022
A mojo.js plugin that adds support for ejs templates.

A mojo.js plugin that adds support for ejs templates. The code of this plugin is a good example for learning to build new plugins, you're welcome to fork it.

Mojolicious 4 Jun 9, 2022
A jQuery plugin that adds cross-browser mouse wheel support.

jQuery Mouse Wheel Plugin A jQuery plugin that adds cross-browser mouse wheel support with delta normalization. In order to use the plugin, simply bin

jQuery 3.9k Dec 26, 2022
Query for CSS brower support data, combined from caniuse and MDN, including version support started and global support percentages.

css-browser-support Query for CSS browser support data, combined from caniuse and MDN, including version support started and global support percentage

Stephanie Eckles 65 Nov 2, 2022