Compare commits
7 Commits
add-csv-to
...
allow-medi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11c6575b47 | ||
|
|
49ab21a3cf | ||
|
|
196fa7b93b | ||
|
|
9e0702c389 | ||
|
|
e8975ed568 | ||
|
|
df37699023 | ||
|
|
d70a19b7d5 |
@@ -1,11 +0,0 @@
|
|||||||
class Api::MedicalReleasesController < Api::ReleasesController
|
|
||||||
deserializable_resource :medical_release, only: [:create, :update]
|
|
||||||
|
|
||||||
def model_name
|
|
||||||
"medical_release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def attributes_for_index
|
|
||||||
[:name]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
class Api::MiscReleasesController < Api::ReleasesController
|
|
||||||
deserializable_resource :misc_release, only: [:create, :update]
|
|
||||||
|
|
||||||
def model_name
|
|
||||||
"misc_release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def attributes_for_index
|
|
||||||
[:name]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -10,10 +10,8 @@ class Api::SyncController < Api::ApiController
|
|||||||
@appearance_releases = (AppearanceRelease.where(project: accessible_projects))
|
@appearance_releases = (AppearanceRelease.where(project: accessible_projects))
|
||||||
@location_releases = (LocationRelease.where(project: accessible_projects))
|
@location_releases = (LocationRelease.where(project: accessible_projects))
|
||||||
@material_releases = (MaterialRelease.where(project: accessible_projects))
|
@material_releases = (MaterialRelease.where(project: accessible_projects))
|
||||||
@medical_releases = MedicalRelease.where(project: accessible_projects)
|
|
||||||
@misc_releases = MiscRelease.where(project: accessible_projects)
|
|
||||||
@talent_releases = (TalentRelease.where(project: accessible_projects))
|
@talent_releases = (TalentRelease.where(project: accessible_projects))
|
||||||
@notes = notes_query(Note.where(notable: @appearance_releases + @location_releases + @material_releases + @medical_releases + @misc_releases + @talent_releases + @acquired_media_releases ))
|
@notes = notes_query(Note.where(notable: @appearance_releases + @location_releases + @material_releases + @talent_releases + @acquired_media_releases ))
|
||||||
|
|
||||||
render json: {
|
render json: {
|
||||||
data: {
|
data: {
|
||||||
@@ -24,8 +22,6 @@ class Api::SyncController < Api::ApiController
|
|||||||
appearance_releases: releases_query(@appearance_releases),
|
appearance_releases: releases_query(@appearance_releases),
|
||||||
location_releases: releases_query(@location_releases),
|
location_releases: releases_query(@location_releases),
|
||||||
material_releases: releases_query(@material_releases),
|
material_releases: releases_query(@material_releases),
|
||||||
medical_releases: releases_query(@medical_releases),
|
|
||||||
misc_releases: releases_query(@misc_releases),
|
|
||||||
talent_releases: releases_query(@talent_releases),
|
talent_releases: releases_query(@talent_releases),
|
||||||
notes: @notes
|
notes: @notes
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ class GenerateContractsZipJob < ApplicationJob
|
|||||||
before_perform do |job|
|
before_perform do |job|
|
||||||
@project = job.arguments.first
|
@project = job.arguments.first
|
||||||
@download = job.arguments.second
|
@download = job.arguments.second
|
||||||
@release_type = job.arguments.third
|
release_type = job.arguments.third
|
||||||
@folder_name = "#{@project.name.parameterize}_#{get_release_name(@release_type).gsub('_', '-')}"
|
@folder_name = "#{@project.name.parameterize}_#{get_release_name(release_type).gsub('_', '-')}"
|
||||||
@download.update!(name: @folder_name, status: :pending)
|
@download.update!(name: @folder_name, status: :pending)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -20,11 +20,6 @@ class GenerateContractsZipJob < ApplicationJob
|
|||||||
files.each do |attachment|
|
files.each do |attachment|
|
||||||
zipfile.add(attachment, File.join("#{dir}/", attachment))
|
zipfile.add(attachment, File.join("#{dir}/", attachment))
|
||||||
end
|
end
|
||||||
|
|
||||||
if @release_type.constantize.include?(CsvExportable)
|
|
||||||
csv_file = generate_csv releases
|
|
||||||
zipfile.get_output_stream("#{@folder_name}.csv") { |f| f.puts(csv_file) }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
@download.file.attach(io: File.open(zipfile_name), filename: "#{@folder_name}.zip")
|
@download.file.attach(io: File.open(zipfile_name), filename: "#{@folder_name}.zip")
|
||||||
@@ -48,19 +43,6 @@ class GenerateContractsZipJob < ApplicationJob
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def generate_csv(releases)
|
|
||||||
release_class = @release_type.constantize
|
|
||||||
headers = release_class.csv_headers
|
|
||||||
|
|
||||||
CSV.generate(headers: true) do |csv|
|
|
||||||
csv << headers
|
|
||||||
releases.each do |release|
|
|
||||||
csv_row_data = release.to_csv_row
|
|
||||||
csv << csv_row_data
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_release_name(release_type)
|
def get_release_name(release_type)
|
||||||
release_type.constantize.model_name.plural
|
release_type.constantize.model_name.plural
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,13 +9,6 @@ class AcquiredMediaRelease < ApplicationRecord
|
|||||||
include Signable
|
include Signable
|
||||||
include Syncable
|
include Syncable
|
||||||
include PersonName
|
include PersonName
|
||||||
include CsvExportable
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
%i[name file_infos_count]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
has_many :file_infos, as: :releasable, dependent: :destroy
|
has_many :file_infos, as: :releasable, dependent: :destroy
|
||||||
|
|
||||||
@@ -64,8 +57,4 @@ class AcquiredMediaRelease < ApplicationRecord
|
|||||||
def uses_edl?
|
def uses_edl?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_infos_count
|
|
||||||
file_infos.any? ? file_infos.size : I18n.t('acquired_media_releases.acquired_media_release.no_media')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,13 +15,6 @@ class AppearanceRelease < ApplicationRecord
|
|||||||
include SecondGuardianPhotoable
|
include SecondGuardianPhotoable
|
||||||
include GuardianName
|
include GuardianName
|
||||||
include SecondGuardianName
|
include SecondGuardianName
|
||||||
include CsvExportable
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
%i[name contact_info]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
has_one_attached :person_photo
|
has_one_attached :person_photo
|
||||||
|
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module CsvExportable
|
|
||||||
extend ActiveSupport::Concern
|
|
||||||
|
|
||||||
COMMON_HEADERS = %i[notes tags signed_at].freeze
|
|
||||||
COMMON_VALUES = %w[clean_notes clean_tags signed_on].freeze
|
|
||||||
|
|
||||||
included do
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
[]
|
|
||||||
end
|
|
||||||
|
|
||||||
def csv_headers
|
|
||||||
headers = custom_csv_exportable_headers + COMMON_HEADERS
|
|
||||||
|
|
||||||
headers.map do |header|
|
|
||||||
I18n.t("#{model_name.plural}.index.table_headers.#{header}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def to_csv_row
|
|
||||||
(self.class.custom_csv_exportable_headers + COMMON_VALUES).map do |function|
|
|
||||||
send(function)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def contact_info
|
|
||||||
contact_info = ''
|
|
||||||
contact_info += "#{person_address}; " if person_address.present?
|
|
||||||
contact_info += "P: #{person_phone}; " if person_phone.present?
|
|
||||||
contact_info += "E: #{person_email}" if person_email.present?
|
|
||||||
contact_info.delete_suffix '; '
|
|
||||||
end
|
|
||||||
|
|
||||||
def clean_notes
|
|
||||||
notes = ''
|
|
||||||
self.notes.order_by_recent.each do |note|
|
|
||||||
notes += "#{note.content}(#{note.email}), "
|
|
||||||
end
|
|
||||||
notes.delete_suffix ', '
|
|
||||||
end
|
|
||||||
|
|
||||||
def clean_tags
|
|
||||||
tags = ''
|
|
||||||
self.tags.each do |tag|
|
|
||||||
tags += "#{tag.name}, "
|
|
||||||
end
|
|
||||||
tags.delete_suffix ', '
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -10,13 +10,6 @@ class LocationRelease < ApplicationRecord
|
|||||||
include Syncable
|
include Syncable
|
||||||
include Taggable
|
include Taggable
|
||||||
include PersonName
|
include PersonName
|
||||||
include CsvExportable
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
%i[name address]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
composed_of :address,
|
composed_of :address,
|
||||||
mapping: [
|
mapping: [
|
||||||
|
|||||||
@@ -10,13 +10,6 @@ class MaterialRelease < ApplicationRecord
|
|||||||
include Syncable
|
include Syncable
|
||||||
include Taggable
|
include Taggable
|
||||||
include PersonName
|
include PersonName
|
||||||
include CsvExportable
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
%i[name]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
composed_of :person_address,
|
composed_of :person_address,
|
||||||
class_name: "Address",
|
class_name: "Address",
|
||||||
|
|||||||
@@ -11,13 +11,6 @@ class MedicalRelease < ApplicationRecord
|
|||||||
include SecondGuardianPhotoable
|
include SecondGuardianPhotoable
|
||||||
include GuardianName
|
include GuardianName
|
||||||
include SecondGuardianName
|
include SecondGuardianName
|
||||||
include CsvExportable
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
%i[approved? name contact_info]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
NUMBER_OF_CUSTOM_FIELDS = 15
|
NUMBER_OF_CUSTOM_FIELDS = 15
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,6 @@ class MiscRelease < ApplicationRecord
|
|||||||
include PersonName
|
include PersonName
|
||||||
include GuardianName
|
include GuardianName
|
||||||
include GuardianPhotoable
|
include GuardianPhotoable
|
||||||
include CsvExportable
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
%i[name contact_info]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
NUMBER_OF_CUSTOM_FIELDS = 15
|
NUMBER_OF_CUSTOM_FIELDS = 15
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,6 @@ class MusicRelease < ApplicationRecord
|
|||||||
include Searchable
|
include Searchable
|
||||||
include Taggable
|
include Taggable
|
||||||
include PersonName
|
include PersonName
|
||||||
include CsvExportable
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
%i[name file_infos_count composers_count publishers_count]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
has_many :file_infos, as: :releasable, dependent: :destroy
|
has_many :file_infos, as: :releasable, dependent: :destroy
|
||||||
has_many :composers, dependent: :destroy
|
has_many :composers, dependent: :destroy
|
||||||
@@ -79,18 +72,6 @@ class MusicRelease < ApplicationRecord
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_infos_count
|
|
||||||
file_infos.size
|
|
||||||
end
|
|
||||||
|
|
||||||
def composers_count
|
|
||||||
composers.size
|
|
||||||
end
|
|
||||||
|
|
||||||
def publishers_count
|
|
||||||
publishers.size
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def publisher_percentages_add_up_to_100
|
def publisher_percentages_add_up_to_100
|
||||||
|
|||||||
@@ -14,13 +14,6 @@ class TalentRelease < ApplicationRecord
|
|||||||
include SecondGuardianPhotoable
|
include SecondGuardianPhotoable
|
||||||
include GuardianName
|
include GuardianName
|
||||||
include SecondGuardianName
|
include SecondGuardianName
|
||||||
include CsvExportable
|
|
||||||
|
|
||||||
class << self
|
|
||||||
def custom_csv_exportable_headers
|
|
||||||
%i[name phone email]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
composed_of :person_address,
|
composed_of :person_address,
|
||||||
class_name: "Address",
|
class_name: "Address",
|
||||||
@@ -93,14 +86,6 @@ class TalentRelease < ApplicationRecord
|
|||||||
person_name
|
person_name
|
||||||
end
|
end
|
||||||
|
|
||||||
def phone
|
|
||||||
person_phone
|
|
||||||
end
|
|
||||||
|
|
||||||
def email
|
|
||||||
person_email
|
|
||||||
end
|
|
||||||
|
|
||||||
def filename_suffix
|
def filename_suffix
|
||||||
"#{person_last_name} #{person_first_name}"
|
"#{person_last_name} #{person_first_name}"
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<td>
|
<td>
|
||||||
<%= contract_template.releases.size %>
|
<%= contract_template.releases.size %>
|
||||||
</td>
|
</td>
|
||||||
<td class="text-right" nowrap>
|
<td class="text-right">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<%= button_tag t(".actions.manage"), class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
|
<%= button_tag t(".actions.manage"), class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %>
|
||||||
<div class="dropdown-menu dropdown-menu-right">
|
<div class="dropdown-menu dropdown-menu-right">
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
<div class="card shadow-sm">
|
|
||||||
<%= card_header text: t(".heading"), close_action_path: [@project, :medical_releases] %>
|
|
||||||
<div class="card-body">
|
|
||||||
<embed class="embeded-contract-preview" type="application/pdf" src="<%= url_for [@medical_release, :contracts, format: "pdf"] %>" width="90%" height="1200" />
|
|
||||||
|
|
||||||
<%= bootstrap_form_with model: @medical_release, method: :patch, url: [:approve, @medical_release], local: true do |form| %>
|
|
||||||
<div class="row align-items-center text-center mt-4">
|
|
||||||
<%= link_to t("shared.cancel"), [@medical_release.project, :medical_releases], class: "col-3 text-reset" %>
|
|
||||||
<div class="col-9">
|
|
||||||
<%= form.button t('.actions.approve'), id: "approve_release", class: class_string("btn btn-block btn-success btn-primary"), data: { disable_with: t("shared.disable_with") } %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
@@ -39,7 +39,9 @@
|
|||||||
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.text_field :person_last_name, required: true, wrapper_class: "col-sm-6" %>
|
<%= form.text_field :person_last_name, required: true, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
||||||
<%= form.email_field :person_email, required: true, wrapper_class: "col-sm-6" %>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||||
</div>
|
</div>
|
||||||
<%= render "shared/address_fields", form: form, subject: "person" %>
|
<%= render "shared/address_fields", form: form, subject: "person" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -13,4 +13,4 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p class="alert alert-success p-3 lead text-center"><%= t '.success_message' %></p>
|
<p class="alert alert-success p-3 lead text-center"><%= t '.success_message' %></p>
|
||||||
<%= link_to fa_icon("arrow-left", text: "Back"), [@project, :task_requests], class: "btn btn-primary" %>
|
<%= link_to fa_icon("check", text: "Done"), [@project, :task_requests], class: "btn btn-primary" %>
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ en:
|
|||||||
empty: Acquired Media Releases will appear here
|
empty: Acquired Media Releases will appear here
|
||||||
table_headers:
|
table_headers:
|
||||||
file_infos_count: No. Files
|
file_infos_count: No. Files
|
||||||
name: Name
|
|
||||||
notes: Notes
|
notes: Notes
|
||||||
signed_at: Date Signed
|
signed_at: Date Signed
|
||||||
tags: Tags
|
tags: Tags
|
||||||
@@ -152,8 +151,6 @@ en:
|
|||||||
empty: Appearance Releases will appear here
|
empty: Appearance Releases will appear here
|
||||||
imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release
|
imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release
|
||||||
table_headers:
|
table_headers:
|
||||||
contact_info: Contact info
|
|
||||||
name: Name
|
|
||||||
notes: Notes
|
notes: Notes
|
||||||
signed_at: Date Signed
|
signed_at: Date Signed
|
||||||
tags: Tags
|
tags: Tags
|
||||||
@@ -745,7 +742,6 @@ en:
|
|||||||
empty: Location Releases will appear here
|
empty: Location Releases will appear here
|
||||||
table_headers:
|
table_headers:
|
||||||
address: Address
|
address: Address
|
||||||
name: Name
|
|
||||||
notes: Notes
|
notes: Notes
|
||||||
signed_at: Date Signed
|
signed_at: Date Signed
|
||||||
tags: Tags
|
tags: Tags
|
||||||
@@ -780,7 +776,6 @@ 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
|
||||||
@@ -803,9 +798,6 @@ en:
|
|||||||
empty: Medical releases will appear here
|
empty: Medical releases will appear here
|
||||||
table_headers:
|
table_headers:
|
||||||
approved: Approved
|
approved: Approved
|
||||||
approved?: Approved
|
|
||||||
contact_info: Contact info
|
|
||||||
name: Person name
|
|
||||||
notes: Notes
|
notes: Notes
|
||||||
signed_at: Date Signed
|
signed_at: Date Signed
|
||||||
tags: Tags
|
tags: Tags
|
||||||
@@ -823,8 +815,6 @@ en:
|
|||||||
search: Search
|
search: Search
|
||||||
empty: Misc Releases will appear here
|
empty: Misc Releases will appear here
|
||||||
table_headers:
|
table_headers:
|
||||||
contact_info: Contact info
|
|
||||||
name: Person name
|
|
||||||
notes: Notes
|
notes: Notes
|
||||||
signed_at: Date Signed
|
signed_at: Date Signed
|
||||||
tags: Tags
|
tags: Tags
|
||||||
@@ -859,7 +849,6 @@ en:
|
|||||||
table_headers:
|
table_headers:
|
||||||
composers_count: No. Composers
|
composers_count: No. Composers
|
||||||
file_infos_count: No. Files
|
file_infos_count: No. Files
|
||||||
name: Name
|
|
||||||
notes: Notes
|
notes: Notes
|
||||||
publishers_count: No. Publishers
|
publishers_count: No. Publishers
|
||||||
signed_at: Date Signed
|
signed_at: Date Signed
|
||||||
@@ -1256,10 +1245,7 @@ en:
|
|||||||
search: Search
|
search: Search
|
||||||
empty: Talent Releases will appear here
|
empty: Talent Releases will appear here
|
||||||
table_headers:
|
table_headers:
|
||||||
email: Email
|
|
||||||
name: Name
|
|
||||||
notes: Notes
|
notes: Notes
|
||||||
phone: Phone
|
|
||||||
signed_at: Date Signed
|
signed_at: Date Signed
|
||||||
tags: Tags
|
tags: Tags
|
||||||
new:
|
new:
|
||||||
|
|||||||
@@ -1,14 +1,4 @@
|
|||||||
es:
|
es:
|
||||||
acquired_media_releases:
|
|
||||||
acquired_media_release:
|
|
||||||
no_media: No Media (ES)
|
|
||||||
index:
|
|
||||||
table_headers:
|
|
||||||
file_infos_count: No. Files (ES)
|
|
||||||
name: Name (ES)
|
|
||||||
notes: Notes (ES)
|
|
||||||
signed_at: Date Signed (ES)
|
|
||||||
tags: Tags (ES)
|
|
||||||
activerecord:
|
activerecord:
|
||||||
attributes:
|
attributes:
|
||||||
appearance_release:
|
appearance_release:
|
||||||
@@ -51,12 +41,6 @@ es:
|
|||||||
heading: Person Photo (ES)
|
heading: Person Photo (ES)
|
||||||
index:
|
index:
|
||||||
imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release (ES)
|
imported_appearance_release_missing_attachment: Person photo or contract missing for imported appearance release (ES)
|
||||||
table_headers:
|
|
||||||
contact_info: ""
|
|
||||||
name: ""
|
|
||||||
notes: ""
|
|
||||||
signed_at: ""
|
|
||||||
tags: ""
|
|
||||||
shared:
|
shared:
|
||||||
imported_appearance_release_contract_name: Contrato Importado
|
imported_appearance_release_contract_name: Contrato Importado
|
||||||
imported_appearance_release_headshot_name: Retrato Importado
|
imported_appearance_release_headshot_name: Retrato Importado
|
||||||
@@ -312,57 +296,21 @@ es:
|
|||||||
form:
|
form:
|
||||||
photos:
|
photos:
|
||||||
dropzone_label: Tap to take a photo of the Property (optional) (ES)
|
dropzone_label: Tap to take a photo of the Property (optional) (ES)
|
||||||
index:
|
|
||||||
table_headers:
|
|
||||||
address: Address (ES)
|
|
||||||
notes: Notes (ES)
|
|
||||||
signed_at: Date Signed (ES)
|
|
||||||
tags: Tags (ES)
|
|
||||||
material_releases:
|
material_releases:
|
||||||
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)
|
|
||||||
signed_at: Date Signed (ES)
|
|
||||||
tags: Tags (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)
|
||||||
approved?: Approved (ES)
|
|
||||||
contact_info: Contact info (ES)
|
|
||||||
name: Person name (ES)
|
|
||||||
notes: Notes (ES)
|
|
||||||
signed_at: Date Signed (ES)
|
|
||||||
tags: Tags (ES)
|
|
||||||
medical_release:
|
medical_release:
|
||||||
actions:
|
actions:
|
||||||
review: Review (ES)
|
review: Review (ES)
|
||||||
messages:
|
messages:
|
||||||
approved_tooltip: ""
|
approved_tooltip: ""
|
||||||
misc_releases:
|
|
||||||
index:
|
|
||||||
table_headers:
|
|
||||||
contact_info: Contact info (ES)
|
|
||||||
name: Person name (ES)
|
|
||||||
notes: Notes (ES)
|
|
||||||
signed_at: Date Signed (ES)
|
|
||||||
tags: Tags (ES)
|
|
||||||
music_releases:
|
|
||||||
index:
|
|
||||||
table_headers:
|
|
||||||
composers_count: No. Composers (ES)
|
|
||||||
file_infos_count: No. Files (ES)
|
|
||||||
name: Name (ES)
|
|
||||||
notes: Notes (ES)
|
|
||||||
publishers_count: No. Publishers (ES)
|
|
||||||
signed_at: Date Signed (ES)
|
|
||||||
tags: Tags (ES)
|
|
||||||
public:
|
public:
|
||||||
appearance_releases:
|
appearance_releases:
|
||||||
create:
|
create:
|
||||||
@@ -467,14 +415,6 @@ es:
|
|||||||
heading: Second Guardian Photo (ES)
|
heading: Second Guardian Photo (ES)
|
||||||
guardian_photo:
|
guardian_photo:
|
||||||
heading: Guardian Photo (ES)
|
heading: Guardian Photo (ES)
|
||||||
index:
|
|
||||||
table_headers:
|
|
||||||
email: Email (ES)
|
|
||||||
name: Name (ES)
|
|
||||||
notes: Notes (ES)
|
|
||||||
phone: Phone (ES)
|
|
||||||
signed_at: Date Signed (ES)
|
|
||||||
tags: Tags (ES)
|
|
||||||
task_requests:
|
task_requests:
|
||||||
create:
|
create:
|
||||||
success_message: Your task request was successfully submitted. Thank you. A chat window will pop up on the lower right in a few seconds. (ES)
|
success_message: Your task request was successfully submitted. Thank you. A chat window will pop up on the lower right in a few seconds. (ES)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ require 'oath/constraints/signed_in'
|
|||||||
require 'sidekiq/web'
|
require 'sidekiq/web'
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
AVAILABLE_LOCALES_REGEX = /#{I18n.available_locales.join("|")}/.freeze
|
AVAILABLE_LOCALES_REGEX = /#{I18n.available_locales.join("|")}/
|
||||||
|
|
||||||
concern :confirmable do
|
concern :confirmable do
|
||||||
resources :video_release_confirmations, only: [:new, :create, :destroy]
|
resources :video_release_confirmations, only: [:new, :create, :destroy]
|
||||||
@@ -136,8 +136,8 @@ Rails.application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
RELEASES = [:acquired_media_releases, :appearance_releases, :talent_releases, :material_releases, :medical_releases, :misc_releases, :location_releases].freeze
|
RELEASES = [:acquired_media_releases, :appearance_releases, :talent_releases, :material_releases, :location_releases]
|
||||||
ALL_RELEASES = RELEASES + [:music_releases]
|
ALL_RELEASES = RELEASES + [:music_releases, :misc_releases]
|
||||||
|
|
||||||
ALL_RELEASES.each do |release|
|
ALL_RELEASES.each do |release|
|
||||||
resources release, only: [], concerns: :taggable
|
resources release, only: [], concerns: :taggable
|
||||||
@@ -163,7 +163,7 @@ Rails.application.routes.draw do
|
|||||||
resources :contract_templates, only: [:index]
|
resources :contract_templates, only: [:index]
|
||||||
end
|
end
|
||||||
resources :contract_templates, only: [:show] do
|
resources :contract_templates, only: [:show] do
|
||||||
(RELEASES - [:misc_releases, :medical_releases]).each do |release|
|
RELEASES.each do |release|
|
||||||
resources release, controller: release, only: [:create]
|
resources release, controller: release, only: [:create]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Api::MedicalReleasesController, type: :controller do
|
|
||||||
let(:current_user) { create(:user) }
|
|
||||||
let(:project) { create(:project, name: 'first', account: current_user.primary_account) }
|
|
||||||
|
|
||||||
describe '#index' do
|
|
||||||
it 'returns a succesful response' do
|
|
||||||
create(:medical_release, person_first_name: 'John', person_last_name: 'Lee', project_id: project.id)
|
|
||||||
create(:medical_release, person_first_name: 'Jane', person_last_name: 'Lee', project_id: project.id)
|
|
||||||
|
|
||||||
sign_in_to_api(current_user)
|
|
||||||
get :index, params: { project_id: project.id }
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
|
||||||
expect(response.body).to include 'John'
|
|
||||||
expect(response.body).to include 'Jane'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#show' do
|
|
||||||
it 'returns a succesful response' do
|
|
||||||
release1 = create(:medical_release, person_first_name: 'John', person_last_name: 'Lee', project_id: project.id)
|
|
||||||
release2 = create(:medical_release, person_first_name: 'Jane', person_last_name: 'Lee', project_id: project.id)
|
|
||||||
|
|
||||||
sign_in_to_api(current_user)
|
|
||||||
get :show, params: { id: release1 }
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
|
||||||
expect(response.body).to include 'John'
|
|
||||||
expect(response.body).not_to include 'Jane'
|
|
||||||
|
|
||||||
get :show, params: { id: release2 }
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
|
||||||
expect(response.body).not_to include 'John'
|
|
||||||
expect(response.body).to include 'Jane'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require 'rails_helper'
|
|
||||||
|
|
||||||
RSpec.describe Api::MiscReleasesController, type: :controller do
|
|
||||||
let(:current_user) { create(:user) }
|
|
||||||
let(:project) { create(:project, name: 'first', account: current_user.primary_account) }
|
|
||||||
|
|
||||||
describe '#index' do
|
|
||||||
it 'returns a succesful response' do
|
|
||||||
create(:misc_release, person_first_name: 'John', person_last_name: 'Lee', project_id: project.id)
|
|
||||||
create(:misc_release, person_first_name: 'Jane', person_last_name: 'Lee', project_id: project.id)
|
|
||||||
|
|
||||||
sign_in_to_api(current_user)
|
|
||||||
get :index, params: { project_id: project.id }
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
|
||||||
expect(response.body).to include 'John'
|
|
||||||
expect(response.body).to include 'Jane'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#show' do
|
|
||||||
it 'returns a succesful response' do
|
|
||||||
release1 = create(:misc_release, person_first_name: 'John', person_last_name: 'Lee', project_id: project.id)
|
|
||||||
release2 = create(:misc_release, person_first_name: 'Jane', person_last_name: 'Lee', project_id: project.id)
|
|
||||||
|
|
||||||
sign_in_to_api(current_user)
|
|
||||||
get :show, params: { id: release1 }
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
|
||||||
expect(response.body).to include 'John'
|
|
||||||
expect(response.body).not_to include 'Jane'
|
|
||||||
|
|
||||||
get :show, params: { id: release2 }
|
|
||||||
|
|
||||||
expect(response).to be_successful
|
|
||||||
expect(response.body).not_to include 'John'
|
|
||||||
expect(response.body).to include 'Jane'
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -18,14 +18,6 @@ releases = [
|
|||||||
{
|
{
|
||||||
type: :material_release,
|
type: :material_release,
|
||||||
obligatory_attribute: :name
|
obligatory_attribute: :name
|
||||||
},
|
|
||||||
{
|
|
||||||
type: :medical_release,
|
|
||||||
obligatory_attribute: :person_name
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: :misc_release,
|
|
||||||
obligatory_attribute: :person_name
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -110,26 +110,6 @@ RSpec.describe Api::SyncController, type: :controller do
|
|||||||
expect(guardian_photo).to include('id', 'type', 'attributes')
|
expect(guardian_photo).to include('id', 'type', 'attributes')
|
||||||
expect(photo_attributes).to include('filename', 'content_type', 'url', 'thumbnail_url')
|
expect(photo_attributes).to include('filename', 'content_type', 'url', 'thumbnail_url')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'contains misc releases' do
|
|
||||||
create_default_data
|
|
||||||
|
|
||||||
get :index
|
|
||||||
|
|
||||||
misc_releases = attributes_for_type('misc_releases')
|
|
||||||
|
|
||||||
expect(misc_releases.first).to include('id')
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'contains misc releases' do
|
|
||||||
create_default_data
|
|
||||||
|
|
||||||
get :index
|
|
||||||
|
|
||||||
medical_releases = attributes_for_type('medical_releases')
|
|
||||||
|
|
||||||
expect(medical_releases.first).to include('id')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -140,8 +120,6 @@ RSpec.describe Api::SyncController, type: :controller do
|
|||||||
create(:talent_release, project: project)
|
create(:talent_release, project: project)
|
||||||
create(:location_release, project: project)
|
create(:location_release, project: project)
|
||||||
create(:material_release, project: project)
|
create(:material_release, project: project)
|
||||||
create(:medical_release, project: project)
|
|
||||||
create(:misc_release, project: project)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_default_data_with_guardian_info
|
def create_default_data_with_guardian_info
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ RSpec.feature 'User creates task request', type: :feature do
|
|||||||
click_on 'Create Task request'
|
click_on 'Create Task request'
|
||||||
|
|
||||||
expect(page).to have_content task_created_message
|
expect(page).to have_content task_created_message
|
||||||
expect(page).to have_link("Back")
|
expect(page).to have_link("Done")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'user can view task request details' do
|
scenario 'user can view task request details' do
|
||||||
|
|||||||
@@ -35,38 +35,6 @@ describe GenerateContractsZipJob do
|
|||||||
expect(download.file).to be_attached
|
expect(download.file).to be_attached
|
||||||
end
|
end
|
||||||
|
|
||||||
it "generates ZIP containing CSV file with all releases data for all release types" do
|
|
||||||
release_types = %w[AcquiredMediaRelease AppearanceRelease LocationRelease MaterialRelease MedicalRelease MiscRelease MusicRelease TalentRelease]
|
|
||||||
create_releases_for_all_types
|
|
||||||
|
|
||||||
release_types.each do |type|
|
|
||||||
lowercase_plural = type.constantize.model_name.plural
|
|
||||||
GenerateContractsZipJob.perform_now(project, download, type, project.public_send(lowercase_plural).ids)
|
|
||||||
|
|
||||||
generated_zip = download.file.blob.download
|
|
||||||
csv_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.csv"
|
|
||||||
Zip::InputStream.open(StringIO.new(generated_zip)) do |io|
|
|
||||||
while entry = io.get_next_entry
|
|
||||||
next unless entry.name == csv_file_name
|
|
||||||
|
|
||||||
csv_file = entry.get_input_stream.read
|
|
||||||
|
|
||||||
release_class = Object.const_get type
|
|
||||||
release_headers = release_class.csv_headers
|
|
||||||
|
|
||||||
release_headers.each do |header|
|
|
||||||
expect(csv_file).to match header
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
dummy_zip_file_name = "#{project.name.parameterize}_#{lowercase_plural.gsub('_', '-')}.zip"
|
|
||||||
if File.exist?(file_fixture(dummy_zip_file_name))
|
|
||||||
File.delete(file_fixture(dummy_zip_file_name))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "When there are errors" do
|
context "When there are errors" do
|
||||||
let(:error) { StandardError.new("Contracts or contract templates not found.") }
|
let(:error) { StandardError.new("Contracts or contract templates not found.") }
|
||||||
|
|
||||||
@@ -88,21 +56,6 @@ describe GenerateContractsZipJob do
|
|||||||
# Delete the file created in fixture.
|
# Delete the file created in fixture.
|
||||||
# Or the tests will fail on next run due to already existing files in existing zip.
|
# Or the tests will fail on next run due to already existing files in existing zip.
|
||||||
path = Rails.root.join("spec", "fixtures", "files")
|
path = Rails.root.join("spec", "fixtures", "files")
|
||||||
if File.exists? "#{path}/my-video-project_appearance-releases.zip"
|
File.delete("#{path}/my-video-project_appearance-releases.zip") if File.exists? "#{path}/my-video-project_appearance-releases.zip"
|
||||||
File.delete("#{path}/my-video-project_appearance-releases.zip")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
|
||||||
|
|
||||||
def create_releases_for_all_types
|
|
||||||
create(:acquired_media_release_with_contract_template, :native, project: project)
|
|
||||||
create(:appearance_release_with_contract_template, :native, project: project, person_name: "John Doe")
|
|
||||||
create(:location_release_with_contract_template, :native, project: project)
|
|
||||||
create(:material_release_with_contract_template, :native, project: project)
|
|
||||||
create(:medical_release_with_contract_template, :native, project: project)
|
|
||||||
create(:misc_release_with_contract_template, :native, project: project)
|
|
||||||
create(:music_release_with_contract_template, project: project)
|
|
||||||
create(:talent_release_with_contract_template, :native, project: project)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user