Displat membership application status page
This commit is contained in:
parent
00b2577c72
commit
e5641de456
9 changed files with 36 additions and 5 deletions
|
@ -1,6 +1,13 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MembershipApplicationsController < ApplicationController
|
||||
before_action :set_membership_application, only: :show
|
||||
|
||||
# GET /membership_applications/:id
|
||||
def show
|
||||
authorize @membership_application
|
||||
end
|
||||
|
||||
# GET /membership_applications/new
|
||||
def new
|
||||
@membership_application = MembershipApplication.new
|
||||
|
@ -21,6 +28,12 @@ class MembershipApplicationsController < ApplicationController
|
|||
|
||||
remember_if_guest_account @membership_application.account
|
||||
|
||||
redirect_to root_url
|
||||
redirect_to @membership_application
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_membership_application
|
||||
@membership_application = MembershipApplication.find params[:id]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class MembershipApplicationPolicy < ApplicationPolicy
|
||||
def show?
|
||||
record.account == context.account
|
||||
end
|
||||
|
||||
def create?
|
||||
true
|
||||
end
|
||||
|
|
3
app/views/membership_applications/show.html.erb
Normal file
3
app/views/membership_applications/show.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
|||
<div class="container">
|
||||
<h2><%= translate '.processing' %></h2>
|
||||
</div>
|
|
@ -1,4 +1,7 @@
|
|||
en:
|
||||
membership_applications:
|
||||
show:
|
||||
processing: Your application is being processed
|
||||
passports:
|
||||
show:
|
||||
confirm: Confirm
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
ru:
|
||||
membership_applications:
|
||||
show:
|
||||
processing: Ваша заявка в обработке
|
||||
passports:
|
||||
show:
|
||||
confirm: Подтвердить
|
||||
|
|
|
@ -30,7 +30,7 @@ Rails.application.routes.draw do
|
|||
omniauth_callbacks: 'users/omniauth_callbacks',
|
||||
}
|
||||
|
||||
resources :membership_applications, only: %i[new create]
|
||||
resources :membership_applications, only: %i[show new create]
|
||||
|
||||
resources :passports, only: %i[index show new create] do
|
||||
resources :passport_confirmations,
|
||||
|
|
|
@ -16,4 +16,5 @@ Feature: Membership application
|
|||
| Членство в других общественных организациях | Не скажу |
|
||||
| Комментарий | Примите, плиз |
|
||||
And I click the form button "Отправить заявление"
|
||||
Then I see main page
|
||||
Then I am at "/membership_applications/\d+"
|
||||
And I see text "Ваша заявка в обработке"
|
||||
|
|
|
@ -36,6 +36,10 @@ Then 'I am logged in as {string}' do |string|
|
|||
expect(page).to have_css 'span.navbar-text', text: string
|
||||
end
|
||||
|
||||
Then 'I see text {string}' do |text|
|
||||
expect(page).to have_content text
|
||||
end
|
||||
|
||||
Then 'I see main page' do
|
||||
expect(page).to have_css(
|
||||
'h1',
|
||||
|
|
|
@ -35,7 +35,7 @@ RSpec.describe 'POST /membership_applications' do
|
|||
before { make_request }
|
||||
|
||||
specify do
|
||||
expect(response).to redirect_to root_url
|
||||
expect(response).to redirect_to MembershipApplication.last
|
||||
end
|
||||
|
||||
specify do
|
||||
|
@ -67,7 +67,7 @@ RSpec.describe 'POST /membership_applications' do
|
|||
before { make_request }
|
||||
|
||||
specify do
|
||||
expect(response).to redirect_to root_url
|
||||
expect(response).to redirect_to MembershipApplication.last
|
||||
end
|
||||
|
||||
specify do
|
||||
|
|
Reference in a new issue