mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Simplify maps loading
This commit is contained in:
parent
62f4ec4910
commit
fb5086e97e
3 changed files with 5 additions and 13 deletions
|
|
@ -20,7 +20,7 @@ import "leaflet-draw";
|
|||
import { initializeFogCanvas, drawFogCanvas, createFogOverlay } from "../maps/fog_of_war";
|
||||
import { TileMonitor } from "../maps/tile_monitor";
|
||||
import BaseController from "./base_controller";
|
||||
import { createMapLayer, createAllMapLayers } from "../maps/layers";
|
||||
import { createAllMapLayers } from "../maps/layers";
|
||||
|
||||
export default class extends BaseController {
|
||||
static targets = ["container"];
|
||||
|
|
@ -393,15 +393,7 @@ export default class extends BaseController {
|
|||
|
||||
baseMaps() {
|
||||
let selectedLayerName = this.userSettings.preferred_map_layer || "OpenStreetMap";
|
||||
let maps; // Declare the variable first
|
||||
|
||||
if (this.selfHostedValue) {
|
||||
maps = createAllMapLayers(this.map, selectedLayerName);
|
||||
} else {
|
||||
maps = {
|
||||
OpenStreetMap: createMapLayer(this.map, selectedLayerName, "OpenStreetMap")
|
||||
};
|
||||
}
|
||||
let maps; createAllMapLayers(this.map, selectedLayerName);
|
||||
|
||||
// Add custom map if it exists in settings
|
||||
if (this.userSettings.maps && this.userSettings.maps.url) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// Yeah I know it should be DRY but this is me doing a KISS at 21:00 on a Sunday night
|
||||
|
||||
// Import the maps configuration
|
||||
// In non-self-hosted mode, we need to mount external maps_config.js to the container
|
||||
import { mapsConfig } from './maps_config';
|
||||
|
||||
export function createMapLayer(map, selectedLayerName, layerKey) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ RSpec.describe '/settings/background_jobs', type: :request do
|
|||
it 'redirects to sign in page' do
|
||||
get settings_background_jobs_url
|
||||
|
||||
expect(response).to redirect_to(new_user_session_url)
|
||||
expect(response).to redirect_to(root_url)
|
||||
expect(flash[:notice]).to eq('You are not authorized to perform this action.')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue