-
Notifications
You must be signed in to change notification settings - Fork 15
RW-105: Added redirect for different roles #128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,3 +39,4 @@ | |
|
|
||
| # Ignore the environment variables | ||
| .env | ||
| .idea | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,13 @@ | ||
| class PagesController < ApplicationController | ||
| def welcome; end | ||
| def welcome | ||
| return unless user_signed_in? | ||
|
|
||
| redirect_to page_for_signed_in(current_user) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def page_for_signed_in(user) | ||
| {user.applicant? => vacancies_path, user.company? => resumes_path}[true] | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. нарушены стили robocop |
||
| end | ||
| end | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,10 @@ def title(page_title) | |
| end | ||
| end | ||
|
|
||
| def home_link | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. нужен будет тест на метод |
||
| root_path unless user_signed_in? | ||
| end | ||
|
|
||
| def flash_message_css_class(flash_type) | ||
| { notice: "alert alert-info", | ||
| success: "alert alert-success", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ nav.navbar.navbar-expand-lg.bg-body-tertiary | |
| #navbarSupportedContent.collapse.navbar-collapse | ||
| ul.navbar-nav.me-auto.mb-2.mb-lg-0 | ||
| li.nav-item | ||
| = link_to "Home", root_path, class: "nav-link fs-4 text-black" | ||
| = link_to "Home", home_link, class: "nav-link fs-4 text-black" | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ты проверил локально, что будет если user не зашел в аккаунт и нажал на кнопку ? |
||
| li.nav-item | ||
| = link_to "Vacancies", vacancies_path, class: "nav-link fs-4 text-black" | ||
| - if user_signed_in? | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Теперь нужно будет написать тест на этот метод