Skip to content

Commit

Permalink
[Feature] Title need on the map download - Fix comments from PR
Browse files Browse the repository at this point in the history
  • Loading branch information
makarkozlowski authored and milafrerichs committed Dec 2, 2020
1 parent c4853ea commit 3906236
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
8 changes: 2 additions & 6 deletions src/js/elements/mapchip.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const wrapperClsName = 'content__map_current-display';
const mapOptionsClass = '.map-options';
const lightStart = 3;

let title = '';
let subindicatorKey = '';

/**
Expand All @@ -17,6 +16,7 @@ export class MapChip extends Observable {
super();
this.legendColors = legendColors;
this.prepareDomElements();
this.title = '';
}

prepareDomElements() {
Expand Down Expand Up @@ -133,13 +133,9 @@ export class MapChip extends Observable {
label = args.indicatorTitle;
}

title = `${args.parents.category} by ${label}`;
this.title = `${args.category} by ${label}`;

this.updateMapChipText(label);
this.showMapChip(args);
}

get title() {
return title;
}
}
2 changes: 1 addition & 1 deletion src/js/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function configureApplication(profileId, config) {
const zoomToggle = new ZoomToggle();
const preferredChildToggle = new PreferredChildToggle();
const boundaryTypeBox = new BoundaryTypeBox(config.config.preferred_children);
const mapDownload = new MapDownload();
const mapDownload = new MapDownload(mapchip);

// TODO not certain if it is need to register both here and in the controller in loadedGeography
// controller.registerWebflowEvents();
Expand Down
5 changes: 2 additions & 3 deletions src/js/map/map_download.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import html2canvas from 'html2canvas';

import {Observable, saveAs} from "../utils";
import {MapChip} from "../elements/mapchip";

export class MapDownload extends Observable {
constructor() {
constructor(mapChip) {
super();
this.mapChip = new MapChip();
this.mapChip = mapChip;
this.prepareDomElements();
}

Expand Down
2 changes: 1 addition & 1 deletion src/js/setup/choropleth.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function configureChoroplethEvents(controller, objs = {mapcontrol: null,
indicators: pp.indicators,
subindicatorKey: pp.obj.keys,
indicatorTitle: pp.indicatorTitle,
parents: pp.parents
category: pp.parents.category
}

mapchip.onSubIndicatorChange(args);
Expand Down

0 comments on commit 3906236

Please sign in to comment.