Skip to content

Commit

Permalink
Refs #37465,Add wording behind progress bar.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chang Shu-Huai committed Aug 9, 2023
1 parent 653890b commit 2a3a159
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
7 changes: 7 additions & 0 deletions civicrm_backer_autoimport/civicrm_backer_autoimport.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.progress-extends-backer {
text-align: right;
padding-top: 3px;
}
.progress-extends-backer a {
font-weight: bold;
}
9 changes: 9 additions & 0 deletions civicrm_backer_autoimport/civicrm_backer_autoimport.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(function($){
$(function(){
if (Drupal.settings.backer) {
var url = Drupal.settings.backer.url;
var label = Drupal.settings.backer.label;
$('.progress-block .progress-wrapper').after("<div class='progress-extends-backer'>本專案與<a target='_blank' href='"+url+"'>"+label+"</a>共同募款</div>");
}
});
})(jQuery)
22 changes: 22 additions & 0 deletions civicrm_backer_autoimport/civicrm_backer_autoimport.module
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@ function civicrm_backer_autoimport_menu() {
return $items;
}

function civicrm_backer_autoimport_civicrm_buildForm($form_name, &$form) {
if ($form_name == 'CRM_Contribute_Form_Contribution_Main') {
$isTest = ($form->_mode == 'test') ? 1 : 0;
$params = array(
1 => array($isTest, 'String'),
2 => array($form->_id, 'String'),
);
$sql = "SELECT url_site, url_button FROM civicrm_payment_processor WHERE payment_processor_type = 'BACKER' AND is_active = 1 AND is_test = %1 AND user_name = %2 AND url_site IS NOT NULL AND url_api IS NOT NULL";
$dao = CRM_Core_DAO::executeQuery($sql, $params);
if ($dao->fetch()) {
$path = drupal_get_path('module', 'civicrm_backer_autoimport');
drupal_add_js($path . '/civicrm_backer_autoimport.js');
drupal_add_css($path . '/civicrm_backer_autoimport.css');
$settings = array(
'url' => $dao->url_site,
'label' => $dao->url_button,
);
drupal_add_js(array('backer' => $settings), 'setting');
}
}
}

function civicrm_backer_autoimport_civicrm_alterTemplateVars($resource, &$vars) {
if (preg_match('/^string:/', $resource)) {
if (strstr($resource, 'msg_tpl_workflow_contribution-contribution_online_receipt-html') ||
Expand Down

0 comments on commit 2a3a159

Please sign in to comment.