TMP commit

This commit is contained in:
Bilal
2020-07-09 20:34:37 +02:00
parent bb8e5c9b73
commit 2020761649
5 changed files with 29 additions and 5 deletions

View File

@@ -15,16 +15,26 @@ module CsvExportable
LOCATION_HEADERS = %i[name address].freeze + COMMON_HEADERS LOCATION_HEADERS = %i[name address].freeze + COMMON_HEADERS
LOCATION_VALUES = %w[name address].freeze + COMMON_VALUES LOCATION_VALUES = %w[name address].freeze + COMMON_VALUES
MATERIAL_HEADERS = %i[name].freeze + COMMON_HEADERS
MATERIAL_VALUES = %w[name].freeze + COMMON_VALUES
MEDICAL_HEADERS = %i[approved name contact_info].freeze + COMMON_HEADERS
MEDICAL_VALUES = %w[approved? name contact_info].freeze + COMMON_VALUES
HEADERS = { HEADERS = {
acquired_media_release: ACQUIRED_MEDIA_HEADERS, acquired_media_release: ACQUIRED_MEDIA_HEADERS,
appearance_release: APPEARANCE_HEADERS, appearance_release: APPEARANCE_HEADERS,
location_release: LOCATION_HEADERS location_release: LOCATION_HEADERS,
material_release: MATERIAL_HEADERS,
medical_release: MEDICAL_HEADERS
}.freeze }.freeze
VALUES = { VALUES = {
acquired_media_release: ACQUIRED_MEDIA_VALUES, acquired_media_release: ACQUIRED_MEDIA_VALUES,
appearance_release: APPEARANCE_VALUES, appearance_release: APPEARANCE_VALUES,
location_release: LOCATION_VALUES location_release: LOCATION_VALUES,
material_release: MATERIAL_VALUES,
medical_release: MEDICAL_VALUES
}.freeze }.freeze
included do included do
@@ -40,11 +50,9 @@ module CsvExportable
end end
def to_csv_row def to_csv_row
v = VALUES[self.class.name.underscore.to_sym].map do |function| VALUES[self.class.name.underscore.to_sym].map do |function|
send(function) send(function)
end end
puts v
v
end end
private private

View File

@@ -10,6 +10,7 @@ class MaterialRelease < ApplicationRecord
include Syncable include Syncable
include Taggable include Taggable
include PersonName include PersonName
include CsvExportable
composed_of :person_address, composed_of :person_address,
class_name: "Address", class_name: "Address",

View File

@@ -11,6 +11,7 @@ class MedicalRelease < ApplicationRecord
include SecondGuardianPhotoable include SecondGuardianPhotoable
include GuardianName include GuardianName
include SecondGuardianName include SecondGuardianName
include CsvExportable
NUMBER_OF_CUSTOM_FIELDS = 15 NUMBER_OF_CUSTOM_FIELDS = 15

View File

@@ -780,6 +780,7 @@ en:
search: Search search: Search
empty: Material Releases will appear here empty: Material Releases will appear here
table_headers: table_headers:
name: Name
notes: Notes notes: Notes
signed_at: Date Signed signed_at: Date Signed
tags: Tags tags: Tags
@@ -802,6 +803,8 @@ en:
empty: Medical releases will appear here empty: Medical releases will appear here
table_headers: table_headers:
approved: Approved approved: Approved
name: Person name
contact_info: Contact info
notes: Notes notes: Notes
signed_at: Date Signed signed_at: Date Signed
tags: Tags tags: Tags

View File

@@ -312,12 +312,23 @@ es:
form: form:
photos: photos:
dropzone_label: Tap to take a photo of Licensed Material (optional) (ES) dropzone_label: Tap to take a photo of Licensed Material (optional) (ES)
index:
table_headers:
name: Name (ES)
notes: Notes (ES)
tags: Tags (ES)
signed_at: Date Signed (ES)
medical_releases: medical_releases:
custom_validation_errors: custom_validation_errors:
question_answer_is_required: answer is required (ES) question_answer_is_required: answer is required (ES)
index: index:
table_headers: table_headers:
approved: Approved (ES) approved: Approved (ES)
name: Person name (ES)
contact_info: Contact info (ES)
notes: Notes (ES)
tags: Tags (ES)
signed_at: Date Signed (ES)
medical_release: medical_release:
actions: actions:
review: Review (ES) review: Review (ES)