1
0
Fork 0

Displat membership application status page

This commit is contained in:
Alex Kotov 2018-12-05 07:12:23 +05:00
parent 00b2577c72
commit e5641de456
No known key found for this signature in database
GPG Key ID: 4E831250F47DE154
9 changed files with 36 additions and 5 deletions

View File

@ -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

View File

@ -1,6 +1,10 @@
# frozen_string_literal: true
class MembershipApplicationPolicy < ApplicationPolicy
def show?
record.account == context.account
end
def create?
true
end

View File

@ -0,0 +1,3 @@
<div class="container">
<h2><%= translate '.processing' %></h2>
</div>

View File

@ -1,4 +1,7 @@
en:
membership_applications:
show:
processing: Your application is being processed
passports:
show:
confirm: Confirm

View File

@ -1,4 +1,7 @@
ru:
membership_applications:
show:
processing: Ваша заявка в обработке
passports:
show:
confirm: Подтвердить

View File

@ -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,

View File

@ -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 "Ваша заявка в обработке"

View File

@ -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',

View File

@ -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