Skip to content

Commit

Permalink
Merge pull request #912 from devgateway/hotfix/v2.12.7.5
Browse files Browse the repository at this point in the history
AMP-25830 2.12.7.5 release
  • Loading branch information
jdeanquin-dg authored Apr 28, 2017
2 parents eeb1661 + ed5bfc8 commit c70c3c9
Show file tree
Hide file tree
Showing 162 changed files with 6,116 additions and 2,293 deletions.
24 changes: 12 additions & 12 deletions amp/TEMPLATE/ampTemplate/dashboard/build/compiled-js/app.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions amp/TEMPLATE/ampTemplate/dashboard/dev/app/compiled-js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3855,8 +3855,10 @@ module.exports = BackboneDash.View.extend({
this.app.translator.getTranslations()
.done(_(function() { // defer here to prevent a race with translations loading

/* TODO: Do we really want to localize this and slow things?*/
//this.app.translator.translateDOM(this.el);
if (this.model.get('chartType') === 'fragmentation') {
// We need this for AMP-25599.
this.app.translator.translateDOM(this.el);
}

this.model.fetch({
type: 'POST', // TODO: move fetch options to model?
Expand Down Expand Up @@ -30058,7 +30060,7 @@ jQuery(function($){
/* LOCAL AMP CODE -- THIS WILL DISAPPEAR */
jQuery(function($){
$.datepicker.regional['tm'] = {
closeText: 'Halo',
closeText: 'Halo ona',
prevText: 'Uluk',
nextText: 'Tuir mai',
currentText: 'Ohin loron',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,10 @@ module.exports = BackboneDash.View.extend({
this.app.translator.getTranslations()
.done(_(function() { // defer here to prevent a race with translations loading

/* TODO: Do we really want to localize this and slow things?*/
//this.app.translator.translateDOM(this.el);
if (this.model.get('chartType') === 'fragmentation') {
// We need this for AMP-25599.
this.app.translator.translateDOM(this.el);
}

this.model.fetch({
type: 'POST', // TODO: move fetch options to model?
Expand Down
2 changes: 1 addition & 1 deletion amp/TEMPLATE/ampTemplate/dashboard/dev/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"gulp-plumber": "^0.6.5",
"gulp-rimraf": "^0.1.0",
"gulp-serve": "^0.2.0",
"gulp-sourcemaps": "^1.2.2",
"gulp-sourcemaps": "1.5.2",
"gulp-streamify": "0.0.5",
"gulp-uglify": "^1.0.1",
"gulp-util": "^3.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,23 @@ module.exports = Backbone.Model.extend({
var matchesFilters = self.attributes.matchesFilters;
if (allFilters && allFilters.columnFilters && matchesFilters) {
_.each(matchesFilters, function(v, k) {
//make sure it's a valid filter
if (allFilters.columnFilters[k]) {
//iterate over ids.
_.each(matchesFilters[k], function(id, index) {
var matched = _(allFilters.columnFilters[k]).findWhere({id: id});
if (matched) {
matchesFilters[k][index] = matched;
}
});
}
if (k == 'Primary Sector') {
_.each(matchesFilters[k], function(sector, index) {
matchesFilters[k][index] = new Backbone.Model(sector);
});
} else {
//make sure it's a valid filter
if (allFilters.columnFilters[k]) {
//iterate over ids.
_.each(matchesFilters[k], function(id, index) {
var matched = _(allFilters.columnFilters[k]).findWhere({id: id});
if (matched) {
matchesFilters[k][index] = matched;
}
});
}
}

});
self.set('matchesFilters', matchesFilters);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ loadAll: function(options) {
value.geoId = value.geoId ? $.trim(value.geoId) : value.geoId;
return value;
});

var indexedValues = _.indexBy(values, 'geoId');
if(indexedValues["null"]) {
indexedValues[0] = indexedValues["null"]; //hack for some countries the geoId is null.
}

var admKey = this.get('adminLevel').replace('-', '').toUpperCase();

// copy boundary geoJSON, and inject data
Expand All @@ -224,21 +226,20 @@ loadAll: function(options) {
// replacing for now, to save weight
var admCode = feature.properties[admKey + '_CODE'];
feature.id = admCode ? $.trim(admCode) : admCode;
feature.properties.name = feature.properties[admKey + '_NAME'] || '';

if (!indexedValues[feature.id]) {
indexedValues[feature.id] = {value: 0};
self.palette.set({min: 0});
}

feature.properties.name = feature.properties[admKey + '_NAME'] || '';
var value = null;
if (!_.isUndefined(indexedValues[feature.id]) && !_.isNull(indexedValues[feature.id])) {
value = indexedValues[feature.id].value;
}
return _.extend(feature, {
properties: _.extend(feature.properties, {
value: indexedValues[feature.id].value
value: value
})
});
})
});

this.set('geoJSON', geoJSON);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ module.exports = Backbone.Model
1: 'None.svg',
100: 'Social.svg',
110: 'Education.svg',
113: 'Education.svg',
120: 'Health.svg',
130: 'Population.svg',
140: 'Water.svg',
Expand All @@ -114,7 +115,8 @@ module.exports = Backbone.Model
910: 'CostDonor.svg',
920: 'NGO_Support.svg',
930: 'Refugees.svg',
998: 'Unspecified.svg'
}

998: 'Unspecified.svg'
},

DEFAULT_ICON_CODE: '998' //if no icon can be found using the sector code in the activity, default to unspecified
});
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
var fs = require('fs');
var $ = require('jquery');
var Backbone = require('backbone');
var boilerplate = require('amp-boilerplate');
var MapView = require('../../map/views/main-view');
//var DataQualityView = require('../../dataquality/views/dataquality-view');
var SidebarView = require('../../sidebar/sidebar-view');
var ModuleTemplate = fs.readFileSync(__dirname + '/../templates/module-template.html', 'utf8');
var boilerplate = require('amp-boilerplate');

module.exports = Backbone.View.extend({

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ <h3><span data-i18n="amp.gis:legend-item-structures"><%= title %></span>

<% } else if (obj.imageBuckets) {
_.each(palletteElements ,function(element) {
var icon = obj.imageBuckets[element.code] || obj.imageBuckets[obj.DEFAULT_ICON_CODE];
if(element.code && element.name){ %>
<div><img src="img/map-icons/<%= obj.imageBuckets[element.code] %>" width="19px"> <%= element.name %></div>
<div><img src="img/map-icons/<%= icon %>" width="19px"> <%= element.name %></div>
<% }
}); %>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var fs = require('fs');
var _ = require('underscore');
var Backbone = require('backbone');
var Template = fs.readFileSync(__dirname + '/legend-item-structures.html', 'utf8');

var SettingsUtils = require('../../../libs/local/settings-utils.js');

module.exports = Backbone.View.extend({

Expand All @@ -24,34 +24,13 @@ module.exports = Backbone.View.extend({
colourBuckets: self.model.structuresCollection.palette.colours,
selectedVertical: self.model.get('filterVertical')
};

//TODO: Move this code to a config class.
//IT IS REPEATED IN map/views/structures-view.js
var MAX_NUM_FOR_ICONS = 0;
var useIconsForSectors = _.find(app.data.settings.models, function(item) {
return (item.id === 'use-icons-for-sectors-in-project-list');
});
var maxLocationIcons = _.find(app.data.settings.models, function(item) {
return (item.id === 'max-locations-icons');
});
if (useIconsForSectors !== undefined && useIconsForSectors.get('name') === 'true') {
if (maxLocationIcons !== undefined && maxLocationIcons.get('name') !== '') {
if (maxLocationIcons.get('name') === '0') {
MAX_NUM_FOR_ICONS = 99999; //always show
} else {
MAX_NUM_FOR_ICONS = parseInt(maxLocationIcons.get('name'), 10);
}
} else {
MAX_NUM_FOR_ICONS = 0;
}
} else {
MAX_NUM_FOR_ICONS = 0;
}


var maxNumberOfIcons = SettingsUtils.getMaxNumberOfIcons(app.data.settings);
// render icons if available
if (self.model.structuresCollection.length < MAX_NUM_FOR_ICONS &&
if (self.model.structuresCollection.length < maxNumberOfIcons &&
self.model.get('filterVertical') === 'Primary Sector') {
renderObject.imageBuckets = self.model.iconMappings;
renderObject.DEFAULT_ICON_CODE = self.model.DEFAULT_ICON_CODE;
renderObject.palletteElements = self.model.structuresCollection.palette.get('elements');
}

Expand All @@ -70,7 +49,7 @@ module.exports = Backbone.View.extend({
}).then(function(legendPopoverList) {
var legendPopover = [legendPopoverList['amp.gis:legend-popover'],
' ',
MAX_NUM_FOR_ICONS,
maxNumberOfIcons,
' ',
legendPopoverList['amp.gis:legend-popover-2']
].join('');
Expand Down
Loading

0 comments on commit c70c3c9

Please sign in to comment.