Add empty pd declaration page

This commit is contained in:
Anton Khorev 2025-01-17 17:13:01 +03:00
parent 2074e9dce2
commit 62b70f45bc
6 changed files with 49 additions and 1 deletions

View file

@ -29,7 +29,7 @@ class Ability
if user&.active?
can :welcome, :site
can :read, [:deletion, :account_terms]
can :read, [:deletion, :account_terms, :account_pd_declaration]
if Settings.status != "database_offline"
can [:subscribe, :unsubscribe], Changeset

View file

@ -0,0 +1,12 @@
module Accounts
class PdDeclarationsController < ApplicationController
layout "site"
before_action :authorize_web
before_action :set_locale
authorize_resource :class => :account_pd_declaration
def show; end
end
end

View file

@ -0,0 +1,3 @@
<% content_for :heading do %>
<h1><%= t ".title" %></h1>
<% end %>

View file

@ -324,6 +324,9 @@ en:
terms_declined_html: We are sorry that you have decided to not accept the new Contributor Terms. For more information, please see %{terms_declined_link}.
terms_declined_link: this wiki page
terms_declined_url: https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined
pd_declarations:
show:
title: Consider my contributions to be in the Public Domain
browse:
deleted_ago_by_html: "Deleted %{time_ago} by %{user}"
edited_ago_by_html: "Edited %{time_ago} by %{user}"

View file

@ -279,6 +279,7 @@ OpenStreetMap::Application.routes.draw do
resource :account, :only => [:edit, :update, :destroy] do
scope :module => :accounts do
resource :terms, :only => [:show, :update]
resource :pd_declaration, :only => :show
resource :deletion, :only => :show
end
end

View file

@ -0,0 +1,29 @@
require "test_helper"
module Accounts
class PdDeclarationsControllerTest < ActionDispatch::IntegrationTest
##
# test all routes which lead to this controller
def test_routes
assert_routing(
{ :path => "/account/pd_declaration", :method => :get },
{ :controller => "accounts/pd_declarations", :action => "show" }
)
end
def test_show_not_logged_in
get account_pd_declaration_path
assert_redirected_to login_path(:referer => account_pd_declaration_path)
end
def test_show_agreed
user = create(:user)
session_for(user)
get account_pd_declaration_path
assert_response :success
end
end
end