Skip to content

Commit

Permalink
Merge pull request #1000 from UN-OCHA/berliner/HPC-9557
Browse files Browse the repository at this point in the history
HPC-9557: Fix issues with disaggregation modals
  • Loading branch information
berliner authored May 6, 2024
2 parents ef8f75b + 75209a7 commit d564525
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.
9 changes: 5 additions & 4 deletions html/modules/custom/ghi_blocks/js/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
// Attach behaviors.
Drupal.behaviors.hpc_ghi_modal = {
attach: function(context, settings) {
once('ghi-modal-title', 'body').forEach(() => {
document.addEventListener('dialog:aftercreate', e => {
$('.ui-dialog.ghi-modal-dialog .ui-dialog-title').html(settings.ghi_modal_title);
});
if (typeof settings.ghi_modal_title == 'undefined') {
return;
}
$(window).on('dialog:aftercreate', (e, dialog, $element) => {
$('.ui-dialog.ghi-modal-dialog .ui-dialog-title').html(settings.ghi_modal_title);
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function getType() {
/**
* Get the source entity.
*
* @return \Drupal\ghi_plans\ApiObjects\Entities\EntityObjectInterface|null
* @return \Drupal\ghi_plans\ApiObjects\PlanEntityInterface|null
* The entity object.
*/
public function getSourceEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private function modalTitle(DataAttachment $attachment, $metric, $reporting_peri
if ($icon && $icon_embed = $this->iconQuery->getIconEmbedCode($icon)) {
$title = $icon_embed;
}
$title .= $entity->getEntityName() . ' | ' . $metrics[$metric];
$title .= $entity->getName() . ' | ' . $metrics[$metric];

if ($attachment->isMeasurementField($metrics[$metric])) {
$title .= ThemeHelper::render([
Expand All @@ -59,7 +59,6 @@ private function modalTitle(DataAttachment $attachment, $metric, $reporting_peri
'#format_string' => '<span class="title-additional-info">Monitoring period @period_number: @date_range</span>',
], FALSE);
}

return Markup::create($title);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EntityQuery extends EndpointQueryBase implements ContainerFactoryPluginInt
* @param int $entity_id
* The entity id to query.
*
* @return \Drupal\ghi_base_objects\ApiObjects\BaseObjectInterface
* @return \Drupal\ghi_plans\ApiObjects\PlanEntityInterface
* The entity object.
*/
public function getEntity($entity_type, $entity_id) {
Expand Down
2 changes: 1 addition & 1 deletion html/themes/custom/common_design_subtheme/css/styles.css

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
}

.ui-dialog-title {
display: flex;
align-items: self-start;
color: var(--ghi-default-text-color) !important;

.cluster-icon {
Expand Down

0 comments on commit d564525

Please sign in to comment.