diff --git a/app/controllers/public/location_releases_controller.rb b/app/controllers/public/location_releases_controller.rb
index a88de75..536406d 100644
--- a/app/controllers/public/location_releases_controller.rb
+++ b/app/controllers/public/location_releases_controller.rb
@@ -64,7 +64,8 @@ class Public::LocationReleasesController < Public::BaseController
:person_address_country,
:signature_base64,
:locale, :contract_template, :filming_started_on, :filming_ended_on,
- :filming_hours
+ :filming_hours,
+ photos: []
)
end
diff --git a/app/helpers/dropzone_helper.rb b/app/helpers/dropzone_helper.rb
index 42dac83..2ad4387 100644
--- a/app/helpers/dropzone_helper.rb
+++ b/app/helpers/dropzone_helper.rb
@@ -5,6 +5,8 @@ module DropzoneHelper
"To Add Photos & Videos to the release:
Drag & Drop Files
or
Click or Tap here to browse photos and connect to Camera"
when "music_release"
"To Add Audio Files to the release:
Drag & Drop Files
or
Click or Tap here to browse files"
+ when "location_release"
+ t 'location_releases.form.photos.dropzone_label'
when "directory"
"To Add Files to the Folder:
Drag & Drop Files
or
Click or Tap here to browse files"
else
diff --git a/app/views/public/location_releases/new.html.erb b/app/views/public/location_releases/new.html.erb
index 0975f73..b93ffa0 100644
--- a/app/views/public/location_releases/new.html.erb
+++ b/app/views/public/location_releases/new.html.erb
@@ -45,6 +45,10 @@
<% end %>
+ <%= card_field_set_tag t(".photos.heading") do %>
+ <%= render "shared/photos_dropzone_fields", form: form, release: @location_release %>
+ <% end %>
+
<%= card_field_set_tag t(".signature.heading") do %>
<%= render "shared/signature_fields", form: form, instruction: 'An Authorized Signatory' %>
<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 7d24079..219bbd0 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -556,6 +556,7 @@ en:
heading: 1 of 4 Location Details
photos:
heading: 4 of 4 Photos
+ dropzone_label: Tap to take a photo of the Property (optional)
signer_details:
heading: 2 of 4 Owner Details
index:
@@ -802,6 +803,8 @@ en:
heading: Location Information
signature:
heading: Sign Below
+ photos:
+ heading: Photos
material_releases:
create:
notice: Your release has been signed. Thank you!
diff --git a/config/locales/es.yml b/config/locales/es.yml
index 13abd12..c3037bf 100644
--- a/config/locales/es.yml
+++ b/config/locales/es.yml
@@ -175,6 +175,10 @@ es:
show:
choose_project: ¿Qué proyecto de la lista de abajo asistirá?
welcome_html: Bienvenidos a la plataforma de firma autorizaciónes de %{name}
+ location_releases:
+ new:
+ photos:
+ heading: Photos (ES)
shared:
print: Print (ES)
talent_releases:
@@ -182,3 +186,7 @@ es:
photos:
guardian_photo:
heading: Guardian Photo (ES)
+ location_releases:
+ form:
+ photos:
+ dropzone_label: Tap to take a photo of the Property (optional) (ES)
diff --git a/spec/controllers/public/location_releases_controller_spec.rb b/spec/controllers/public/location_releases_controller_spec.rb
index 6a6a261..af10c12 100644
--- a/spec/controllers/public/location_releases_controller_spec.rb
+++ b/spec/controllers/public/location_releases_controller_spec.rb
@@ -7,6 +7,15 @@ describe Public::LocationReleasesController do
render_views
describe "#create" do
+ it "allows photos param" do
+ contract_template = create(:contract_template, project: project)
+
+ post :create, params: { account_id: user.primary_account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params_with_photos }
+
+ expect(response).to be_successful
+ expect(LocationRelease.last.photos.attached?).to eq true
+ end
+
it "logs analytics" do
contract_template = create(:contract_template, project: project)
@@ -67,6 +76,10 @@ describe Public::LocationReleasesController do
attributes_for(:location_release, :native).except(:signature).merge(signature_param).merge(person_address_params)
end
+ def location_release_params_with_photos
+ attributes_for(:location_release, :native, :with_photo).except(:signature).merge(signature_param)
+ end
+
def person_address_params
{
person_address_street1: "123 Broadway",
diff --git a/spec/factories/location_releases.rb b/spec/factories/location_releases.rb
index 3431b77..727ea50 100644
--- a/spec/factories/location_releases.rb
+++ b/spec/factories/location_releases.rb
@@ -15,6 +15,13 @@ FactoryBot.define do
end
end
+ trait :with_photo do
+ photos do
+ path = Rails.root.join("spec", "fixtures", "files", "location_photo.png")
+ [Rack::Test::UploadedFile.new(path, "image/png")]
+ end
+ end
+
trait :non_native do
contract do
path = Rails.root.join("spec", "fixtures", "files", "contract.pdf")
diff --git a/spec/features/user_managing_location_releases_spec.rb b/spec/features/user_managing_location_releases_spec.rb
index 9e8a32f..106db74 100644
--- a/spec/features/user_managing_location_releases_spec.rb
+++ b/spec/features/user_managing_location_releases_spec.rb
@@ -5,7 +5,7 @@ feature "User managing location releases" do
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
context "when signed out" do
- scenario "creating a release", js: true do
+ scenario "creating a release without photos", js: true do
contract_template = create(:contract_template, project: project)
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
@@ -21,10 +21,31 @@ feature "User managing location releases" do
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
end
- click_button "I have read and agree to the above"
+ click_button submit_release_button
expect(page).to have_content("Your release was successfully submitted. Thank you.")
end
+
+ scenario "creating a release with photos", js: true do
+ contract_template = create(:contract_template, project: project)
+
+ visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
+
+ fill_in location_name_field, with: "Benny's Burritos"
+ fill_in person_first_name_field, with: "Jane"
+ fill_in person_last_name_field, with: "Doe"
+ fill_in person_phone_field, with: "555-555-5555"
+ fill_in person_email_field, with: "jane.doe@test.com"
+ fill_in person_address_street1_field, with: "100 Broadway"
+ fill_in filming_hours_field, with: "04:00 - 22:00"
+ draw_signature file_fixture("signature.png"), "location_release_signature_base64"
+
+ drop_file Rails.root.join(file_fixture("location_photo.png")), type: :dropzone
+ click_button submit_release_button
+
+ expect(page).to have_content("Your release was successfully submitted. Thank you.")
+ expect(LocationRelease.last.photos.attached?).to eq true
+ end
end
context "when signed in" do
@@ -255,6 +276,10 @@ feature "User managing location releases" do
t "helpers.submit.location_release.create"
end
+ def submit_release_button
+ t("shared.submit_release_long")
+ end
+
def create_release_notice
t "location_releases.create.notice"
end