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

Commit

Permalink
Add colors from api
Browse files Browse the repository at this point in the history
  • Loading branch information
LePetitTim authored and numahell committed Apr 13, 2021
1 parent 7c07e04 commit 222b2a0
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/settings-custom-json-all-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ WARNING_SUBMIT_URL | "reports/report" | Warning submit URL
STYLES_CONFIG_FILE | "styles.json" | Custom styles variables
APPROVED_BIG | "images/approved-big.png" | Default big image for approved label (for detail page)
APPROVED_SMALL | "images/approved-small.png" | Default small image for approved label (for results page)
PARAMETERS_FILE | "parameters.json" | Parameters rando

## Filters

Expand Down
2 changes: 0 additions & 2 deletions src/app/categories/styles/_liste.scss
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@
line-height: 38px;
}
border-radius: 50%;
background-color: $default-category-color;
position: relative;

img, svg {
Expand Down Expand Up @@ -262,7 +261,6 @@
margin: 0;
padding: 0;
width: 40px;
background-color: $default-category-color;
@media (max-width: 540px) {
width: 30px;
}
Expand Down
5 changes: 3 additions & 2 deletions src/app/config/factories.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ function settingsFactory(globalSettings) {
infrastructuresUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.INFRASTRUCTURES_FILE,
signagesUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/' + globalSettings.SIGNAGES_FILE,
trekSensitiveUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/treks/',
diveSensitiveUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/dives/';

diveSensitiveUrl = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/$lang/dives/',
parametersURL = globalSettings.API_URL + '/' + globalSettings.API_DIR + '/' + 'parameters.json';

//PUBLIC METHODS
//
Expand Down Expand Up @@ -63,6 +63,7 @@ function settingsFactory(globalSettings) {
signagesUrl: signagesUrl,
trekSensitiveUrl: trekSensitiveUrl,
diveSensitiveUrl: diveSensitiveUrl,
parametersURL: parametersURL,

//METHODS
setLang: setLang,
Expand Down
9 changes: 4 additions & 5 deletions src/app/config/services.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use strict';

function stylesConfigService($http, $filter, settingsFactory, translationService) {
function stylesConfigService($http, $filter, settingsFactory, translationService, globalSettings) {

// Variable to test if Json file is available - for development
// Set to false if API dosn't send this file.
this.isConfigAvailable = false;

this.isConfigAvailable = globalSettings.USE_CATEGORIES_COLORS_API;
var defaultConfig = {
"colors": {
"main": "#f39400",
Expand All @@ -28,11 +27,11 @@ function stylesConfigService($http, $filter, settingsFactory, translationService

this.getCustomConfig = function getCustomConfig() {
var currentLang = translationService.getCurrentLang(),
url = settingsFactory.stylesConfigUrl.replace(/\$lang/, currentLang);
url = settingsFactory.parametersURL;

return $http({url: url})
.then(function (response) {
return response.data;
return angular.fromJson(response.data);
}, function() {
return defaultConfig;
});
Expand Down
3 changes: 2 additions & 1 deletion src/app/config/settings.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,6 @@
{ "id": 40, "label": "40m"},
{ "id": 999, "label": ">40m"}
],
"ASIDE_PANEL_FOLDED_BY_DEFAULT": false
"ASIDE_PANEL_FOLDED_BY_DEFAULT": false,
"USE_CATEGORIES_COLORS_API": false
}

0 comments on commit 222b2a0

Please sign in to comment.