Skip to content

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

License

Notifications You must be signed in to change notification settings

git-avc/frappe-better-attach-control

 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 83.5%
  • Python 16.5%