Add PersonComment#attachment
This commit is contained in:
parent
358f77b712
commit
17ce67db67
5 changed files with 17 additions and 1 deletions
|
@ -11,6 +11,8 @@ class PersonComment < ApplicationRecord
|
||||||
|
|
||||||
belongs_to :account, optional: true
|
belongs_to :account, optional: true
|
||||||
|
|
||||||
|
has_one_attached :attachment
|
||||||
|
|
||||||
###############
|
###############
|
||||||
# Validations #
|
# Validations #
|
||||||
###############
|
###############
|
||||||
|
|
|
@ -10,7 +10,7 @@ class Staff::Person::PersonCommentPolicy < ApplicationPolicy
|
||||||
end
|
end
|
||||||
|
|
||||||
def permitted_attributes_for_create
|
def permitted_attributes_for_create
|
||||||
%i[text]
|
%i[attachment text]
|
||||||
end
|
end
|
||||||
|
|
||||||
class Scope < Scope
|
class Scope < Scope
|
||||||
|
|
|
@ -11,6 +11,17 @@
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
<%= person_comment.text %>
|
<%= person_comment.text %>
|
||||||
|
|
||||||
|
<% if person_comment.attachment.attached? %>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<small>
|
||||||
|
<i class="fas fa-paperclip"></i>
|
||||||
|
<%= link_to person_comment.attachment.blob.filename.to_s,
|
||||||
|
rails_blob_path(person_comment.attachment.blob,
|
||||||
|
disposition: 'download') %>
|
||||||
|
</small>
|
||||||
|
<% end %>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
|
@ -33,6 +44,7 @@
|
||||||
|
|
||||||
<div class="form-inputs">
|
<div class="form-inputs">
|
||||||
<%= f.input :text %>
|
<%= f.input :text %>
|
||||||
|
<%= f.input :attachment, direct_upload: true %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-actions">
|
<div class="form-actions">
|
||||||
|
|
|
@ -81,6 +81,7 @@ en:
|
||||||
place_of_birth: Place of birth
|
place_of_birth: Place of birth
|
||||||
person_comment:
|
person_comment:
|
||||||
id: ID
|
id: ID
|
||||||
|
attachment: Attachment
|
||||||
text: Text
|
text: Text
|
||||||
person/sex:
|
person/sex:
|
||||||
male: Male
|
male: Male
|
||||||
|
|
|
@ -81,6 +81,7 @@ ru:
|
||||||
place_of_birth: Место рождения
|
place_of_birth: Место рождения
|
||||||
person_comment:
|
person_comment:
|
||||||
id: ID
|
id: ID
|
||||||
|
attachment: Приложение
|
||||||
text: Текст
|
text: Текст
|
||||||
person/sex:
|
person/sex:
|
||||||
male: Мужской
|
male: Мужской
|
||||||
|
|
Reference in a new issue