1
0
Fork 0

Add PersonComment#attachment

This commit is contained in:
Alex Kotov 2019-07-17 13:34:51 +05:00
parent 358f77b712
commit 17ce67db67
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
5 changed files with 17 additions and 1 deletions

View file

@ -11,6 +11,8 @@ class PersonComment < ApplicationRecord
belongs_to :account, optional: true belongs_to :account, optional: true
has_one_attached :attachment
############### ###############
# Validations # # Validations #
############### ###############

View file

@ -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

View file

@ -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">

View file

@ -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

View file

@ -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: Мужской