8000 feat: enhance constructor configurability and fix UI issues (backport #27851) by mergify[bot] · Pull Request #32514 · frappe/frappe · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: enhance constructor configurability and fix UI issues (backport #27851) #32514

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

Merged
merged 4 commits into from
May 19, 2025

Conversation

mergify[bot]
Copy link
Contributor
@mergify mergify bot commented May 13, 2025
  • feat: add more config options
  • feat: add even more config options
  • fix: button alignment

Prior

  • Couldn't control web link / photo capture on the constructor
  • Couldn't control toggle private / toggle optimize on the constructor
  • Had primary button floating to the left in embedded more (and other UX quirks)

Scenario: Upload proof of payment after making a bank transaction via the payment checkout (no weblink, no photo capture, no toggle private, no toggle optimize)k

Now

Check this payment button js bundle:

frappe.ready(function() {
	frappe.require([
	    "libs.bundle.js", // SetVueGlobals
	    "dialog.bundle.js",
	    "assets/frappe/js/frappe/dom.js",
	    "file_uploader.bundle.js",
	    // wrapper - no dialogue
	    "assets/frappe/js/frappe/format.js",
	    // camera capture
	    "assets/frappe/js/frappe/ui/capture.js",
	    "assets/frappe/js/frappe/views/factory.js",
	    "controls.bundle.js",
	    "form.bundle.js",
	    "website-datetime.bundle.js",
	], () => {
		class BankTransferPaymentSettings {
			constructor(opts) {
				Object.assign(this, opts);
				this.init_file_uploader();
			}

			init_file_uploader() {
			  var wrapper = $('#upload-area');
				const file_uploader = new frappe.ui.FileUploader({
					doctype: 'Payment Session Log',
					docname: this.payment_session_name,
					folder: 'Home/Attachments',
					on_success: (file_doc) => {
						document.dispatchEvent(new CustomEvent("payment-submitted"));
						frappe.call({
							method: 'payments.payment_gateways.doctype.bank_transfer_payment_settings.bank_transfer_payment_settings.confirm_payment',
							args: {
								payment_session_name: this.payment_session_name,
								file: file_doc.name
							},
							callback: (r) => {
								document.dispatchEvent(new CustomEvent("payment-processed", {
									detail: r.message
								}));
							}
						});
					},
					restrictions: {
						allowed_file_types: ['image/*'],
						max_number_of_files: 1,
					},
					// upload_notes: __('Please upload a screenshot of your payment.'),
					allow_web_link: false,
					allow_multiple: false,
					allow_toggle_private: false,
					allow_toggle_optimize: false,
					as_dataurl: false,
					disable_file_browser: true,
					make_attachments_public: false,
					// dialog_title: __('Upload Payment Screenshot'),
					wrapper: wrapper,
				});
			}
		}

		new BankTransferPaymentSettings({
			payment_session_name: '{{ payload.psl }}'
		});
	});
});

This is an automatic backport of pull request #27851 done by [Mergify](https://mergify.com).

blaggacao added 2 commits May 13, 2025 21:57
(cherry picked from commit d6136b0)
(cherry picked from commit 06126d3)
@barredterra
Copy link
Collaborator

Tested, LGTM.

The failing cypress test is flaky and seems to be unrelated („folder navigation“).

@barredterra barredterra removed their assignment May 19, 2025
@barredterra barredterra merged commit da4e4bc into version-15-hotfix May 19, 2025
17 checks passed
@barredterra barredterra deleted the mergify/bp/version-15-hotfix/pr-27851 branch May 19, 2025 23:49
frappe-pr-bot pushed a commit that referenced this pull request May 20, 2025
# [15.69.0](v15.68.1...v15.69.0) (2025-05-20)

### Bug Fixes

* add support for uploading webp images ([58e9468](58e9468))
* avoid flushing to monitor logs concurrently ([#32552](#32552)) ([#32555](#32555)) ([191c23f](191c23f))
* Fix link in delete data confirmation email template ([#32544](#32544)) ([#32551](#32551)) ([140d5f8](140d5f8))
* link title not reliable in report view ([0a1671c](0a1671c))
* make max report rows configurable ([#32582](#32582)) ([cc41a4c](cc41a4c))
* make timespan filter values translatable ([#32463](#32463)) ([#32471](#32471)) ([50a2a75](50a2a75))
* query report read permission issue ([e2f0c86](e2f0c86))
* remove child tables from document dropdown ([37b68cf](37b68cf))
* remove child tables from Role Permission Manager dropdown ([9e7c443](9e7c443))
* remove conflicts ([f3a2483](f3a2483))
* remove debugging statements ([82ead5c](82ead5c))
* Serbian (Latin) translations ([#32575](#32575)) ([953c217](953c217))
* state_translatability ([#32533](#32533)) ([3c39d07](3c39d07))
* sync translations from crowdin ([#32352](#32352)) ([8e5437a](8e5437a))
* **TextEditor:** restore image alignment after save ([005e62d](005e62d))

### Features

* enhance constructor configurability and fix UI issues (backport [#27851](#27851)) ([#32514](#32514)) ([da4e4bc](da4e4bc))
@frappe-pr-bot
Copy link
Collaborator

🎉 This PR is included in version 15.69.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0