• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

digitaltom / mapforge / 12640680546

06 Jan 2025 09:30PM UTC coverage: 99.495% (-0.3%) from 99.753%
12640680546

push

github

digitaltom
test coverage

394 of 396 relevant lines covered (99.49%)

95.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

94.29
/app/controllers/maps_controller.rb
1
class MapsController < ApplicationController
4✔
2
  before_action :set_map, only: %i[show properties]
4✔
3

4
  layout "map", only: [ :show ]
4✔
5

6
  def index
4✔
7
    @maps = Map.where.not(private: true).includes(:layers).order(updated_at: :desc)
3✔
8
  end
9

10
  def show
4✔
11
    @map_properties = @map.properties
104✔
12
    gon.map_id = params[:id]
104✔
13
    gon.map_mode = (params[:id] == @map.id.to_s) ? "rw" : "ro"
104✔
14
    gon.map_mode = "static" if params["static"]
104✔
15
    @map_mode = gon.map_mode
104✔
16
    gon.csrf_token = form_authenticity_token
104✔
17
    gon.map_properties = @map_properties
104✔
18

19
    respond_to do |format|
104✔
20
      format.html do
104✔
21
        case params["engine"]
51✔
22
        when "deck"
23
          render "deck"
1✔
24
        else
25
          render "maplibre"
50✔
26
        end
27
      end
28
      format.json { render json: @map.to_json }
105✔
29
      format.geojson { render json: @map.to_geojson }
155✔
30
      format.gpx { send_data @map.to_gpx, filename: @map.public_id + ".gpx" }
105✔
31
    end
32
  end
33

34
  def create
4✔
35
    @map = Map.create!(map_params)
1✔
36
    @map.update(user: @user)
1✔
37

38
    redirect_to map_url(@map), notice: "Map was successfully created."
1✔
39
  end
40

41
  # :nocov:
42
  def properties
✔
43
    render json: @map.properties.as_json
×
44
  end
45
  # :nocov:
46

47
  # some maplibre style tries to load eg. /atm_11; catching those calls here
48
  # :nocov:
49
  def catchall
✔
50
    head :ok
×
51
  end
52
  # :nocov:
53

54
  private
4✔
55

56
  # Use callbacks to share common setup or constraints between actions.
57
  def set_map
4✔
58
    @map = Map.find_by(public_id: params[:id]) || Map.find_by(id: params[:id])
104✔
59
    head :not_found unless @map
104✔
60
  end
61

62
  # Only allow a list of trusted parameters through.
63
  def map_params
4✔
64
    params.fetch(:map, {})
1✔
65
  end
66
end
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc