Skip to content

Commit

Permalink
Rename browse controller to features/queries controller
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Jul 26, 2024
1 parent 5285f69 commit b1ecf51
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/abilities/ability.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Ability
include CanCan::Ability

def initialize(user)
can :query, :browse
can :show, :feature_query
can :show, [Node, Way, Relation]
can [:index, :show], [OldNode, OldWay, OldRelation]
can [:show, :new], Note
Expand Down
13 changes: 0 additions & 13 deletions app/controllers/browse_controller.rb

This file was deleted.

15 changes: 15 additions & 0 deletions app/controllers/features/queries_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Features
class QueriesController < ApplicationController
layout :map_layout

before_action :authorize_web
before_action :set_locale
before_action -> { check_database_readable(:need_api => true) }
before_action :require_oauth
before_action :update_totp
around_action :web_timeout
authorize_resource :class => :feature_query

def show; end
end
end
File renamed without changes.
12 changes: 7 additions & 5 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -400,11 +400,13 @@ en:
telephone_link: "Call %{phone_number}"
colour_preview: "Colour %{colour_value} preview"
email_link: "Email %{email}"
query:
title: "Query Features"
introduction: "Click on the map to find nearby features."
nearby: "Nearby features"
enclosing: "Enclosing features"
features:
queries:
show:
title: "Query Features"
introduction: "Click on the map to find nearby features."
nearby: "Nearby features"
enclosing: "Enclosing features"
old_nodes:
not_found:
sorry: "Sorry, node #%{id} version %{version} could not be found."
Expand Down
4 changes: 3 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@
get "/offline" => "site#offline"
get "/key" => "site#key"
get "/id" => "site#id"
get "/query" => "browse#query"
namespace :features, :path => "" do
resource :query, :only => :show
end
get "/user/new" => "users#new"
post "/user/new" => "users#create"
get "/user/terms" => "users#terms"
Expand Down
18 changes: 0 additions & 18 deletions test/controllers/browse_controller_test.rb

This file was deleted.

20 changes: 20 additions & 0 deletions test/controllers/features/queries_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
require "test_helper"

module Features
class QueriesControllerTest < ActionDispatch::IntegrationTest
##
# test all routes which lead to this controller
def test_routes
assert_routing(
{ :path => "/query", :method => :get },
{ :controller => "features/queries", :action => "show" }
)
end

def test_show
get features_query_path
assert_response :success
assert_template "features/queries/show"
end
end
end

0 comments on commit b1ecf51

Please sign in to comment.