diff --git a/app/assets/stylesheets/_bootstrap_overrides.scss b/app/assets/stylesheets/_bootstrap_overrides.scss index 1948109..85e5428 100644 --- a/app/assets/stylesheets/_bootstrap_overrides.scss +++ b/app/assets/stylesheets/_bootstrap_overrides.scss @@ -11,6 +11,7 @@ $body-color: #4A4A4A; $primary: #6F89FF; $blue: #0092ff; $red: #F9002B; +$dark-red: #CE004A; $green: #51B61B; $teal: #32C498; $purple: #5139EE; diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index b14620f..220bfa1 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -69,6 +69,13 @@ label { } } + &.cast-me { + span:last-child { + background-color: $dark-red; + color: $white; + } + } + &.disabled { span:last-child { background-color: $gray-500 !important; diff --git a/app/controllers/admin/casting_call_interviews_controller.rb b/app/controllers/admin/casting_call_interviews_controller.rb deleted file mode 100644 index 9b83b34..0000000 --- a/app/controllers/admin/casting_call_interviews_controller.rb +++ /dev/null @@ -1,61 +0,0 @@ -class Admin::CastingCallInterviewsController < Admin::ApplicationController - before_action :set_casting_call_interview, only: [:edit, :update, :show, :complete] - before_action :build_casting_call_interview, only: [:new, :create] - before_action :set_accounts, only: %i[new create edit] - - def index - @casting_call_interviews = casting_call_interviews.order_by_recent.paginate(page: params[:page]) - end - - def create - @casting_call_interview.attributes = casting_call_interview_params - - if @casting_call_interview.save - redirect_to [:admin, :casting_call_interviews], notice: t(".notice") - else - render :new - end - end - - def update - if @casting_call_interview.update(casting_call_interview_params) - redirect_to [:admin, :casting_call_interviews], notice: t(".notice") - else - render :edit - end - end - - def complete - if @casting_call_interview.update(interviewed_at: Time.zone.now) - redirect_to [:admin, :casting_call_interviews], notice: t(".notice") - else - redirect_to [:admin, :casting_call_interviews], notice: t(".alert") - end - end - - private - - def set_accounts - @accounts = accounts - end - - def casting_call_interview_params - params.require(:casting_call_interview).permit(:casting_call_id, :performer_name, :interview_date, :zoom_meeting_url) - end - - def casting_call_interviews - policy_scope CastingCallInterview - end - - def set_casting_call_interview - @casting_call_interview = authorize policy_scope(CastingCallInterview).find(params[:id]) - end - - def accounts - policy_scope Account - end - - def build_casting_call_interview - @casting_call_interview = authorize policy_scope(CastingCallInterview).build - end -end \ No newline at end of file diff --git a/app/controllers/admin/casting_submissions_controller.rb b/app/controllers/admin/casting_submissions_controller.rb new file mode 100644 index 0000000..f8cf5d1 --- /dev/null +++ b/app/controllers/admin/casting_submissions_controller.rb @@ -0,0 +1,61 @@ +class Admin::CastingSubmissionsController < Admin::ApplicationController + before_action :set_casting_submission, only: [:edit, :update, :show, :complete] + before_action :build_casting_submission, only: [:new, :create] + before_action :set_accounts, only: %i[new create edit] + + def index + @casting_submissions = casting_submissions.order_by_recent.paginate(page: params[:page]) + end + + def create + @casting_submission.attributes = casting_submission_params + + if @casting_submission.save + redirect_to [:admin, :casting_submissions], notice: t(".notice") + else + render :new + end + end + + def update + if @casting_submission.update(casting_submission_params) + redirect_to [:admin, :casting_submissions], notice: t(".notice") + else + render :edit + end + end + + def complete + if @casting_submission.update(interviewed_at: Time.zone.now) + redirect_to [:admin, :casting_submissions], notice: t(".notice") + else + redirect_to [:admin, :casting_submissions], notice: t(".alert") + end + end + + private + + def set_accounts + @accounts = accounts + end + + def casting_submission_params + params.require(:casting_submission).permit(:casting_call_id, :performer_name, :interview_date, :zoom_meeting_url) + end + + def casting_submissions + policy_scope CastingSubmission + end + + def set_casting_submission + @casting_submission = authorize policy_scope(CastingSubmission).find(params[:id]) + end + + def accounts + policy_scope Account + end + + def build_casting_submission + @casting_submission = authorize policy_scope(CastingSubmission).build + end +end diff --git a/app/controllers/casting_call_interviews_controller.rb b/app/controllers/casting_call_interviews_controller.rb deleted file mode 100644 index 0bdb9f2..0000000 --- a/app/controllers/casting_call_interviews_controller.rb +++ /dev/null @@ -1,28 +0,0 @@ -class CastingCallInterviewsController < ApplicationController - before_action :set_project - before_action :set_casting_call_interview, only: [:show] - - include ProjectLayout - - def index - @casting_call_interviews = casting_call_interviews.completed.order_by_recent.paginate(page: params[:page]) - end - - def show - @files = @casting_call_interview.files.paginate(page: params[:page]) - end - - private - - def set_project - @project = policy_scope(Project).find(params[:project_id]) - end - - def set_casting_call_interview - @casting_call_interview = authorize casting_call_interviews.find(params[:id]) - end - - def casting_call_interviews - authorize policy_scope(CastingCallInterview) - end -end diff --git a/app/controllers/casting_submission_downloads_controller.rb b/app/controllers/casting_submission_downloads_controller.rb new file mode 100644 index 0000000..53dedfb --- /dev/null +++ b/app/controllers/casting_submission_downloads_controller.rb @@ -0,0 +1,30 @@ +class CastingSubmissionDownloadsController < ApplicationController + include ProjectContext + + before_action :set_project, only: [:create] + before_action :set_casting_submission, only: :create + + include ProjectLayout + + def create + download = @project.downloads.create!(name: @casting_submission.zip_file_name, release_type: "CastingSubmission") + + other_downloads_in_progress = @project.downloads.unfinished_desc_order.offset(1) + + if other_downloads_in_progress.any? + in_progress_downloads_details = render_to_string "_other_pending_downloads", locals: { downloads: other_downloads_in_progress, release_type: "CastingSubmission" }, :layout => false + ProjectsChannel.broadcast_download_generation_update(download, in_progress_downloads_details) + else + ProjectsChannel.broadcast_download_generation_update(download, I18n.t("casting_submission_downloads.download.pending", release_type: "CastingSubmission")) + end + + GenerateCastingSubmissionFilesZipJob.perform_later(@project, download, @casting_submission) + end + + private + + def set_casting_submission + authorize(Download) + @casting_submission = policy_scope(@project.casting_submissions).find(params[:casting_submission_id]) + end +end diff --git a/app/controllers/casting_submissions_controller.rb b/app/controllers/casting_submissions_controller.rb new file mode 100644 index 0000000..e191276 --- /dev/null +++ b/app/controllers/casting_submissions_controller.rb @@ -0,0 +1,28 @@ +class CastingSubmissionsController < ApplicationController + before_action :set_project + before_action :set_casting_submission, only: [:show] + + include ProjectLayout + + def index + @casting_submissions = casting_submissions.completed.order_by_recent.paginate(page: params[:page]) + end + + def show + @files = @casting_submission.files.paginate(page: params[:page]) + end + + private + + def set_project + @project = policy_scope(Project).find(params[:project_id]) + end + + def set_casting_submission + @casting_submission = authorize casting_submissions.find(params[:id]) + end + + def casting_submissions + authorize policy_scope(CastingSubmission) + end +end diff --git a/app/controllers/interview_downloads_controller.rb b/app/controllers/interview_downloads_controller.rb deleted file mode 100644 index 46a9b57..0000000 --- a/app/controllers/interview_downloads_controller.rb +++ /dev/null @@ -1,30 +0,0 @@ -class InterviewDownloadsController < ApplicationController - include ProjectContext - - before_action :set_project, only: [:create] - before_action :set_casting_call_interview, only: :create - - include ProjectLayout - - def create - download = @project.downloads.create!(name: @casting_call_interview.zip_file_name, release_type: "CastingCallInterview") - - other_downloads_in_progress = @project.downloads.unfinished_desc_order.offset(1) - - if other_downloads_in_progress.any? - in_progress_downloads_details = render_to_string "_other_pending_downloads", locals: { downloads: other_downloads_in_progress, release_type: "CastingCallInterview" }, :layout => false - ProjectsChannel.broadcast_download_generation_update(download, in_progress_downloads_details) - else - ProjectsChannel.broadcast_download_generation_update(download, I18n.t("interview_downloads.download.pending", release_type: "Casting Call Interview")) - end - - GenerateInterviewFilesZipJob.perform_later(@project, download, @casting_call_interview) - end - - private - - def set_casting_call_interview - authorize(Download) - @casting_call_interview = policy_scope(@project.casting_call_interviews).find(params[:casting_call_interview_id]) - end -end diff --git a/app/controllers/public/casting_call_interviews_controller.rb b/app/controllers/public/casting_call_interviews_controller.rb deleted file mode 100644 index 8884ea9..0000000 --- a/app/controllers/public/casting_call_interviews_controller.rb +++ /dev/null @@ -1,25 +0,0 @@ -class Public::CastingCallInterviewsController < Public::BaseController - skip_after_action :verify_authorized - before_action :set_casting_call_interview, only: [:show, :update] - - def show - end - - def update - if @casting_call_interview.update(casting_call_interview_params) - redirect_to casting_call_interview_url(token: @casting_call_interview.token), notice: t(".notice") - else - render :show - end - end - - private - - def set_casting_call_interview - @casting_call_interview = CastingCallInterview.find_by_token(params[:token]) - end - - def casting_call_interview_params - params.require(:casting_call_interview).permit(files: []) - end -end diff --git a/app/controllers/public/casting_submissions_controller.rb b/app/controllers/public/casting_submissions_controller.rb new file mode 100644 index 0000000..5b96ac1 --- /dev/null +++ b/app/controllers/public/casting_submissions_controller.rb @@ -0,0 +1,25 @@ +class Public::CastingSubmissionsController < Public::BaseController + skip_after_action :verify_authorized + before_action :set_casting_submission, only: [:show, :update] + + def show + end + + def update + if @casting_submission.update(casting_submission_params) + redirect_to casting_submission_url(token: @casting_submission.token), notice: t(".notice") + else + render :show + end + end + + private + + def set_casting_submission + @casting_submission = CastingSubmission.find_by_token(params[:token]) + end + + def casting_submission_params + params.require(:casting_submission).permit(files: []) + end +end diff --git a/app/jobs/generate_interview_files_zip_job.rb b/app/jobs/generate_casting_submission_files_zip_job.rb similarity index 69% rename from app/jobs/generate_interview_files_zip_job.rb rename to app/jobs/generate_casting_submission_files_zip_job.rb index a580427..2d8a23a 100644 --- a/app/jobs/generate_interview_files_zip_job.rb +++ b/app/jobs/generate_casting_submission_files_zip_job.rb @@ -1,4 +1,4 @@ -class GenerateInterviewFilesZipJob < ApplicationJob +class GenerateCastingSubmissionFilesZipJob < ApplicationJob queue_as :default include Rails.application.routes.url_helpers include ActionView::Helpers::UrlHelper @@ -6,12 +6,12 @@ class GenerateInterviewFilesZipJob < ApplicationJob before_perform do |job| @project = job.arguments.first @download = job.arguments.second - @casting_call_interview = job.arguments.third + @casting_submission = job.arguments.third @download.update!(status: :pending) end - def perform(project, download, casting_call_interview) - ::InterviewFilesCollectionService.new(casting_call_interview.files, @download.name).build do |dir, files| + def perform(project, download, casting_submission) + ::CastingSubmissionFilesCollectionService.new(casting_submission.files, @download.name).build do |dir, files| zipfile_name = "#{dir}/#{@download.name}.zip" Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| files.each do |attachment| @@ -24,11 +24,11 @@ class GenerateInterviewFilesZipJob < ApplicationJob rescue StandardError => e Raven.extra_context( message: "Failed to generate download for project (##{project.id})", - release_type: "CastingCallInterview" + release_type: "CastingSubmission" ) @download.failure! - ProjectsChannel.broadcast_download_generation_update(@download, I18n.t("interview_downloads.download.failure")) + ProjectsChannel.broadcast_download_generation_update(@download, I18n.t("casting_submission_downloads.download.failure")) end after_perform do |job| @@ -37,7 +37,7 @@ class GenerateInterviewFilesZipJob < ApplicationJob downloads_folder_link = link_to("Files > Downloads", project_downloads_path(I18n.locale, @project)) download_button = link_to("Download", rails_blob_path(@download.file, disposition: "attachment", only_path: true), class: "btn btn-success", target: :_blank) - ProjectsChannel.broadcast_download_generation_update(@download, I18n.t("interview_downloads.download.success", downloads_folder_link: downloads_folder_link, download_button: download_button, release_type: "Casting Call Interview")) + ProjectsChannel.broadcast_download_generation_update(@download, I18n.t("casting_submission_downloads.download.success", downloads_folder_link: downloads_folder_link, download_button: download_button, release_type: "Casting Submission")) end end end diff --git a/app/models/account.rb b/app/models/account.rb index 0a747a3..475147c 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -5,7 +5,7 @@ class Account < ApplicationRecord has_many :users, through: :account_auths has_many :projects, dependent: :destroy has_many :casting_calls, through: :projects - has_many :casting_call_interviews, through: :projects + has_many :casting_submissions, through: :projects has_many :videos, through: :projects has_many :contract_templates, through: :projects @@ -62,7 +62,7 @@ class Account < ApplicationRecord MiscRelease.where(project: projects), MatchingRequest.where(project: projects), CastingCall.where(project: projects), - self.casting_call_interviews, + self.casting_submissions, self ])).sum(:byte_size).to_f end diff --git a/app/models/casting_call.rb b/app/models/casting_call.rb index 1ae7d07..0d52873 100644 --- a/app/models/casting_call.rb +++ b/app/models/casting_call.rb @@ -1,6 +1,6 @@ class CastingCall < ApplicationRecord belongs_to :project - has_many :casting_call_interviews, dependent: :destroy + has_many :casting_submissions, dependent: :destroy has_secure_token diff --git a/app/models/casting_call_interview.rb b/app/models/casting_submission.rb similarity index 88% rename from app/models/casting_call_interview.rb rename to app/models/casting_submission.rb index 225f681..6ac4f8f 100644 --- a/app/models/casting_call_interview.rb +++ b/app/models/casting_submission.rb @@ -1,4 +1,4 @@ -class CastingCallInterview < ApplicationRecord +class CastingSubmission < ApplicationRecord belongs_to :casting_call has_many_attached :files @@ -33,6 +33,6 @@ class CastingCallInterview < ApplicationRecord private def invalid_meeting_url_message - I18n.t('casting_call_interviews.validation_errors.invalid_meeting_url') + I18n.t('casting_submissions.validation_errors.invalid_meeting_url') end end diff --git a/app/models/project.rb b/app/models/project.rb index abdeb18..9f04104 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -16,7 +16,7 @@ class Project < ApplicationRecord has_many :medical_releases, dependent: :destroy has_many :misc_releases, dependent: :destroy has_many :casting_calls, dependent: :destroy - has_many :casting_call_interviews, through: :casting_calls + has_many :casting_submissions, through: :casting_calls has_many :videos, dependent: :destroy has_many :imports, dependent: :destroy has_many :contract_templates, dependent: :destroy diff --git a/app/policies/casting_call_interview_policy.rb b/app/policies/casting_submission_policy.rb similarity index 80% rename from app/policies/casting_call_interview_policy.rb rename to app/policies/casting_submission_policy.rb index ac7a232..a634365 100644 --- a/app/policies/casting_call_interview_policy.rb +++ b/app/policies/casting_submission_policy.rb @@ -1,4 +1,4 @@ -class CastingCallInterviewPolicy < ApplicationPolicy +class CastingSubmissionPolicy < ApplicationPolicy def index? true end diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 0588520..6e77aa8 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -41,7 +41,7 @@ class ProjectPolicy < ApplicationPolicy show? end - def show_casting_call_interview_results? + def show_casting_submission_results? show? end end diff --git a/app/services/interview_files_collection_service.rb b/app/services/casting_submission_files_collection_service.rb similarity index 91% rename from app/services/interview_files_collection_service.rb rename to app/services/casting_submission_files_collection_service.rb index c99a6f8..474cfcc 100644 --- a/app/services/interview_files_collection_service.rb +++ b/app/services/casting_submission_files_collection_service.rb @@ -1,4 +1,4 @@ -class InterviewFilesCollectionService +class CastingSubmissionFilesCollectionService def initialize(files, folder_name) @files = files @folder_name = folder_name @@ -21,4 +21,4 @@ class InterviewFilesCollectionService private attr_reader :files, :folder_name -end \ No newline at end of file +end diff --git a/app/views/admin/application/_side_nav.html.erb b/app/views/admin/application/_side_nav.html.erb index 3054bf6..8bc66bf 100644 --- a/app/views/admin/application/_side_nav.html.erb +++ b/app/views/admin/application/_side_nav.html.erb @@ -11,7 +11,7 @@ <%= link_to fa_icon("tasks fw", text: "Task Requests"), [:admin, :task_requests], class: class_string("nav-link", "active" => controller_name == "task_requests") %>
  • <%= download.release_type.titleize %> (as of <%= time_ago_in_words(download.created_at) %> ago)
  • - <% elsif download.release_type == "CastingCallInterview"%> + <% elsif download.release_type == "CastingSubmission"%>
  • <%= download.release_type.titleize %> files (as of <%= time_ago_in_words(download.created_at) %> ago)
  • <% else %> diff --git a/app/views/casting_submissions/_casting_submission.html.erb b/app/views/casting_submissions/_casting_submission.html.erb new file mode 100644 index 0000000..38eff1a --- /dev/null +++ b/app/views/casting_submissions/_casting_submission.html.erb @@ -0,0 +1,27 @@ + + + <%= casting_submission.casting_call.project.account.name.titleize %> + + + <%= casting_submission.casting_call.title&.titleize %> + + + <%= casting_submission.performer_name %> + + + <%= casting_submission.interviewed_at %> + + +
    + <%= button_tag "Manage", class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %> + +
    + + diff --git a/app/views/casting_call_interviews/_file.html.erb b/app/views/casting_submissions/_file.html.erb similarity index 100% rename from app/views/casting_call_interviews/_file.html.erb rename to app/views/casting_submissions/_file.html.erb diff --git a/app/views/casting_call_interviews/index.html.erb b/app/views/casting_submissions/index.html.erb similarity index 73% rename from app/views/casting_call_interviews/index.html.erb rename to app/views/casting_submissions/index.html.erb index ef64b1e..0c0f0b1 100644 --- a/app/views/casting_call_interviews/index.html.erb +++ b/app/views/casting_submissions/index.html.erb @@ -10,8 +10,8 @@ - <% if @casting_call_interviews.any? %> - <%= render @casting_call_interviews %> + <% if @casting_submissions.any? %> + <%= render @casting_submissions %> <% else %> <%= t(".empty") %> @@ -21,6 +21,6 @@ -
    - <%= will_paginate @casting_call_interviews %> +
    + <%= will_paginate @casting_submissions %>
    diff --git a/app/views/casting_call_interviews/show.html.erb b/app/views/casting_submissions/show.html.erb similarity index 100% rename from app/views/casting_call_interviews/show.html.erb rename to app/views/casting_submissions/show.html.erb diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 96be800..e226794 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -21,9 +21,9 @@ <%= link_to t("projects.show.tasks"), [@project, :tasks], class: "text-decoration-none text-reset stretched-link" %> <% end %> <% end %> - <% if policy(Project).show_casting_call_interview_results? %> + <% if policy(Project).show_casting_submission_results? %> <%= render "folder_card" do %> - <%= link_to t("projects.show.casting_call_interviews"), [@project, :casting_call_interviews], class: "text-decoration-none text-reset stretched-link" %> + <%= link_to t("projects.show.casting_submissions"), [@project, :casting_submissions], class: "text-decoration-none text-reset stretched-link" %> <% end %> <% end %>
    diff --git a/app/views/public/casting_call_interviews/show.html.erb b/app/views/public/casting_submissions/show.html.erb similarity index 63% rename from app/views/public/casting_call_interviews/show.html.erb rename to app/views/public/casting_submissions/show.html.erb index a0baedf..687f59f 100644 --- a/app/views/public/casting_call_interviews/show.html.erb +++ b/app/views/public/casting_submissions/show.html.erb @@ -1,11 +1,11 @@
    - <%= card_header text: "Casting call interview details" %> + <%= card_header text: "Casting submission details" %>
    - <%= description_list_pair_for @casting_call_interview, :performer_name, append: ":" %> - <%= description_list_pair_for @casting_call_interview, :interview_date, append: ":" %> + <%= description_list_pair_for @casting_submission, :performer_name, append: ":" %> + <%= description_list_pair_for @casting_submission, :interview_date, append: ":" %>
    @@ -16,14 +16,14 @@
    <%= card_header text: t(".heading") %>
    - <%= errors_summary_for @casting_call_interview %> - <%= bootstrap_form_with model: @casting_call_interview, url: casting_call_interview_path(token: @casting_call_interview.token), local: true do |form| %> + <%= errors_summary_for @casting_submission %> + <%= bootstrap_form_with model: @casting_submission, url: casting_submission_path(token: @casting_submission.token), local: true do |form| %>
    <%= form.label :files %> <%= form.file_field :files, disable: true, direct_upload: true, multiple: true, id: "casting_call_interivew_files", hide_label: true %> - <% @casting_call_interview.files.each do |file| %> + <% @casting_submission.files.each do |file| %> <% unless file.persisted? %> - <%= hidden_field_tag "#{@casting_call_interview.model_name.param_key}[files][]", file.signed_id %> + <%= hidden_field_tag "#{@casting_submission.model_name.param_key}[files][]", file.signed_id %> <% end %> <% end %>
    @@ -32,8 +32,8 @@ data-accepted-files="audio/*,image/*,video/*" data-behavior="dropzone" data-file-input-id="casting_call_interivew_files" - data-existing-files="<%= mock_photos_json(@casting_call_interview.files) %>" - data-placeholder="<%= dropzone_placeholder_message_for(@casting_call_interview) %>" + data-existing-files="<%= mock_photos_json(@casting_submission.files) %>" + data-placeholder="<%= dropzone_placeholder_message_for(@casting_submission) %>" data-submit-button="#submit_folder">
    @@ -45,7 +45,7 @@
    - <%= link_to "Start Interview", @casting_call_interview.join_zoom_meeting_url, target: "_blank", class: "btn btn-primary" %> + <%= link_to "Start Interview", @casting_submission.join_zoom_meeting_url, target: "_blank", class: "btn btn-primary" %>
    diff --git a/config/locales/en.yml b/config/locales/en.yml index 6a5ece3..00cf46b 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -70,6 +70,9 @@ en: person_phone: Phone person_photo: Photo signed_on: Date + casting_call: + interview_instructions: Welcome message + interview_requirements: Goodbye message location_release: person_company: Company person_email: Email @@ -97,22 +100,22 @@ en: application: header: sign_out: Sign Out - casting_call_interviews: + casting_submissions: complete: - notice: The casting call interview has been completed + notice: The casting submission has been completed create: - notice: The casting call interview has been created + notice: The casting submission has been created index: actions: - new: Create Casting Call Interview - empty: Casting call interviews will appear here + new: Create Casting Submission + empty: Casting submissions will appear here mark_as_completed: - alert: Failed to mark casting call interview as completed - notice: The casting call interview has been marked as completed + alert: Failed to mark casting submission as completed + notice: The casting submission has been marked as completed new: - heading: New Casting Call Interview + heading: New Casting Submission update: - notice: The casting call interview has been updated + notice: The casting submission has been updated task_requests: index: empty: Task requests will appear here @@ -244,11 +247,11 @@ en: bulk_taggings: new_bulk_tag_modal: submit: Add - casting_call_interviews: + casting_submissions: index: - empty: Casting Call Interview results will appear here. + empty: Casting Submission results will appear here. show: - empty: Interview files and recorded meeetings will appear here. + empty: Casting Submission files and recorded meeetings will appear here. validation_errors: invalid_meeting_url: Zoom Meeting URL is invalid casting_calls: @@ -264,13 +267,6 @@ en: heading: Edit Casting Call form: info_message: After submitting this casting call request, you'll be connected via chat with a ME Suite representative. - labels: - description: Description - interview_instructions: Interview instructions - interview_requirements: Interview requirements - project_description: Project description - questions: Questions - title: Title index: actions: new: Create Casting Call @@ -278,11 +274,21 @@ en: table_headers: casting_call_created_on: Created On casting_call_status: Status - casting_call_title: Title + casting_call_title: Casting Title new: heading: New Casting Call update: notice: The casting call request has been updated + casting_submission_downloads: + download: + failure: Your download could not be generated. + pending: "Your %{release_type} files are being prepared for download. You will be notified when it's ready." + success: "Your %{release_type} files are ready. Download now, or retrieve later in the %{downloads_folder_link} folder. %{download_button}" + casting_submissions: + index: + empty: Casting Submission results will appear here. + show: + empty: Casting Submission files and recorded meeetings will appear here. contract_downloads: download: failure: Your download could not be generated. @@ -416,6 +422,10 @@ en: notice: The release has been updated helpers: help: + casting_call: + interview_instructions: This is the first message the chatbot, BiGGiE, will send. Please include all information and instructions you wish the person to read prior to starting the casting interview. + interview_requirements: Please enter a final message and include any post-interview instructions (for example, submitting a headshot, additional photos, videos, etc). + questions: Please list, one-by-one, all of the questions you wish the chatbot, BiGGiE, to ask the person. contract_template: fee: Leave at $0.00 for no-fee guardian_clause: Leave blank if not required for this contract @@ -474,6 +484,13 @@ en: person_last_name: Last name person_name: Name person_phone: Phone number + casting_call: + description: Casting search description + interview_instructions: Welcome message + interview_requirements: Goodbye message + project_description: Project description + questions: Questions + title: Casting search title location_release: address_city: City address_country: Country @@ -723,8 +740,8 @@ en: broadcast: create: Create Live Stream update: Save Changes - casting_call_interview: - create: Create casting call interview + casting_submission: + create: Create Casting Submission contract_template: create: Create Release Template directory: @@ -757,11 +774,6 @@ en: cards: Cards heading: Import Releases list: List - interview_downloads: - download: - failure: Your download could not be generated. - pending: "Your %{release_type} files are being prepared for download. You will be notified when it's ready." - success: "Your %{release_type} files are ready. Download now, or retrieve later in the %{downloads_folder_link} folder. %{download_button}" location_releases: create: notice: The location release has been created @@ -993,7 +1005,7 @@ en: show: acquired_media_release: Acquired Media Releases (%{count}) appearance_release: Appearance Releases (%{count}) - casting_call_interviews: Interviews + casting_submissions: Casting Submissions downloads: Downloads location_release: Location Releases (%{count}) material_release: Material Releases (%{count}) @@ -1056,7 +1068,7 @@ en: broadcasts: show: alert: That broadcast is no longer available - casting_call_interviews: + casting_submissions: show: heading: Files update: Upload diff --git a/config/locales/es.yml b/config/locales/es.yml index f352771..be1257b 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -76,7 +76,7 @@ es: share_stream: Share live stream link with clients stream_from_mobile_app: Stream from ME Suite Mobile app, or via a professional camera stream_multiple_cameras: Stream multiple cameras at one time - casting_call_interviews: + casting_submissions: validation_errors: invalid_meeting_url: Zoom Meeting URL is invalid (ES) contract_templates: @@ -275,8 +275,8 @@ es: broadcast: create: Create Live Stream (ES) update: Save Changes (ES) - casting_call_interview: - create: Create casting call interview (ES) + casting_submission: + create: Create casting submission (ES) create: 'Crear %{model}' update: 'Actualizar %{model}' location_releases: diff --git a/config/routes.rb b/config/routes.rb index 23ee4ad..1851191 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -32,7 +32,7 @@ Rails.application.routes.draw do resource :masquerade, only: :create end resources :task_requests, only: [:index, :edit, :update, :show] - resources :casting_call_interviews do + resources :casting_submissions do post :complete, on: :member end @@ -69,7 +69,7 @@ Rails.application.routes.draw do resource :contract_downloads, only: [:create] resources :downloads, only: [:index, :destroy] resource :report_downloads, only: [:create] - resource :interview_downloads, only: [:create] + resource :casting_submission_downloads, only: [:create] resources :videos, only: [:index, :new, :create, :edit, :update] do collection do get :landing @@ -115,7 +115,7 @@ Rails.application.routes.draw do end end resources :tasks, only: :index - resources :casting_call_interviews, only: [:index, :show] + resources :casting_submissions, only: [:index, :show] end resource :profile, only: [:show, :update] resources :videos, only: [] do @@ -145,7 +145,7 @@ Rails.application.routes.draw do resource :zoom_meeting, only: [:show] end resources :casting_calls, param: :token, only: [:show] - resources :casting_call_interviews, param: :token, only: [:show, :update] + resources :casting_submissions, param: :token, only: [:show, :update] end RELEASES = [:acquired_media_releases, :appearance_releases, :talent_releases, :material_releases, :location_releases] diff --git a/db/migrate/20200714175331_rename_casting_call_interviews_to_casting_submissions.rb b/db/migrate/20200714175331_rename_casting_call_interviews_to_casting_submissions.rb new file mode 100644 index 0000000..306a12a --- /dev/null +++ b/db/migrate/20200714175331_rename_casting_call_interviews_to_casting_submissions.rb @@ -0,0 +1,5 @@ +class RenameCastingCallInterviewsToCastingSubmissions < ActiveRecord::Migration[6.0] + def change + rename_table :casting_call_interviews, :casting_submissions + end +end diff --git a/db/structure.sql b/db/structure.sql index cb699b9..fcd9e16 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -331,8 +331,8 @@ CREATE TABLE public.appearance_releases ( person_last_name character varying, guardian_first_name character varying, guardian_last_name character varying, - identifier character varying, guardian_email character varying, + identifier character varying, person_address_street2 character varying, person_address_city character varying, person_address_state character varying, @@ -569,42 +569,6 @@ CREATE SEQUENCE public.broadcasts_id_seq ALTER SEQUENCE public.broadcasts_id_seq OWNED BY public.broadcasts.id; --- --- Name: casting_call_interviews; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.casting_call_interviews ( - id bigint NOT NULL, - casting_call_id bigint, - performer_name character varying, - zoom_meeting_url character varying, - interview_date timestamp without time zone, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL, - token character varying, - interviewed_at timestamp without time zone -); - - --- --- Name: casting_call_interviews_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.casting_call_interviews_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: casting_call_interviews_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.casting_call_interviews_id_seq OWNED BY public.casting_call_interviews.id; - - -- -- Name: casting_calls; Type: TABLE; Schema: public; Owner: - -- @@ -645,6 +609,42 @@ CREATE SEQUENCE public.casting_calls_id_seq ALTER SEQUENCE public.casting_calls_id_seq OWNED BY public.casting_calls.id; +-- +-- Name: casting_submissions; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.casting_submissions ( + id bigint NOT NULL, + casting_call_id bigint, + performer_name character varying, + zoom_meeting_url character varying, + interview_date timestamp without time zone, + created_at timestamp(6) without time zone NOT NULL, + updated_at timestamp(6) without time zone NOT NULL, + token character varying, + interviewed_at timestamp without time zone +); + + +-- +-- Name: casting_submissions_id_seq; Type: SEQUENCE; Schema: public; Owner: - +-- + +CREATE SEQUENCE public.casting_submissions_id_seq + START WITH 1 + INCREMENT BY 1 + NO MINVALUE + NO MAXVALUE + CACHE 1; + + +-- +-- Name: casting_submissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - +-- + +ALTER SEQUENCE public.casting_submissions_id_seq OWNED BY public.casting_submissions.id; + + -- -- Name: composers; Type: TABLE; Schema: public; Owner: - -- @@ -742,6 +742,15 @@ CREATE SEQUENCE public.contract_templates_id_seq ALTER SEQUENCE public.contract_templates_id_seq OWNED BY public.contract_templates.id; +-- +-- Name: data_migrations; Type: TABLE; Schema: public; Owner: - +-- + +CREATE TABLE public.data_migrations ( + version character varying NOT NULL +); + + -- -- Name: directories; Type: TABLE; Schema: public; Owner: - -- @@ -1483,7 +1492,6 @@ CREATE TABLE public.settings ( -- CREATE SEQUENCE public.settings_id_seq - AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1519,7 +1527,6 @@ CREATE TABLE public.taggings ( -- CREATE SEQUENCE public.taggings_id_seq - AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1550,7 +1557,6 @@ CREATE TABLE public.tags ( -- CREATE SEQUENCE public.tags_id_seq - AS integer START WITH 1 INCREMENT BY 1 NO MINVALUE @@ -1911,9 +1917,9 @@ CREATE TABLE public.zoom_meetings ( api_meeting_id character varying, created_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL, + status integer DEFAULT 0, zoom_user_id bigint, - project_id bigint, - status integer DEFAULT 0 + project_id bigint ); @@ -2053,13 +2059,6 @@ ALTER TABLE ONLY public.broadcast_recordings ALTER COLUMN id SET DEFAULT nextval ALTER TABLE ONLY public.broadcasts ALTER COLUMN id SET DEFAULT nextval('public.broadcasts_id_seq'::regclass); --- --- Name: casting_call_interviews id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.casting_call_interviews ALTER COLUMN id SET DEFAULT nextval('public.casting_call_interviews_id_seq'::regclass); - - -- -- Name: casting_calls id; Type: DEFAULT; Schema: public; Owner: - -- @@ -2067,6 +2066,13 @@ ALTER TABLE ONLY public.casting_call_interviews ALTER COLUMN id SET DEFAULT next ALTER TABLE ONLY public.casting_calls ALTER COLUMN id SET DEFAULT nextval('public.casting_calls_id_seq'::regclass); +-- +-- Name: casting_submissions id; Type: DEFAULT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.casting_submissions ALTER COLUMN id SET DEFAULT nextval('public.casting_submissions_id_seq'::regclass); + + -- -- Name: composers id; Type: DEFAULT; Schema: public; Owner: - -- @@ -2388,14 +2394,6 @@ ALTER TABLE ONLY public.broadcasts ADD CONSTRAINT broadcasts_pkey PRIMARY KEY (id); --- --- Name: casting_call_interviews casting_call_interviews_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.casting_call_interviews - ADD CONSTRAINT casting_call_interviews_pkey PRIMARY KEY (id); - - -- -- Name: casting_calls casting_calls_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2404,6 +2402,14 @@ ALTER TABLE ONLY public.casting_calls ADD CONSTRAINT casting_calls_pkey PRIMARY KEY (id); +-- +-- Name: casting_submissions casting_submissions_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.casting_submissions + ADD CONSTRAINT casting_submissions_pkey PRIMARY KEY (id); + + -- -- Name: composers composers_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2420,6 +2426,14 @@ ALTER TABLE ONLY public.contract_templates ADD CONSTRAINT contract_templates_pkey PRIMARY KEY (id); +-- +-- Name: data_migrations data_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: - +-- + +ALTER TABLE ONLY public.data_migrations + ADD CONSTRAINT data_migrations_pkey PRIMARY KEY (version); + + -- -- Name: directories directories_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -2821,20 +2835,6 @@ CREATE INDEX index_broadcasts_on_project_id ON public.broadcasts USING btree (pr CREATE UNIQUE INDEX index_broadcasts_on_token ON public.broadcasts USING btree (token); --- --- Name: index_casting_call_interviews_on_casting_call_id; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX index_casting_call_interviews_on_casting_call_id ON public.casting_call_interviews USING btree (casting_call_id); - - --- --- Name: index_casting_call_interviews_on_token; Type: INDEX; Schema: public; Owner: - --- - -CREATE UNIQUE INDEX index_casting_call_interviews_on_token ON public.casting_call_interviews USING btree (token); - - -- -- Name: index_casting_calls_on_project_id; Type: INDEX; Schema: public; Owner: - -- @@ -2849,6 +2849,20 @@ CREATE INDEX index_casting_calls_on_project_id ON public.casting_calls USING btr CREATE UNIQUE INDEX index_casting_calls_on_token ON public.casting_calls USING btree (token); +-- +-- Name: index_casting_submissions_on_casting_call_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_casting_submissions_on_casting_call_id ON public.casting_submissions USING btree (casting_call_id); + + +-- +-- Name: index_casting_submissions_on_token; Type: INDEX; Schema: public; Owner: - +-- + +CREATE UNIQUE INDEX index_casting_submissions_on_token ON public.casting_submissions USING btree (token); + + -- -- Name: index_composers_on_music_release_id; Type: INDEX; Schema: public; Owner: - -- @@ -3447,10 +3461,10 @@ ALTER TABLE ONLY public.bookmarks -- --- Name: casting_call_interviews fk_rails_1583f69fbb; Type: FK CONSTRAINT; Schema: public; Owner: - +-- Name: casting_submissions fk_rails_1583f69fbb; Type: FK CONSTRAINT; Schema: public; Owner: - -- -ALTER TABLE ONLY public.casting_call_interviews +ALTER TABLE ONLY public.casting_submissions ADD CONSTRAINT fk_rails_1583f69fbb FOREIGN KEY (casting_call_id) REFERENCES public.casting_calls(id); @@ -4063,6 +4077,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20200702152130'), ('20200706193123'), ('20200706230803'), -('20200707070522'); +('20200707070522'), +('20200714175331'); diff --git a/spec/controllers/admin/casting_call_interviews_controller_spec.rb b/spec/controllers/admin/casting_call_interviews_controller_spec.rb deleted file mode 100644 index 7a6b3ea..0000000 --- a/spec/controllers/admin/casting_call_interviews_controller_spec.rb +++ /dev/null @@ -1,124 +0,0 @@ -require "rails_helper" - -RSpec.describe Admin::CastingCallInterviewsController, type: :controller do - - let!(:current_user) { create(:user, :admin) } - - before do - sign_in(current_user) - end - - describe "#index" do - it "returns a successful response" do - get :index - - expect(response).to be_successful - end - end - - describe "#new" do - it "returns a successful response" do - get :new - - expect(response).to be_successful - end - - it "assigns user, accounts" do - get :new - - expect(assigns(:casting_call_interview)).not_to be_nil - expect(assigns(:accounts)).to eq Account.all - end - end - - describe "#create" do - it "does create a new record" do - expect { - post :create, params: { casting_call_interview: casting_call_interview_params } - }.to change(CastingCallInterview, :count) - end - - it "does not create new record if zoom meeting url is not valid" do - expect { - post :create, params: { - casting_call_interview: casting_call_interview_params - .except(:zoom_meeting_url) - .merge(zoom_meeting_url: "malformed_url") - } - }.to change(CastingCallInterview, :count).by(0) - end - end - - describe "#edit" do - let(:casting_call_interview) { create(:casting_call_interview) } - - it "returns a successful response" do - get :edit, params: { id: casting_call_interview } - - expect(response).to be_successful - end - - it "assigns casting call interview" do - get :edit, params: { id: casting_call_interview } - - expect(assigns(:casting_call_interview)).to eq casting_call_interview - end - end - - describe "#update" do - let(:casting_call_interview) { create(:casting_call_interview) } - - it "redirects to casting call interviews page" do - patch :update, params: { id: casting_call_interview, casting_call_interview: update_params } - - expect(response).to be_redirect - expect(response).to redirect_to admin_casting_call_interviews_path - end - - it "sets a flash notice" do - patch :update, params: { id: casting_call_interview, casting_call_interview: update_params } - - expect(flash.notice).to eq "The casting call interview has been updated" - end - - it "updates casting call interview" do - patch :update, params: { id: casting_call_interview, casting_call_interview: update_params } - - expect(casting_call_interview.reload.zoom_meeting_url).to eq new_zoom_meeting_url - end - end - - describe "#complete" do - let(:casting_call_interview) { create(:casting_call_interview) } - - it "sets interviewed_at on casting call interview" do - expect(casting_call_interview.interviewed_at).to be_nil - - post :complete, params: { id: casting_call_interview } - - expect(casting_call_interview.reload.interviewed_at).not_to be_nil - end - end - - private - - def casting_call_interview_params - casting_call = create(:casting_call) - - attributes_for(:casting_call_interview).except(:interviewed_at).merge(casting_call_id: casting_call.id) - end - - def update_params - { - zoom_meeting_url: new_zoom_meeting_url - } - end - - def new_zoom_meeting_url - "https://s01web.zoom.us/j/11111?pwd=Ab123Cq34" - end - - def invalid_meeting_url_flash_error - t 'casting_call_interviews.validation_errors.invalid_meeting_url' - end -end diff --git a/spec/controllers/admin/casting_submissions_controller_spec.rb b/spec/controllers/admin/casting_submissions_controller_spec.rb new file mode 100644 index 0000000..bfc684f --- /dev/null +++ b/spec/controllers/admin/casting_submissions_controller_spec.rb @@ -0,0 +1,124 @@ +require "rails_helper" + +RSpec.describe Admin::CastingSubmissionsController, type: :controller do + + let!(:current_user) { create(:user, :admin) } + + before do + sign_in(current_user) + end + + describe "#index" do + it "returns a successful response" do + get :index + + expect(response).to be_successful + end + end + + describe "#new" do + it "returns a successful response" do + get :new + + expect(response).to be_successful + end + + it "assigns user, accounts" do + get :new + + expect(assigns(:casting_submission)).not_to be_nil + expect(assigns(:accounts)).to eq Account.all + end + end + + describe "#create" do + it "does create a new record" do + expect { + post :create, params: { casting_submission: casting_submission_params } + }.to change(CastingSubmission, :count) + end + + it "does not create new record if zoom meeting url is not valid" do + expect { + post :create, params: { + casting_submission: casting_submission_params + .except(:zoom_meeting_url) + .merge(zoom_meeting_url: "malformed_url") + } + }.to change(CastingSubmission, :count).by(0) + end + end + + describe "#edit" do + let(:casting_submission) { create(:casting_submission) } + + it "returns a successful response" do + get :edit, params: { id: casting_submission } + + expect(response).to be_successful + end + + it "assigns casting submission" do + get :edit, params: { id: casting_submission } + + expect(assigns(:casting_submission)).to eq casting_submission + end + end + + describe "#update" do + let(:casting_submission) { create(:casting_submission) } + + it "redirects to casting submissions page" do + patch :update, params: { id: casting_submission, casting_submission: update_params } + + expect(response).to be_redirect + expect(response).to redirect_to admin_casting_submissions_path + end + + it "sets a flash notice" do + patch :update, params: { id: casting_submission, casting_submission: update_params } + + expect(flash.notice).to eq "The casting submission has been updated" + end + + it "updates casting submission" do + patch :update, params: { id: casting_submission, casting_submission: update_params } + + expect(casting_submission.reload.zoom_meeting_url).to eq new_zoom_meeting_url + end + end + + describe "#complete" do + let(:casting_submission) { create(:casting_submission) } + + it "sets interviewed_at on casting submission" do + expect(casting_submission.interviewed_at).to be_nil + + post :complete, params: { id: casting_submission } + + expect(casting_submission.reload.interviewed_at).not_to be_nil + end + end + + private + + def casting_submission_params + casting_call = create(:casting_call) + + attributes_for(:casting_submission).except(:interviewed_at).merge(casting_call_id: casting_call.id) + end + + def update_params + { + zoom_meeting_url: new_zoom_meeting_url + } + end + + def new_zoom_meeting_url + "https://s01web.zoom.us/j/11111?pwd=Ab123Cq34" + end + + def invalid_meeting_url_flash_error + t 'casting_submissions.validation_errors.invalid_meeting_url' + end +end diff --git a/spec/controllers/interview_downloads_controller_spec.rb b/spec/controllers/casting_submission_downloads_controller_spec.rb similarity index 63% rename from spec/controllers/interview_downloads_controller_spec.rb rename to spec/controllers/casting_submission_downloads_controller_spec.rb index 119250f..8c8eadf 100644 --- a/spec/controllers/interview_downloads_controller_spec.rb +++ b/spec/controllers/casting_submission_downloads_controller_spec.rb @@ -1,12 +1,12 @@ require "rails_helper" -RSpec.describe InterviewDownloadsController, type: :controller do +RSpec.describe CastingSubmissionDownloadsController, type: :controller do render_views let(:current_user) { create(:user) } let(:project) { create(:project, :discovery_client, account: current_user.primary_account) } let(:casting_call) { create(:casting_call, project: project, title: "My Title") } - let(:casting_call_interview) { create(:casting_call_interview, casting_call: casting_call, performer_name: "John Doe") } + let(:casting_submission) { create(:casting_submission, casting_call: casting_call, performer_name: "John Doe") } before do sign_in current_user @@ -15,13 +15,13 @@ RSpec.describe InterviewDownloadsController, type: :controller do describe "#create" do it "enqueues zip file generation job" do expect { - post :create, params: { project_id: project.id, casting_call_interview_id: casting_call_interview.id }, format: :js - }.to have_enqueued_job(GenerateInterviewFilesZipJob) + post :create, params: { project_id: project.id, casting_submission_id: casting_submission.id }, format: :js + }.to have_enqueued_job(GenerateCastingSubmissionFilesZipJob) end it "creates a download record with 'not_started' status" do expect { - post :create, params: { project_id: project.id, casting_call_interview_id: casting_call_interview.id }, format: :js + post :create, params: { project_id: project.id, casting_submission_id: casting_submission.id }, format: :js }.to change(Download, :count).by(1) expect(Download.last.status).to eq('not_started') @@ -29,11 +29,11 @@ RSpec.describe InterviewDownloadsController, type: :controller do context "When there is no existing job" do it "shows a notification to user" do - allow(ProjectsChannel).to receive(:broadcast_download_generation_update).with(be_kind_of(Download), I18n.t("interview_downloads.download.pending", release_type: "Casting Call Interview")) + allow(ProjectsChannel).to receive(:broadcast_download_generation_update).with(be_kind_of(Download), I18n.t("casting_submission_downloads.download.pending", release_type: "CastingSubmission")) - post :create, params: { project_id: project.id, casting_call_interview_id: casting_call_interview.id }, format: :js + post :create, params: { project_id: project.id, casting_submission_id: casting_submission.id }, format: :js - expect(ProjectsChannel).to have_received(:broadcast_download_generation_update).with(be_kind_of(Download), I18n.t("interview_downloads.download.pending", release_type: "Casting Call Interview")) + expect(ProjectsChannel).to have_received(:broadcast_download_generation_update).with(be_kind_of(Download), I18n.t("casting_submission_downloads.download.pending", release_type: "CastingSubmission")) end end @@ -47,9 +47,9 @@ RSpec.describe InterviewDownloadsController, type: :controller do end it "shows names of other contracts in the notification, which are in progress" do - broadcast_message = "

    Your Casting Call Interview files are being prepared for download. You will be notified when it's ready.\n

    \n

    The following downloads are also in progress:

    \n\n" + broadcast_message = "

    Your Casting Submission files are being prepared for download. You will be notified when it's ready.\n

    \n

    The following downloads are also in progress:

    \n\n" - post :create, params: { project_id: project.id, casting_call_interview_id: casting_call_interview.id }, format: :js + post :create, params: { project_id: project.id, casting_submission_id: casting_submission.id }, format: :js expect(ProjectsChannel).to have_received(:broadcast_download_generation_update).with(be_kind_of(Download), broadcast_message) end diff --git a/spec/controllers/casting_call_interviews_controller_spec.rb b/spec/controllers/casting_submissions_controller_spec.rb similarity index 55% rename from spec/controllers/casting_call_interviews_controller_spec.rb rename to spec/controllers/casting_submissions_controller_spec.rb index 2ac60aa..4d71040 100644 --- a/spec/controllers/casting_call_interviews_controller_spec.rb +++ b/spec/controllers/casting_submissions_controller_spec.rb @@ -1,6 +1,6 @@ require "rails_helper" -RSpec.describe CastingCallInterviewsController, type: :controller do +RSpec.describe CastingSubmissionsController, type: :controller do render_views let(:user) { create(:user) } @@ -19,9 +19,9 @@ RSpec.describe CastingCallInterviewsController, type: :controller do expect(response).to be_successful end - it "only shows completed interviews" do - create(:casting_call_interview, casting_call: casting_call, interviewed_at: Time.zone.now, performer_name: "John Doe") - create(:casting_call_interview, casting_call: casting_call, interviewed_at: nil, performer_name: "Jane Doe") + it "only shows completed submissions" do + create(:casting_submission, casting_call: casting_call, interviewed_at: Time.zone.now, performer_name: "John Doe") + create(:casting_submission, casting_call: casting_call, interviewed_at: nil, performer_name: "Jane Doe") get :index, params: { project_id: project } @@ -31,10 +31,10 @@ RSpec.describe CastingCallInterviewsController, type: :controller do end describe "#show" do - let!(:casting_call_interview) { create(:casting_call_interview, :with_files, casting_call: casting_call, interviewed_at: Time.zone.now, performer_name: "Jane Doe") } + let!(:casting_submission) { create(:casting_submission, :with_files, casting_call: casting_call, interviewed_at: Time.zone.now, performer_name: "Jane Doe") } - it "shows files of casting call interview" do - get :show, params: { project_id: project, id: casting_call_interview.id } + it "shows files of casting submission" do + get :show, params: { project_id: project, id: casting_submission.id } expect(response.body).to have_content("Filename") expect(response.body).to have_content("location_photo.png") diff --git a/spec/controllers/public/casting_call_interviews_controller.rb b/spec/controllers/public/casting_call_interviews_controller.rb deleted file mode 100644 index fb08c74..0000000 --- a/spec/controllers/public/casting_call_interviews_controller.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'rails_helper' - -RSpec.describe Public::CastingCallInterviewsController, type: :controller do - render_views - - describe "#show" do - let(:casting_call_interview) { create(:casting_call_interview) } - - it "responds successfully" do - get :show, params: { token: casting_call_interview.token } - - expect(response).to be_successful - expect(assigns(:casting_call_interview)).to eq(casting_call_interview) - end - - it "shows casting call interview details" do - get :show, params: { token: casting_call_interview.token } - - expect(response.body).to have_content(casting_call_interview.performer_name) - expect(response.body).to have_content(casting_call_interview.interview_date) - expect(response.body).to have_link("Start Interview") - end - end - - describe "#update" do - let(:casting_call_interview) { create(:casting_call_interview) } - - it "responds successfully" do - patch :update, params: { token: casting_call_interview.token, casting_call_interview: casting_call_interview_params } - - expect(response).to redirect_to casting_call_interview_url(token: casting_call_interview.token) - expect(flash.notice).to be_present - end - end - - private - - def casting_call_interview_params - path = Rails.root.join("spec", "fixtures", "files", "contract.pdf") - file = Rack::Test::UploadedFile.new(path, "application/pdf") - - { files: [file]} - end -end diff --git a/spec/controllers/public/casting_submissions_controller.rb b/spec/controllers/public/casting_submissions_controller.rb new file mode 100644 index 0000000..763886e --- /dev/null +++ b/spec/controllers/public/casting_submissions_controller.rb @@ -0,0 +1,44 @@ +require 'rails_helper' + +RSpec.describe Public::CastingSubmissionsController, type: :controller do + render_views + + describe "#show" do + let(:casting_submission) { create(:casting_submission) } + + it "responds successfully" do + get :show, params: { token: casting_submission.token } + + expect(response).to be_successful + expect(assigns(:casting_submission)).to eq(casting_submission) + end + + it "shows casting call interview details" do + get :show, params: { token: casting_submission.token } + + expect(response.body).to have_content(casting_submission.performer_name) + expect(response.body).to have_content(casting_submission.interview_date) + expect(response.body).to have_link("Start Interview") + end + end + + describe "#update" do + let(:casting_submission) { create(:casting_submission) } + + it "responds successfully" do + patch :update, params: { token: casting_submission.token, casting_submission: casting_submission_params } + + expect(response).to redirect_to casting_submission_url(token: casting_submission.token) + expect(flash.notice).to be_present + end + end + + private + + def casting_submission_params + path = Rails.root.join("spec", "fixtures", "files", "contract.pdf") + file = Rack::Test::UploadedFile.new(path, "application/pdf") + + { files: [file]} + end +end diff --git a/spec/factories/casting_call_interviews.rb b/spec/factories/casting_submissions.rb similarity index 91% rename from spec/factories/casting_call_interviews.rb rename to spec/factories/casting_submissions.rb index 389bd9d..a5b729f 100644 --- a/spec/factories/casting_call_interviews.rb +++ b/spec/factories/casting_submissions.rb @@ -1,5 +1,5 @@ FactoryBot.define do - factory :casting_call_interview do + factory :casting_submission do association :casting_call performer_name 'John Doe' zoom_meeting_url 'https://us04web.zoom.us/j/1111111111?pwd=aDZCS1dzZ2lWdDZJcHBhVnNIclB4QT03' diff --git a/spec/features/admin_managing_casting_call_interviews_spec.rb b/spec/features/admin_managing_casting_call_interviews_spec.rb deleted file mode 100644 index 4514543..0000000 --- a/spec/features/admin_managing_casting_call_interviews_spec.rb +++ /dev/null @@ -1,71 +0,0 @@ -require "rails_helper" - -feature "Admin managing casting call interviews" do - let(:current_user) { create(:user, admin: true, email: "user@test.com") } - let(:project) { create(:project, account: current_user.primary_account, name: "Test Project") } - - before do - sign_in current_user - end - - scenario "admin cannot create casting call interview with invalid zoom url", js: true do - visit admin_casting_call_interviews_path - cc = create(:casting_call, title: "SpecialCastingCall") - - click_link create_casting_call_interview_button - expect(page).to have_content new_casting_call_interview_heading - - fill_in performer_name_field, with: "TestName" - select cc.title, from: casting_call_field - fill_in zoom_meeting_url_field, with: "malformed url" - - expect do - click_on submit_casting_call_interview_form - end.to change(CastingCallInterview, :count).by(0) - expect(page).to have_content zoom_meeting_url_invalid_error - - fill_in zoom_meeting_url_field, with: "https://similar.google.com/j/24324324?pwd=334kni3j4" - - expect do - click_on submit_casting_call_interview_form - end.to change(CastingCallInterview, :count).by(0) - expect(page).to have_content zoom_meeting_url_invalid_error - - fill_in zoom_meeting_url_field, with: "https://s01.zoom.us/j/343434?pwd=dawidj34ijij" - - expect do - click_on submit_casting_call_interview_form - end.to change(CastingCallInterview, :count).by(1) - expect(page).to have_content create_casting_call_interview_button - end - - private - - def create_casting_call_interview_button - t 'admin.casting_call_interviews.index.actions.new' - end - - def new_casting_call_interview_heading - t 'admin.casting_call_interviews.new.heading' - end - - def submit_casting_call_interview_form - t 'helpers.submit.casting_call_interview.create' - end - - def zoom_meeting_url_invalid_error - t 'casting_call_interviews.validation_errors.invalid_meeting_url' - end - - def performer_name_field - 'casting_call_interview[performer_name]' - end - - def zoom_meeting_url_field - 'casting_call_interview[zoom_meeting_url]' - end - - def casting_call_field - 'casting_call_interview[casting_call_id]' - end -end diff --git a/spec/features/admin_managing_casting_submissions_spec.rb b/spec/features/admin_managing_casting_submissions_spec.rb new file mode 100644 index 0000000..5e963b0 --- /dev/null +++ b/spec/features/admin_managing_casting_submissions_spec.rb @@ -0,0 +1,71 @@ +require "rails_helper" + +feature "Admin managing casting submissions" do + let(:current_user) { create(:user, admin: true, email: "user@test.com") } + let(:project) { create(:project, account: current_user.primary_account, name: "Test Project") } + + before do + sign_in current_user + end + + scenario "admin cannot create casting submission with invalid zoom url", js: true do + visit admin_casting_submissions_path + cc = create(:casting_call, title: "SpecialCastingCall") + + click_link create_casting_submission_button + expect(page).to have_content new_casting_submission_heading + + fill_in performer_name_field, with: "TestName" + select cc.title, from: casting_call_field + fill_in zoom_meeting_url_field, with: "malformed url" + + expect do + click_on submit_casting_submission_form + end.to change(CastingSubmission, :count).by(0) + expect(page).to have_content zoom_meeting_url_invalid_error + + fill_in zoom_meeting_url_field, with: "https://similar.google.com/j/24324324?pwd=334kni3j4" + + expect do + click_on submit_casting_submission_form + end.to change(CastingSubmission, :count).by(0) + expect(page).to have_content zoom_meeting_url_invalid_error + + fill_in zoom_meeting_url_field, with: "https://s01.zoom.us/j/343434?pwd=dawidj34ijij" + + expect do + click_on submit_casting_submission_form + end.to change(CastingSubmission, :count).by(1) + expect(page).to have_content create_casting_submission_button + end + + private + + def create_casting_submission_button + t 'admin.casting_submissions.index.actions.new' + end + + def new_casting_submission_heading + t 'admin.casting_submissions.new.heading' + end + + def submit_casting_submission_form + t 'helpers.submit.casting_submission.create' + end + + def zoom_meeting_url_invalid_error + t 'casting_submissions.validation_errors.invalid_meeting_url' + end + + def performer_name_field + 'casting_submission[performer_name]' + end + + def zoom_meeting_url_field + 'casting_submission[zoom_meeting_url]' + end + + def casting_call_field + 'casting_submission[casting_call_id]' + end +end diff --git a/spec/features/user_managing_casiting_calls_spec.rb b/spec/features/user_managing_casting_calls_spec.rb similarity index 84% rename from spec/features/user_managing_casiting_calls_spec.rb rename to spec/features/user_managing_casting_calls_spec.rb index cd6593d..f42f125 100644 --- a/spec/features/user_managing_casiting_calls_spec.rb +++ b/spec/features/user_managing_casting_calls_spec.rb @@ -38,11 +38,11 @@ feature "User managing casting calls" do expect(page).to have_content no_casting_calls_label click_on add_new_casting_call_label - fill_in title_field, with: "Title" + fill_in title_field, with: "Casting Title" fill_in description_field, with: "Description" fill_in project_description_field, with: "Project Description" - fill_in interview_instructions_field, with: "Interview instructions" - fill_in interview_requirements_field, with: "Interview requirements" + fill_in interview_instructions_field, with: "Welcome Message" + fill_in interview_requirements_field, with: "Goodbye Message" fill_in questions_field, with: "Questions" click_on "Create Casting call" @@ -89,26 +89,26 @@ feature "User managing casting calls" do end def title_field - t "casting_calls.form.labels.title" + t "helpers.label.casting_call.title" end def description_field - t "casting_calls.form.labels.description" + t "helpers.label.casting_call.description" end def project_description_field - t "casting_calls.form.labels.project_description" + t "helpers.label.casting_call.project_description" end def interview_instructions_field - t "casting_calls.form.labels.interview_instructions" + t "helpers.label.casting_call.interview_instructions" end def interview_requirements_field - t "casting_calls.form.labels.interview_requirements" + t "helpers.label.casting_call.interview_requirements" end def questions_field - t "casting_calls.form.labels.questions" + t "helpers.label.casting_call.questions" end -end \ No newline at end of file +end diff --git a/spec/jobs/generate_interview_files_zip_job_spec.rb b/spec/jobs/generate_casting_submission_files_zip_job_spec.rb similarity index 56% rename from spec/jobs/generate_interview_files_zip_job_spec.rb rename to spec/jobs/generate_casting_submission_files_zip_job_spec.rb index 0cb9eb4..d6eabf7 100644 --- a/spec/jobs/generate_interview_files_zip_job_spec.rb +++ b/spec/jobs/generate_casting_submission_files_zip_job_spec.rb @@ -1,52 +1,52 @@ require "rails_helper" -describe GenerateInterviewFilesZipJob do +describe GenerateCastingSubmissionFilesZipJob do let(:project) { create(:project) } - let(:download) { create(:download, project: project, release_type: "CastingCallInterview", name: "my-title_john-doe") } + let(:download) { create(:download, project: project, release_type: "CastingSubmission", name: "my-title_john-doe") } let(:casting_call) { create(:casting_call, project: project, title: "My Title") } - let(:casting_call_interview) { create(:casting_call_interview, casting_call: casting_call, performer_name: "John Doe") } + let(:casting_submission) { create(:casting_submission, casting_call: casting_call, performer_name: "John Doe") } before do dir = Rails.root.join("spec", "fixtures", "files") files = ["contract.pdf", "AppearanceRelease.pdf"] # Attachments in the test environment do not persist to cloud storage # Therefore we want to stub calls to `open` with a cloud storage URL - allow_any_instance_of(InterviewFilesCollectionService).to receive(:open).and_return(StringIO.new("file data")) - allow_any_instance_of(InterviewFilesCollectionService).to receive(:build).and_yield(dir, files) + allow_any_instance_of(CastingSubmissionFilesCollectionService).to receive(:open).and_return(StringIO.new("file data")) + allow_any_instance_of(CastingSubmissionFilesCollectionService).to receive(:build).and_yield(dir, files) end describe ".perform_later" do it "enqueues a background job for generating zip file" do expect { - GenerateInterviewFilesZipJob.perform_later(project, download, casting_call_interview) + GenerateCastingSubmissionFilesZipJob.perform_later(project, download, casting_submission) }.to have_enqueued_job end end describe ".perform_now" do it "updates a download record and creates attachment for it" do - GenerateInterviewFilesZipJob.perform_now(project, download, casting_call_interview) + GenerateCastingSubmissionFilesZipJob.perform_now(project, download, casting_submission) expect(download.project).to eq project - expect(download.release_type).to eq "CastingCallInterview" + expect(download.release_type).to eq "CastingSubmission" expect(download.name).to eq "my-title_john-doe" expect(download.status).to eq "success" expect(download.file).to be_attached end context "When there are errors" do - let(:error) { StandardError.new("Casting Call Interview files not found.") } + let(:error) { StandardError.new("Casting Submission files not found.") } before do - allow(ProjectsChannel).to receive(:broadcast_download_generation_update).with(download, I18n.t("interview_downloads.download.failure")) - allow_any_instance_of(InterviewFilesCollectionService).to receive(:build).and_raise(StandardError, "Casting Call Interview files not found.") + allow(ProjectsChannel).to receive(:broadcast_download_generation_update).with(download, I18n.t("casting_submission_downloads.download.failure")) + allow_any_instance_of(CastingSubmissionFilesCollectionService).to receive(:build).and_raise(StandardError, "Casting Submission files not found.") end it "updates status to 'failure' and sends user a notification" do - GenerateInterviewFilesZipJob.perform_now(project, download, casting_call_interview) + GenerateCastingSubmissionFilesZipJob.perform_now(project, download, casting_submission) expect(download.status).to eq "failure" - expect(ProjectsChannel).to have_received(:broadcast_download_generation_update).with(download, I18n.t("interview_downloads.download.failure")) + expect(ProjectsChannel).to have_received(:broadcast_download_generation_update).with(download, I18n.t("casting_submission_downloads.download.failure")) end end end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index d0638bc..77c64f5 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -137,7 +137,7 @@ RSpec.describe Account do MatchingRequest, ActionMailbox::InboundEmail, # This is Rails model, we are not using it and it is NOT added to the Account#storage_total calculation CastingCall, - CastingCallInterview + CastingSubmission ] Rails.application.eager_load! ActiveRecord::Base.descendants.each do |model| diff --git a/spec/models/casting_call_interview_spec.rb b/spec/models/casting_submission_spec.rb similarity index 73% rename from spec/models/casting_call_interview_spec.rb rename to spec/models/casting_submission_spec.rb index 624792b..947f020 100644 --- a/spec/models/casting_call_interview_spec.rb +++ b/spec/models/casting_submission_spec.rb @@ -1,7 +1,8 @@ require 'rails_helper' -RSpec.describe CastingCallInterview, type: :model do - subject { build(:casting_call_interview) } +RSpec.describe CastingSubmission, type: :model do + subject { build(:casting_submission) } + describe "associations" do it { is_expected.to belong_to(:casting_call) } it { is_expected.to have_secure_token(:token) }