Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
Merge pull request #725 from GeotrekCE/add_pois_diving
Browse files Browse the repository at this point in the history
Add pois to dive detail page
  • Loading branch information
Gaël UTARD authored Sep 13, 2019
2 parents a426b18 + c603f41 commit 63cb5b6
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

**Bug fixes**

*
* Show POIs on dive detail page

2.21.1 / 2019-09-11
===================
Expand Down
2 changes: 2 additions & 0 deletions src/app/config/factories.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function settingsFactory(globalSettings) {
servicesUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.SERVICES_FILE,
eventsUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.TOURISTIC_EVENTS_FILE,
touristicUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.TOURISTIC_CONTENTS_FILE,
diveUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.DIVES_DIR + '/',
divesUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.DIVES_FILE,
flatUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.FLAT_FILE,
warningCategoriesUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.WARNING_CAT_DIR + '/' + globalSettings.WARNING_CAT_FILE,
Expand Down Expand Up @@ -48,6 +49,7 @@ function settingsFactory(globalSettings) {
servicesUrl: servicesUrl,
eventsUrl: eventsUrl,
touristicUrl: touristicUrl,
diveUrl: diveUrl,
divesUrl: divesUrl,
flatUrl: flatUrl,
warningCategoriesUrl: warningCategoriesUrl,
Expand Down
1 change: 1 addition & 0 deletions src/app/config/settings.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"DEPARTURE_ARRIVAL_ICON": "",
"API_DIR": "api",
"TREKS_DIR": "treks",
"DIVES_DIR": "dives",
"TREKS_FILE": "treks.geojson",
"POI_FILE": "pois.geojson",
"SERVICES_FILE": "services.geojson",
Expand Down
5 changes: 2 additions & 3 deletions src/app/detail/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ function DetailController($scope, $rootScope, $state, $q, $modal, $timeout, $sta
function getPoisOfResult(result, forceRefresh) {
var deferred = $q.defer();

poisService.getPoisFromElement(result.id, forceRefresh)
poisService.getPoisFromElement(result, forceRefresh)
.then(
function (elementPois) {
$scope.pois = elementPois.features;
Expand All @@ -248,8 +248,7 @@ function DetailController($scope, $rootScope, $state, $q, $modal, $timeout, $sta
function getInterests(result, forceRefresh) {
var promises = [],
activeDefaultType = null;

if (result.properties.contentType === 'trek') {
if (result.properties.contentType === 'trek' || result.properties.contentType === 'dive') {
promises.push(
getPoisOfResult(result, forceRefresh)
.then(
Expand Down
2 changes: 1 addition & 1 deletion src/app/detail/templates/detail-aside.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
</div>

</div>
<div class="detail-aside-group pois" ng-if="pois.length && result.properties.contentType === 'trek'" ng-class="{active: currentInterest === 'pois'}">
<div class="detail-aside-group pois" ng-if="pois.length && (result.properties.contentType === 'trek' || result.properties.contentType === 'dive')" ng-class="{active: currentInterest === 'pois'}">
<div class="detail-aside-group-title" ng-click="toggleInterest('pois')">
<span>{{ 'POI' | translate }}</span>
<span class="detail-aside-group-counter" ng-if="displayAsidesCounter" ng-bind="pois.length"></span>
Expand Down
2 changes: 1 addition & 1 deletion src/app/detail/templates/detail-content-elevation.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="detail-content-elevation" ng-if="result.properties.contentType === 'trek'" id="elevation">
<div class="detail-content-elevation" ng-if="result.properties.contentType === 'trek' || result.properties.contentType === 'dive'" id="elevation">
<h3>{{'PROFILE_ALTI' | translate}}</h3>

<div class="elevation-y elevation-legend">
Expand Down
2 changes: 1 addition & 1 deletion src/app/dives/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function divesService(globalSettings, settingsFactory, translationService, $q, $
/**
* Dives Type
*/
dive.properties.diveType = 'dive';
dive.properties.contentType = 'dive';

/**
* Dives IDs
Expand Down
4 changes: 2 additions & 2 deletions src/app/items-list/templates/items-list.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ <h1 class="result-title title">
<span class="depth" ng-if="::result.properties.depth">{{::'DEPTH_S' | translate}} {{result.properties.depth}}&nbsp;m</span>
<span class="difficulty" ng-if="::result.properties.difficulty">{{::result.properties.difficulty.label}}</span>
<span class="levels" ng-if="::result.properties.levels" ng-repeat="level in ::result.properties.levels">{{::level.label}}</span>
<span class="type1" ng-if="::result.properties.type1[0] && result.properties.contentType !== 'trek'">{{::result.properties.type1[0].name}}</span>
<span class="type2" ng-if="::result.properties.type2[0] && result.properties.contentType !== 'trek'">{{::result.properties.type2[0].name}}</span>
<span class="type1" ng-if="::result.properties.type1[0] && (result.properties.contentType !== 'trek' || result.properties.contentType !== 'dive')">{{::result.properties.type1[0].name}}</span>
<span class="type2" ng-if="::result.properties.type2[0] && (result.properties.contentType !== 'trek' || result.properties.contentType !== 'dive')">{{::result.properties.type2[0].name}}</span>
<span class="target" ng-if="::result.properties.target_audience">{{::result.properties.target_audience}}</span>
</div>

Expand Down
4 changes: 2 additions & 2 deletions src/app/map/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function mapService($rootScope, $q, $state, $resource, $translate, $filter, util
controlServices.addTo(this.map);
var classServices = controlServices.getContainer().classList;

if (element.properties.contentType === 'trek') {
if (element.properties.contentType === 'trek' || element.properties.contentType === 'dive') {
servicesService.getServicesFromElement(element.id)
.then(
function (services) {
Expand Down Expand Up @@ -162,7 +162,7 @@ function mapService($rootScope, $q, $state, $resource, $translate, $filter, util
}

promises.push(
poisService.getPoisFromElement(element.id, true)
poisService.getPoisFromElement(element, true)
.then(
function (pois) {
var counter = 0;
Expand Down
10 changes: 7 additions & 3 deletions src/app/pois/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ function poisService($resource, $q, globalSettings, settingsFactory, translation

};

this.getPoisFromElement = function getPoisFromElement (elementId) {

this.getPoisFromElement = function getPoisFromElement (element) {
var deferred = $q.defer();
var currentLang = translationService.getCurrentLang();
var url = settingsFactory.trekUrl.replace(/\$lang/, currentLang) + elementId + '/' + globalSettings.POI_FILE;
if (element.properties.contentType === 'trek') {
var url = settingsFactory.trekUrl.replace(/\$lang/, currentLang) + element.id + '/' + globalSettings.POI_FILE;
}
if (element.properties.contentType === 'dive') {
var url = settingsFactory.diveUrl.replace(/\$lang/, currentLang) + element.id + '/' + globalSettings.POI_FILE;
}

var requests = $resource(url, {}, {
query: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/warning/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ function WarningMapService(globalSettings, utilsFactory, iconsService, layersSer
type = 'geojson';
elementLocation = [];
} else {
currentLayer = (result.properties.contentType === 'trek' ? self._treksMarkersLayer : self._touristicsMarkersLayer);
currentLayer = (result.properties.contentType === 'trek' || result.properties.contentType === 'dive' ? self._treksMarkersLayer : self._touristicsMarkersLayer);
type = 'category';
elementLocation = utilsFactory.getStartPoint(result);
}
Expand Down

0 comments on commit 63cb5b6

Please sign in to comment.