Remove resident registration feature
This commit is contained in:
parent
6f58f71ab2
commit
a1846ca2ed
16 changed files with 0 additions and 145 deletions
|
@ -1,20 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Staffs::People::ResidentRegistrationsController < ApplicationController
|
|
||||||
before_action :set_person
|
|
||||||
|
|
||||||
# GET /staff/people/:person_id/resident_registrations
|
|
||||||
def index
|
|
||||||
authorize [:staff, @person, :resident_registration]
|
|
||||||
@resident_registrations = policy_scope(
|
|
||||||
@person.resident_registrations,
|
|
||||||
policy_scope_class: Staff::Person::ResidentRegistrationPolicy::Scope,
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def set_person
|
|
||||||
@person = Person.find params[:person_id]
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -27,8 +27,6 @@ class Person < ApplicationRecord
|
||||||
|
|
||||||
has_many :passports, dependent: :restrict_with_exception
|
has_many :passports, dependent: :restrict_with_exception
|
||||||
|
|
||||||
has_many :resident_registrations, dependent: :restrict_with_exception
|
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# Validations #
|
# Validations #
|
||||||
###############
|
###############
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class ResidentRegistration < ApplicationRecord
|
|
||||||
################
|
|
||||||
# Associations #
|
|
||||||
################
|
|
||||||
|
|
||||||
belongs_to :person, optional: true
|
|
||||||
end
|
|
|
@ -1,15 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
class Staff::Person::ResidentRegistrationPolicy < ApplicationPolicy
|
|
||||||
def index?
|
|
||||||
account&.is_superuser?
|
|
||||||
end
|
|
||||||
|
|
||||||
class Scope < Scope
|
|
||||||
def resolve
|
|
||||||
return scope.all if account&.is_superuser?
|
|
||||||
|
|
||||||
scope.none
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -5,6 +5,5 @@
|
||||||
overview: [:staff, person],
|
overview: [:staff, person],
|
||||||
person_comments: staff_person_person_comments_path(person),
|
person_comments: staff_person_person_comments_path(person),
|
||||||
passports: staff_person_passports_path(person),
|
passports: staff_person_passports_path(person),
|
||||||
resident_registrations: staff_person_resident_registrations_path(person),
|
|
||||||
) %>
|
) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<div class="container">
|
|
||||||
<%= render partial: 'staffs/people/nav_tabs',
|
|
||||||
locals: { person: @person, tab: :resident_registrations } %>
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th scope="col">
|
|
||||||
<%= ResidentRegistration.human_attribute_name :id %>
|
|
||||||
</th>
|
|
||||||
<th scope="col"></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @resident_registrations.each do |resident_registration| %>
|
|
||||||
<tr>
|
|
||||||
<td scope="row"><%= resident_registration.id %></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
|
@ -16,9 +16,6 @@ en:
|
||||||
person_comment:
|
person_comment:
|
||||||
one: Comment
|
one: Comment
|
||||||
many: Comments
|
many: Comments
|
||||||
resident_registration:
|
|
||||||
one: Resident registration
|
|
||||||
many: Resident registrations
|
|
||||||
roles:
|
roles:
|
||||||
one: Role
|
one: Role
|
||||||
many: Roles
|
many: Roles
|
||||||
|
@ -69,8 +66,6 @@ en:
|
||||||
person/sex:
|
person/sex:
|
||||||
male: Male
|
male: Male
|
||||||
female: Female
|
female: Female
|
||||||
resident_registration:
|
|
||||||
id: ID
|
|
||||||
role:
|
role:
|
||||||
id: ID
|
id: ID
|
||||||
name: Name
|
name: Name
|
||||||
|
|
|
@ -16,9 +16,6 @@ ru:
|
||||||
person_comment:
|
person_comment:
|
||||||
one: Комментарий
|
one: Комментарий
|
||||||
many: Комментарии
|
many: Комментарии
|
||||||
resident_registration:
|
|
||||||
one: Прописка
|
|
||||||
many: Прописки
|
|
||||||
roles:
|
roles:
|
||||||
one: Роль
|
one: Роль
|
||||||
many: Роли
|
many: Роли
|
||||||
|
@ -69,8 +66,6 @@ ru:
|
||||||
person/sex:
|
person/sex:
|
||||||
male: Мужской
|
male: Мужской
|
||||||
female: Женский
|
female: Женский
|
||||||
resident_registration:
|
|
||||||
id: ID
|
|
||||||
role:
|
role:
|
||||||
id: ID
|
id: ID
|
||||||
name: Название
|
name: Название
|
||||||
|
|
|
@ -4,7 +4,6 @@ en:
|
||||||
overview: Overview
|
overview: Overview
|
||||||
person_comments: Comments
|
person_comments: Comments
|
||||||
passports: Passports
|
passports: Passports
|
||||||
resident_registrations: Resident registrations
|
|
||||||
settings:
|
settings:
|
||||||
credentials: Credentials
|
credentials: Credentials
|
||||||
profile: Public profile
|
profile: Public profile
|
||||||
|
|
|
@ -4,7 +4,6 @@ ru:
|
||||||
overview: Обзор
|
overview: Обзор
|
||||||
person_comments: Комментарии
|
person_comments: Комментарии
|
||||||
passports: Паспорта
|
passports: Паспорта
|
||||||
resident_registrations: Прописки
|
|
||||||
settings:
|
settings:
|
||||||
credentials: Данные для входа
|
credentials: Данные для входа
|
||||||
profile: Публичный профиль
|
profile: Публичный профиль
|
||||||
|
|
|
@ -58,10 +58,6 @@ Rails.application.routes.draw do
|
||||||
resources :passports,
|
resources :passports,
|
||||||
controller: 'people/passports',
|
controller: 'people/passports',
|
||||||
only: :index
|
only: :index
|
||||||
|
|
||||||
resources :resident_registrations,
|
|
||||||
controller: 'people/resident_registrations',
|
|
||||||
only: :index
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
FactoryBot.define do
|
|
||||||
factory :empty_resident_registration, class: ResidentRegistration do
|
|
||||||
association :person, factory: :initial_person
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -41,12 +41,6 @@ RSpec.describe Person do
|
||||||
.dependent(:restrict_with_exception)
|
.dependent(:restrict_with_exception)
|
||||||
end
|
end
|
||||||
|
|
||||||
it do
|
|
||||||
is_expected.to \
|
|
||||||
have_many(:resident_registrations)
|
|
||||||
.dependent(:restrict_with_exception)
|
|
||||||
end
|
|
||||||
|
|
||||||
it { is_expected.not_to validate_presence_of :regional_office }
|
it { is_expected.not_to validate_presence_of :regional_office }
|
||||||
|
|
||||||
describe '#relationships' do
|
describe '#relationships' do
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe ResidentRegistration do
|
|
||||||
subject { create :empty_resident_registration }
|
|
||||||
|
|
||||||
it { is_expected.to belong_to(:person).optional }
|
|
||||||
end
|
|
|
@ -1,7 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Staff::Person::ResidentRegistrationPolicy do
|
|
||||||
pending "add some examples to (or delete) #{__FILE__}"
|
|
||||||
end
|
|
|
@ -1,29 +0,0 @@
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe 'GET /staff/people/:person_id/resident_registrations' do
|
|
||||||
let(:person) { create :initial_person }
|
|
||||||
|
|
||||||
before do
|
|
||||||
sign_in current_account.user if current_account&.user
|
|
||||||
|
|
||||||
create :empty_resident_registration, person: person
|
|
||||||
create :empty_resident_registration, person: person
|
|
||||||
create :empty_resident_registration, person: person
|
|
||||||
|
|
||||||
get "/staff/people/#{person.to_param}/resident_registrations"
|
|
||||||
end
|
|
||||||
|
|
||||||
for_account_types nil, :guest, :usual do
|
|
||||||
specify do
|
|
||||||
expect(response).to have_http_status :forbidden
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for_account_types :superuser do
|
|
||||||
specify do
|
|
||||||
expect(response).to have_http_status :ok
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Reference in a new issue