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 queries controller #4616

Open
wants to merge 2 commits 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.
Jump to
Jump to file
Failed to load files.
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, :query
can :show, [Node, Way, Relation]
can [:index, :show], [OldNode, OldWay, OldRelation]
can [:show, :new], Note
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
class BrowseController < ApplicationController
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, :only => [:query]
around_action :web_timeout
before_action :update_totp
authorize_resource :class => false

def query; end
def show; end
end
File renamed without changes.
3 changes: 2 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ en:
telephone_link: "Call %{phone_number}"
colour_preview: "Colour %{colour_value} preview"
email_link: "Email %{email}"
query:
queries:
show:
title: "Query Features"
introduction: "Click on the map to find nearby features."
nearby: "Nearby features"
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
get "/offline" => "site#offline"
get "/key" => "site#key"
get "/id" => "site#id"
get "/query" => "browse#query"
resource :query, :only => :show
get "/user/new" => "users#new"
post "/user/new" => "users#create"
get "/user/terms" => "users#terms"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
require "test_helper"

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

def test_query
def test_show
get query_path
assert_response :success
assert_template "browse/query"
assert_template "queries/show"
end
end