-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: export import standard formats #193
feat: export import standard formats #193
Conversation
- Added Custom Field for Print Designer Template Location - Added Hook to define folder location for Print Designer Templates ( location fallbacks to default_templates if not defined in hooks for export ) - when print designer is installed, loop over all apps and import standard templates. - when any new app is installed, check if it has print designer templates and install them. - it also checks print_designer app for new templates and installs them. - Modified export functionality for print formats that are made using print_designer. - it will export print format in custom directory if defined in hooks else in default_templates folder. - user / developer can define app where print format should be exported in print_designer_template_app field.
3f8c019
to
02a4ef7
Compare
added new custom field "print_designer_preview_img" to store the format preview image. added html2canvas on save - make copy of main-container dom and convert to canvas using html2canvas. - create file instance and pass blob to it from canvas.toBlob() - send file to /api/method/upload_file , client side function is just modified version of FileUploader. - remove old format preview image after new one is uploaded successfully. This will be used to display the format preview in the format Grid View.
dynamic text value is fetched from db so there is no need to save it as part of format.
we have to consider and load metaFields from db so remove it from Print Format JSON.
f0b4644
to
b2ab4c7
Compare
- if standard is set to true, remove static file urls as it can't be used across site. - only try to load file if url value exists for the file. - This doesn't check if image file exists or not.
As standard field returns Yes or No, update the logic to compare string instead of boolean. update preview image url in print_designer_preview_img field
First check if table exists before trying to load childfield meta
Copy the image to the export directory so that it can be used for preview while installing the format.
when print_designer format is saved in developer mode and format is standard. preview images and " File " document is exported as per the location defined in the selected app's hook. after install once the formats are imported, copy the file to private/files folder and update the file path in the format.
db5899c
to
bdbbd2c
Compare
closing as merging in develop branch #208 |
Does this happen only during updates, when new versions of apps are installed? Or perhaps even during migration? |
@PhantomKunai only on install |
Hmm, I think adding a migrate hook would be worth it, wouldnt it? So that people can add formats to their current app and not worry about having to reinstall it. Edit : Performing a bench update where apps are re-installed has no effect. Print formats are not imported. |
Perhaps this is getting messed up because of install order? For me print_designer installs first. |
Added Custom Field for Print Designer Template Location
Added Hook to define folder location for Print Designer Templates ( location fallbacks to default_templates if not defined in hooks for export )
when print designer is installed, loop over all apps and import standard templates.
when any new app is installed, check if it has print designer templates and install them. - it also checks print_designer app for new templates and installs them.
Modified export functionality for print formats that are made using print_designer. - it will export print format in custom directory if defined in hooks else in default_templates folder.
user / developer can define app where print format should be exported in print_designer_template_app field.
depends on : frappe/frappe#25752