-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Allow external javascript in the detailed view #8430
base: hotfix-7.10.x
Are you sure you want to change the base?
Allow external javascript in the detailed view #8430
Conversation
…0.x-allow-external-js-in-detailed-view
Codecov Report
@@ Coverage Diff @@
## hotfix-7.10.x #8430 +/- ##
==============================================
Coverage 10.69% 10.69%
==============================================
Files 3230 3230
Lines 241063 241063
==============================================
Hits 25792 25792
Misses 215271 215271 |
Doesn't it work to add an Even so, it might be better to emulate that same mechanism, instead of creating a new one... Example: custom/modules/Accounts/metadata/listviewdefs.php <?php
// include all the $listViewDefs[$module] field and search definitions from parent:
require_once 'modules/Accounts/metadata/listviewdefs.php';
$viewdefs[$module]['ListView'] = [
'templateMeta' => [
'form' => [
'actions' => [
[
'customCode' => '<a onclick="bulkActionRunWorkflows()" title="Do it!">Do it!</a>'
],
],
],
'includes' => [
[
'file' => 'custom/pgr/js/DoThingsFromViews.js',
],
],
]
]; See https://github.com/salesagility/SuiteCRM/blob/master/include/ListView/ListViewSmarty.php#L167 |
Hi @pgorod, this change applies to all DetailView. It is in consistent with how EditView allow external JS file See https://github.com/salesagility/SuiteCRM/blob/master/include/EditView/footer.tpl#L88 |
Dominic Chin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
3149dea
to
ab954a4
Compare
1609e8b
to
b06335d
Compare
Allow external javascript in the detailed view
Description
Allow including external javascript in the detailed view by adding viewdefs[]['DetailView']['templateMeta']['javascript'] configuration, such as
"""
'javascript' => '{sugar_getscript file="custom/modules/Opportunities/views/test.js"}',
"""
Motivation and Context
This allows customizing the detailed view using a javascript. This is consistent with how we currently customizing the edit view with a javascript.
How To Test This
Add a configuration as described in the Description session. Add a javascript such as
"""
$( document ).ready(function() {
console.log("Hello Dominic!");
});
"""
as custom/modules/Opportunities/views/test.js. Go to Opportunities detailed view
Types of changes
Final checklist