Compare commits
3 Commits
admin-shou
...
show-only-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
627e5f8108 | ||
|
|
25dfd3bc58 | ||
|
|
6930317a7a |
@@ -40,7 +40,7 @@ class Admin::CastingSubmissionsController < Admin::ApplicationController
|
||||
end
|
||||
|
||||
def casting_submission_params
|
||||
params.require(:casting_submission).permit(:casting_call_id, :performer_name, :interview_date, :zoom_meeting_url, :interview_recording)
|
||||
params.require(:casting_submission).permit(:casting_call_id, :performer_name, :interview_date, :zoom_meeting_url)
|
||||
end
|
||||
|
||||
def casting_submissions
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
class CastingSubmission < ApplicationRecord
|
||||
belongs_to :casting_call
|
||||
has_many_attached :files
|
||||
has_one_attached :interview_recording
|
||||
|
||||
has_secure_token
|
||||
|
||||
|
||||
@@ -6,19 +6,6 @@
|
||||
<%= form.text_field :interview_date, class: "datepicker-control" %>
|
||||
<%= form.text_field :zoom_meeting_url %>
|
||||
|
||||
<% unless casting_submission.new_record? %>
|
||||
<%= form.file_field :interview_recording, data: { direct_upload_url: rails_direct_uploads_url, aws_bucket: ENV['AWS_BUCKET'], aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'], signer_url: multipart_signatures_url } %>
|
||||
|
||||
<% if casting_submission.interview_recording.attached? %>
|
||||
<p>
|
||||
<%= link_to casting_submission.interview_recording do %>
|
||||
<%= fa_icon "file-text-o" %> <%= casting_submission.interview_recording.filename %>
|
||||
<% end %>
|
||||
<span class="text-muted"><%= fa_icon "long-arrow-left" %> <em>Current interview recording</em></span>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="row align-items-center text-center mt-4">
|
||||
<%= link_to t("shared.cancel"), [:admin, :casting_submissions], class: "col-3 text-reset" %>
|
||||
<div class="col-9">
|
||||
|
||||
@@ -12,20 +12,11 @@
|
||||
<%= card_header text: @casting_call.title %>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<div class="col-12">
|
||||
<dl>
|
||||
<%= description_list_pair_for @casting_call, :title, append: ":" %>
|
||||
<%= description_list_pair_for @casting_call, :description, append: ":" %>
|
||||
<%= description_list_pair_for @casting_call, :project_description, append: ":" %>
|
||||
<%= description_list_pair_for @casting_call, :created_at, append: ":" %>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-md-6 col-sm-12">
|
||||
<dl>
|
||||
<%= description_list_pair_for @casting_call, :status, append: ":" %>
|
||||
<%= description_list_pair_for @casting_call, :interview_instructions, append: ":" %>
|
||||
<%= description_list_pair_for @casting_call, :interview_requirements, append: ":" %>
|
||||
<%= description_list_pair_for @casting_call, :questions, append: ":" %>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -19,9 +19,6 @@ RSpec.describe Public::CastingCallsController, type: :controller do
|
||||
expect(response.body).to have_content(casting_call.title)
|
||||
expect(response.body).to have_content(casting_call.description)
|
||||
expect(response.body).to have_content(casting_call.project_description)
|
||||
expect(response.body).to have_content(casting_call.interview_instructions)
|
||||
expect(response.body).to have_content(casting_call.interview_requirements)
|
||||
expect(response.body).to have_content(casting_call.questions)
|
||||
expect(response.body).to have_link("Schedule an Audition")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@ FactoryBot.define do
|
||||
factory :casting_call do
|
||||
association :project
|
||||
user_email 'test@email.com'
|
||||
title 'Casting Call Title'
|
||||
description "Casting call description"
|
||||
project_description "Casting call project description"
|
||||
interview_instructions "Interview instructions"
|
||||
|
||||
@@ -9,9 +9,5 @@ FactoryBot.define do
|
||||
trait :with_files do
|
||||
files { [Rack::Test::UploadedFile.new('spec/fixtures/files/location_photo.png', 'image/png')] }
|
||||
end
|
||||
|
||||
trait :with_interview_recording do
|
||||
interview_recording { Rack::Test::UploadedFile.new('spec/fixtures/files/video_file.mp4', 'video/mp4') }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,45 +39,6 @@ feature "Admin managing casting submissions" do
|
||||
expect(page).to have_content create_casting_submission_button
|
||||
end
|
||||
|
||||
scenario "when creating new casting call interview - interview recording field is not visible" do
|
||||
visit admin_casting_submissions_path
|
||||
|
||||
click_on create_casting_submission_button
|
||||
|
||||
expect(page).to have_content new_casting_submission_heading
|
||||
expect(page).not_to have_field interview_recording_field
|
||||
end
|
||||
|
||||
scenario "admin can upload interview recording video when editing casting call interview" do
|
||||
cc = create(:casting_call)
|
||||
cci = create(:casting_submission, casting_call: cc)
|
||||
|
||||
expect(CastingSubmission.last.interview_recording).not_to be_attached
|
||||
|
||||
visit edit_admin_casting_submission_path(cci)
|
||||
|
||||
expect(page).to have_content edit_casting_submission_heading
|
||||
expect(page).to have_field interview_recording_field
|
||||
expect(page).not_to have_content current_interview_recording_label
|
||||
attach_file interview_recording_field, Rails.root.join(file_fixture('video_file.mp4'))
|
||||
click_on update_casting_submission_button
|
||||
expect(page).to have_content casting_submission_updated_message
|
||||
expect(CastingSubmission.last.interview_recording).to be_attached
|
||||
end
|
||||
|
||||
scenario "when editing casting call interview with already uploaded interview video, interview recording file name link is shown below file field" do
|
||||
cc = create(:casting_call)
|
||||
cci = create(:casting_submission, :with_interview_recording, casting_call: cc)
|
||||
|
||||
expect(CastingSubmission.last.interview_recording).to be_attached
|
||||
|
||||
visit edit_admin_casting_submission_path(cci)
|
||||
|
||||
expect(page).to have_content edit_casting_submission_heading
|
||||
expect(page).to have_content current_interview_recording_label
|
||||
expect(page).to have_link CastingSubmission.last.interview_recording.attachment.blob.filename.to_s
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_casting_submission_button
|
||||
@@ -88,14 +49,6 @@ feature "Admin managing casting submissions" do
|
||||
t 'admin.casting_submissions.new.heading'
|
||||
end
|
||||
|
||||
def edit_casting_submission_heading
|
||||
'Edit Casting Submission'
|
||||
end
|
||||
|
||||
def update_casting_submission_button
|
||||
'Update Casting submission'
|
||||
end
|
||||
|
||||
def submit_casting_submission_form
|
||||
t 'helpers.submit.casting_submission.create'
|
||||
end
|
||||
@@ -115,16 +68,4 @@ feature "Admin managing casting submissions" do
|
||||
def casting_call_field
|
||||
'casting_submission[casting_call_id]'
|
||||
end
|
||||
|
||||
def casting_submission_updated_message
|
||||
t 'admin.casting_submissions.update.notice'
|
||||
end
|
||||
|
||||
def interview_recording_field
|
||||
'casting_submission[interview_recording]'
|
||||
end
|
||||
|
||||
def current_interview_recording_label
|
||||
'Current interview recording'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -74,6 +74,43 @@ feature "User managing casting calls" do
|
||||
expect(page).to have_content("The casting call request has been cancelled")
|
||||
end
|
||||
|
||||
scenario "can open casting call details" do
|
||||
cc = create(:casting_call, title: "Dummy title", project: project)
|
||||
|
||||
visit project_casting_calls_path(project)
|
||||
|
||||
click_on manage_button
|
||||
click_on view_button
|
||||
|
||||
expect(page).to have_content cc.title
|
||||
expect(page).to have_content cc.description
|
||||
expect(page).to have_content cc.project_description
|
||||
expect(page).to have_content cc.created_at
|
||||
expect(page).to have_content cc.status
|
||||
expect(page).to have_content cc.interview_instructions
|
||||
expect(page).to have_content cc.interview_requirements
|
||||
expect(page).to have_content cc.questions
|
||||
end
|
||||
|
||||
context "when signed out" do
|
||||
scenario "user opens public accessible casting call URL" do
|
||||
cc = create(:casting_call, title: "Dummy title", project: project)
|
||||
|
||||
sign_out
|
||||
public_url = "/casting_calls/#{cc.token}"
|
||||
visit public_url
|
||||
|
||||
expect(page).to have_content cc.title
|
||||
expect(page).to have_content cc.description
|
||||
expect(page).to have_content cc.project_description
|
||||
expect(page).not_to have_content cc.created_at
|
||||
expect(page).not_to have_content cc.status
|
||||
expect(page).not_to have_content cc.interview_instructions
|
||||
expect(page).not_to have_content cc.interview_requirements
|
||||
expect(page).not_to have_content cc.questions
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def no_casting_calls_label
|
||||
@@ -84,6 +121,10 @@ feature "User managing casting calls" do
|
||||
t "casting_calls.casting_call.actions.manage"
|
||||
end
|
||||
|
||||
def view_button
|
||||
'View'
|
||||
end
|
||||
|
||||
def add_new_casting_call_label
|
||||
t "casting_calls.index.actions.new"
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user