Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename browse controller to features/queries controller #5024

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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, :create], 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
12 changes: 7 additions & 5 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,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"
nodes:
timeout:
sorry: "Sorry, the data for the node with the id %{id} took too long to retrieve."
Expand Down
4 changes: 3 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,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