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
has_one_attached :attachment
###############
# Validations #
###############

View file

@ -10,7 +10,7 @@ class Staff::Person::PersonCommentPolicy < ApplicationPolicy
end
def permitted_attributes_for_create
%i[text]
%i[attachment text]
end
class Scope < Scope

View file

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

View file

@ -81,6 +81,7 @@ en:
place_of_birth: Place of birth
person_comment:
id: ID
attachment: Attachment
text: Text
person/sex:
male: Male

View file

@ -81,6 +81,7 @@ ru:
place_of_birth: Место рождения
person_comment:
id: ID
attachment: Приложение
text: Текст
person/sex:
male: Мужской