-
Notifications
You must be signed in to change notification settings - Fork 108
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
[TL-4694] add buttons for sending vacancy to moderation and to archive #753
base: main
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 |
---|---|---|
|
@@ -35,7 +35,6 @@ def update | |
authorize @vacancy | ||
vacancy = @vacancy.becomes(Web::Account::VacancyForm) | ||
if vacancy.update(params[:vacancy]) | ||
change_visibility(@vacancy) | ||
f(:success) | ||
redirect_to account_vacancies_path | ||
else | ||
|
@@ -45,11 +44,15 @@ def update | |
end | ||
end | ||
|
||
def destroy; end | ||
|
||
private | ||
def archive | ||
vacancy = current_user.vacancies.find params[:id] | ||
vacancy.archive! | ||
end | ||
|
||
def change_visibility(vacancy) | ||
vacancy.archive! if params[:archive] | ||
def send_to_moderate | ||
vacancy = current_user.vacancies.find params[:id] | ||
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. и было бы не плохо флешь сообщение пользователю об успешной архивации |
||
vacancy.send_to_moderate! | ||
end | ||
|
||
def destroy; end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.fs-5 = t('.additional_actions') | ||
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. Предлагаю если вакансию нельзя за архивировать или отправить на модерацию не показывать эти кнопки |
||
.row.mt-3 | ||
.col-auto.d-flex.mb-3 | ||
.me-3 = link_to t('.archive'), archive_account_vacancy_path(vacancy), method: :patch, class: class_names('btn btn-success', disabled: !vacancy.may_archive?), data: { confirm: 'Are you sure?' } | ||
.col-auto.mb-3 | ||
.me-3 = link_to t('.send_to_moderate'), send_to_moderate_account_vacancy_path(vacancy), method: :patch, class: class_names('btn btn-danger', disabled: !vacancy.may_send_to_moderate?), data: { confirm: 'Are you sure?' } |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ | |
.alert.alert-secondary | ||
= t('.vacancy_archived') | ||
|
||
= render 'form', vacancy: @vacancy, url: account_vacancy_path(@vacancy), show_archive_button: [email protected]? | ||
= render 'form', vacancy: @vacancy, url: account_vacancy_path(@vacancy) | ||
= render 'actions', vacancy: @vacancy, url: account_vacancy_path(@vacancy) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
- content_for :header do | ||
= t('.header') | ||
|
||
= render 'form', vacancy: @vacancy, url: account_vacancies_path, show_archive_button: false | ||
= render 'form', vacancy: @vacancy, url: account_vacancies_path |
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.
Нужен редирект так как сейчас когда отправляешь вакансию в архив страница не обновляется и кнопка архивации остается активна и при повторном нажатии страница падает