Skip to content

Commit

Permalink
Rename browse controller to queries controller
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Dec 23, 2024
1 parent 99af52b commit b2711a8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 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 :read, :query
can :read, [Node, Way, Relation, OldNode, OldWay, OldRelation]
can [:show, :create], Note
can :search, :direction
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
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]
before_action :update_totp
around_action :web_timeout
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 @@ -398,7 +398,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 @@ -181,7 +181,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

0 comments on commit b2711a8

Please sign in to comment.