-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from FaxriddinMaxmadiyorov/issue#95
Issue#95
- Loading branch information
Showing
10 changed files
with
67 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class ResumePolicy < ApplicationPolicy | ||
def new? | ||
user.company? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
= form_with(model: resume, data: { turbo: false }, class: "form-width-avg") do |form| | ||
.form-group.row.mb-15 | ||
= form.label :name | ||
= form.text_field :name, class: "form-control" | ||
.form-group.row.mb-15 | ||
= form.label :description | ||
= form.rich_text_area :description, class: "form-control" | ||
= form.hidden_field :user_id, value: current_user.id | ||
.form-group.mt-10 | ||
= form.submit text, class: "btn btn-outline-success" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
- if @resume.errors.any? | ||
. | ||
h2 Errors | ||
ul | ||
- @resume.errors.each do |error| | ||
li = error.full_message | ||
|
||
= render partial: "form", locals: { resume: @resume, text: "New resume" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.container.d-flex.flex-column.align-items-center | ||
h1 = @resume.name | ||
p.text-break = @resume.description | ||
|
||
.container | ||
.row | ||
.col.text-center.d-flex.justify-content-center | ||
= button_to "Back", resumes_path, method: :get, class: "btn btn-success mx-2" | ||
- if current_user.id == @resume.user_id | ||
= button_to "Edit", edit_resume_path, method: :get, class: "btn btn-primary mx-2" | ||
= button_to "Delete", resume_path(@resume), method: :delete, data: { "turbo-confirm": "Are you sure you want to delete this resume?" }, class: "btn btn-danger mx-2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe ResumePolicy do | ||
let(:user) { build_stubbed(:user, :company) } | ||
let(:record) { build_stubbed(:resume, user:) } | ||
|
||
let(:context) { { user: } } | ||
|
||
describe_rule :new? do | ||
succeed "when user is company" | ||
|
||
failed "when user is admin" do | ||
let(:user) { build_stubbed(:user, :admin) } | ||
let(:record) { build_stubbed(:resume) } | ||
end | ||
end | ||
end |