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
|
||||
|
||||
has_one_attached :attachment
|
||||
|
||||
###############
|
||||
# Validations #
|
||||
###############
|
||||
|
|
|
@ -10,7 +10,7 @@ class Staff::Person::PersonCommentPolicy < ApplicationPolicy
|
|||
end
|
||||
|
||||
def permitted_attributes_for_create
|
||||
%i[text]
|
||||
%i[attachment text]
|
||||
end
|
||||
|
||||
class Scope < Scope
|
||||
|
|
|
@ -11,6 +11,17 @@
|
|||
<div class="card-body">
|
||||
<p class="card-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 class="card-text">
|
||||
|
@ -33,6 +44,7 @@
|
|||
|
||||
<div class="form-inputs">
|
||||
<%= f.input :text %>
|
||||
<%= f.input :attachment, direct_upload: true %>
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
|
|
|
@ -81,6 +81,7 @@ en:
|
|||
place_of_birth: Place of birth
|
||||
person_comment:
|
||||
id: ID
|
||||
attachment: Attachment
|
||||
text: Text
|
||||
person/sex:
|
||||
male: Male
|
||||
|
|
|
@ -81,6 +81,7 @@ ru:
|
|||
place_of_birth: Место рождения
|
||||
person_comment:
|
||||
id: ID
|
||||
attachment: Приложение
|
||||
text: Текст
|
||||
person/sex:
|
||||
male: Мужской
|
||||
|
|
Reference in a new issue