Skip to content

Commit

Permalink
TILES-4794 fixed copyright (#567)
Browse files Browse the repository at this point in the history
Co-authored-by: Vladimir-Ayrikh <[email protected]>
  • Loading branch information
Farfurix and Vladimir-Ayrikh authored Nov 28, 2022
1 parent 5bb4c3e commit 7f37021
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 48 deletions.
1 change: 0 additions & 1 deletion src/DGAttribution/lang/ar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
DG.Control.Attribution.Dictionary.ar = {
license_agreement: 'إتفاقية ترخيص',
work_on: 'يعمل بتطبيق 2GIS',
work_on_with_osm: 'API 2GIS',
open_on: 'Open in 2GIS',
route_on: 'Route on 2GIS'
};
3 changes: 1 addition & 2 deletions src/DGAttribution/lang/cs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
DG.Control.Attribution.Dictionary.cs = {
license_agreement: 'Licenční smlouva',
work_on: 'Pracuje na API 2GIS',
work_on_with_osm: 'API 2GIS'
work_on: 'Pracuje na API 2GIS'
};
3 changes: 1 addition & 2 deletions src/DGAttribution/lang/en.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
DG.Control.Attribution.Dictionary.en = {
license_agreement: 'License agreement',
work_on: 'Uses 2GIS API',
work_on_with_osm: '2GIS API'
work_on: 'Uses 2GIS API'
};
3 changes: 1 addition & 2 deletions src/DGAttribution/lang/es.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
DG.Control.Attribution.Dictionary.es = {
license_agreement : 'Acuerdo de licencia',
work_on: '2GIS API',
work_on_with_osm: '2GIS API'
work_on: '2GIS API'
};
3 changes: 1 addition & 2 deletions src/DGAttribution/lang/it.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
DG.Control.Attribution.Dictionary.it = {
license_agreement : 'Accordo di licenza',
work_on: '2GIS API',
work_on_with_osm: '2GIS API'
work_on: '2GIS API'
};
1 change: 0 additions & 1 deletion src/DGAttribution/lang/ru.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
DG.Control.Attribution.Dictionary.ru = {
license_agreement: 'Лицензионное соглашение',
work_on: 'Работает на API 2ГИС',
work_on_with_osm: 'API 2ГИС',
open_on: 'Открыть в 2ГИС',
route_on: 'Доехать с 2ГИС'
};
8 changes: 1 addition & 7 deletions src/DGAttribution/src/DGAttribution.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,9 @@ DG.Control.Attribution.include({
}
},

_update: function(lang, osm, countryCode) {
_update: function(lang, countryCode) {
if (!this._map) { return; }

if (typeof osm !== 'undefined') {
this._osm = osm;
}

if (typeof countryCode !== 'undefined') {
this._countryCode = countryCode;
}
Expand Down Expand Up @@ -194,10 +190,8 @@ DG.Control.Attribution.include({
var isHideButton = btn.label == 'open_on' || btn.label == 'route_on' || this._logotype;

return {
'osm': this._osm,
'logotype': isHideButton,
'work_on': this.t('work_on'),
'work_on_with_osm': this.t('work_on_with_osm'),
'lang': lang,
'copyright_apilink': this._getLink('copyright_apilink'),
'copyright_license': this._getLink('copyright_license'),
Expand Down
5 changes: 0 additions & 5 deletions src/DGAttribution/templates/copyright.dust
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
<div class="dg-attribution__copyright">
<ul class="dg-attribution__links">
<li class="dg-attribution__link-item">
{?osm}
© <a href="http://www.openstreetmap.org/copyright" target="_blank" class="dg-attribution__link">OpenStreetMap contributors</a>,{~s}
<a href="{copyright_apilink}" target="_blank" class="dg-attribution__link" dir="{dir}">{work_on_with_osm}</a>
{:else}
<a href="{copyright_apilink}" target="_blank" class="dg-attribution__link" dir="{dir}">{work_on}</a>
{/osm}
</li>
<li class="dg-attribution__link-item">
<a href="{copyright_license}" target="_blank" class="dg-attribution__link">{license_agreement}</a>
Expand Down
17 changes: 1 addition & 16 deletions src/DGAttribution/test/DGAttributionSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ describe('DG.Control.Attribution', function() {
es: 'licencia',
cs: 'smlouva'
},
osmCopyright = 'OpenStreetMap',

latLngWithoutProject = [54.83391822270635, 80.34439086914064],
latLngCenterNsk = [55.017493, 82.819576],
Expand All @@ -25,7 +24,7 @@ describe('DG.Control.Attribution', function() {
});

after(function() {
dictionaryLicense = osmCopyright = latLngWithoutProject = latLngCenterNsk = mapContainer = map = attribution = null;
dictionaryLicense = latLngWithoutProject = latLngCenterNsk = mapContainer = map = attribution = null;
});

describe('check init', function() {
Expand All @@ -48,18 +47,4 @@ describe('DG.Control.Attribution', function() {
});
});
});

describe('project leave', function() {
it('should add osm copyright', function() {
map.setView(latLngWithoutProject, 15, {animate: false});
expect(attribution.innerHTML).to.contain(osmCopyright);
});
});

describe('project enter', function() {
it('should remove osm copyright', function() {
map.setView(latLngCenterNsk, 19, {animate: false});
expect(attribution.innerHTML).not.contain(osmCopyright);
});
});
});
11 changes: 1 addition & 10 deletions src/DGProjectDetector/src/DGProjectDetector.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
DG.ProjectDetector = DG.Handler.extend({
initialize: function(map) { // (Object)
this._map = map;
this._osmViewport = false;
this._project = undefined;
this._loadProjectList();
},
Expand Down Expand Up @@ -52,22 +51,14 @@ DG.ProjectDetector = DG.Handler.extend({
return;
}

if (this._osmViewport === (this._project && this._centerInProject(this._project, 'contains'))) {
this._osmViewport = !this._osmViewport;
this._map.attributionControl._update(null, this._osmViewport);
}

if (this._project && this._zoomInProject(this._project) && this._centerInProject(this._project)) {
return;
}

this._searchProject();

if (this._project) {
if (this._osmViewport === (this._project && this._centerInProject(this._project, 'contains'))) {
this._osmViewport = !this._osmViewport;
}
this._map.attributionControl._update(null, this._osmViewport, this._project.country_code);
this._map.attributionControl._update(null, this._project.country_code);
}
},

Expand Down

0 comments on commit 7f37021

Please sign in to comment.