Compare commits

..

5 Commits

12 changed files with 27 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
class Admin::TaskRequestsController < Admin::ApplicationController class Admin::TaskRequestsController < Admin::ApplicationController
before_action :set_task_request, only: [:edit, :update, :show] before_action :set_task_request, only: [:edit, :update]
def index def index
@task_requests = task_requests.order_by_recent.paginate(page: params[:page]) @task_requests = task_requests.order_by_recent.paginate(page: params[:page])

View File

@@ -68,7 +68,8 @@ class LocationReleasesController < ApplicationController
:territory_id, :territory_text, :territory_id, :territory_text,
:term_id, :term_text, :term_id, :term_text,
:restriction_id, :restriction_text, :restriction_id, :restriction_text,
:filming_started_on, :filming_ended_on :filming_started_on, :filming_ended_on,
:filming_hours
) )
end end

View File

@@ -63,7 +63,8 @@ class Public::LocationReleasesController < Public::BaseController
:person_address_zip, :person_address_zip,
:person_address_country, :person_address_country,
:signature_base64, :signature_base64,
:locale, :contract_template, :filming_started_on, :filming_ended_on :locale, :contract_template, :filming_started_on, :filming_ended_on,
:filming_hours
) )
end end

View File

@@ -18,7 +18,6 @@
<div class="btn-group"> <div class="btn-group">
<%= button_tag "Manage", class: "btn btn-light btn-sm dropdown-toggle border", data: { toggle: "dropdown", boundary: "window" }, aria: { haspopup: true, expanded: false } %> <%= button_tag "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">
<%= link_to fa_icon("tasks", text: "View"), [:admin, task_request], class: "dropdown-item", target: '_blank' %>
<%= link_to fa_icon("pencil", text: "Edit"), [:edit, :admin, task_request], class: "dropdown-item" %> <%= link_to fa_icon("pencil", text: "Edit"), [:edit, :admin, task_request], class: "dropdown-item" %>
</div> </div>
</div> </div>

View File

@@ -1,18 +0,0 @@
<dl>
<%= description_list_pair_for @task_request, :description, append: ":" %>
<%= description_list_pair_for @task_request, :created_at, append: ":" %>
<%= description_list_pair_for @task_request, :deadline, append: ":" %>
<%= description_list_pair_for @task_request, :time_allowed, append: ":" %>
<%= description_list_pair_for @task_request, :additional_notes, append: ":" %>
<%= description_list_pair_for @task_request, :status, append: ":" %>
<dt>Files:</dt>
<dd>
<% if @task_request.files.present? %>
<% @task_request.files.each do |file| %>
<%= link_to file.filename, rails_blob_path(file, disposition: 'attachment'), class: "btn btn-link" %><br/>
<% end %>
<% else %>
No files attached
<% end %>
</dd>
</dl>

View File

@@ -29,6 +29,7 @@
<% if releasable.model_name == "LocationRelease" %> <% if releasable.model_name == "LocationRelease" %>
<%= description_list_pair "Filming Started On:", releasable&.filming_started_on&.strftime("%D") %> <%= description_list_pair "Filming Started On:", releasable&.filming_started_on&.strftime("%D") %>
<%= description_list_pair "Filming Ended On:", releasable&.filming_ended_on&.strftime("%D") %> <%= description_list_pair "Filming Ended On:", releasable&.filming_ended_on&.strftime("%D") %>
<%= description_list_pair "Filming Hours:", releasable&.filming_hours %>
<% end %> <% end %>
<% if contract_template.fee? %> <% if contract_template.fee? %>
<%= description_list_pair "Fee:", number_to_currency(contract_template.fee) %> <%= description_list_pair "Fee:", number_to_currency(contract_template.fee) %>

View File

@@ -39,6 +39,9 @@
<%= form.text_field :filming_started_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %> <%= form.text_field :filming_started_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
<%= form.text_field :filming_ended_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %> <%= form.text_field :filming_ended_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
</div> </div>
<div class="form-row">
<%= form.text_field :filming_hours, wrapper_class: "col-sm-12" %>
</div>
<% end %> <% end %>
<hr> <hr>

View File

@@ -46,6 +46,9 @@
<%= form.text_field :filming_started_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %> <%= form.text_field :filming_started_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
<%= form.text_field :filming_ended_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %> <%= form.text_field :filming_ended_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
</div> </div>
<div class="form-row">
<%= form.text_field :filming_hours, wrapper_class: "col-sm-12" %>
</div>
<% end %> <% end %>
<%= card_field_set_tag t(".signature.heading") do %> <%= card_field_set_tag t(".signature.heading") do %>

View File

@@ -31,7 +31,7 @@ Rails.application.routes.draw do
resources :users, only: [:index, :new, :create, :edit, :update, :destroy] do resources :users, only: [:index, :new, :create, :edit, :update, :destroy] do
resource :masquerade, only: :create resource :masquerade, only: :create
end end
resources :task_requests, only: [:index, :edit, :update, :show] resources :task_requests, only: [:index, :edit, :update]
root to: "accounts#index", as: :signed_in_root root to: "accounts#index", as: :signed_in_root
end end

View File

@@ -0,0 +1,5 @@
class AddFilmingHoursToLocationReleases < ActiveRecord::Migration[6.0]
def change
add_column :location_releases, :filming_hours, :text, default: ''
end
end

View File

@@ -1,61 +0,0 @@
require "rails_helper"
feature "Admin managing task requests" 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 should see View action for task request in Manage dropdown", js: true do
create(:task_request)
visit admin_task_requests_path
click_on 'Manage'
expect(page).to have_content 'View'
end
scenario "admin can open detail view of task request", js: true do
task_request = create(:task_request, :with_files)
visit admin_task_requests_path
click_on 'Manage'
click_link 'View'
switch_to_window(windows.last)
expect(page).to have_content 'Description'
expect(page).to have_content task_request.description
expect(page).to have_content 'Created At'
expect(page).to have_content task_request.created_at
expect(page).to have_content 'Deadline'
expect(page).to have_content task_request.deadline
expect(page).to have_content 'Time Allowed'
expect(page).to have_content task_request.time_allowed
expect(page).to have_content 'Additional Notes'
expect(page).to have_content task_request.additional_notes
expect(page).to have_content 'Status'
expect(page).to have_content task_request.status
expect(page).to have_content 'Files'
task_request.files.each do |file|
expect(page).to have_link file.blob.filename
end
end
scenario "no files attached label is shown if there are no files attached to the task request", js:true do
create(:task_request)
visit admin_task_requests_path
click_on 'Manage'
click_link 'View'
switch_to_window(windows.last)
expect(page).to have_content 'No files attached'
end
end

View File

@@ -17,6 +17,7 @@ feature "User managing location releases" do
fill_in person_phone_field, with: "555-555-5555" fill_in person_phone_field, with: "555-555-5555"
fill_in person_email_field, with: "jane.doe@test.com" fill_in person_email_field, with: "jane.doe@test.com"
fill_in person_address_street1_field, with: "100 Broadway" 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" draw_signature file_fixture("signature.png"), "location_release_signature_base64"
end end
@@ -51,6 +52,7 @@ feature "User managing location releases" do
by "filling out the remaining information" do by "filling out the remaining information" do
fill_in_release_fields name: "Test Location Release" fill_in_release_fields name: "Test Location Release"
fill_in filming_hours_field, with: "04:00 - 22:00"
click_button create_release_button click_button create_release_button
expect(page).to have_content(create_release_notice) expect(page).to have_content(create_release_notice)
expect(page).to have_photo("location_photo.png") expect(page).to have_photo("location_photo.png")
@@ -136,6 +138,7 @@ feature "User managing location releases" do
:native, :native,
project: project, project: project,
name: "Benny's Burritos", name: "Benny's Burritos",
filming_hours: "06:00 - 20:00",
tag_list: "Restaurant", tag_list: "Restaurant",
notes: [ notes: [
build(:note, build(:note,
@@ -172,6 +175,8 @@ feature "User managing location releases" do
expect(pdf_body).to have_content("Restaurant") expect(pdf_body).to have_content("Restaurant")
expect(pdf_body).to have_content photos_heading.upcase expect(pdf_body).to have_content photos_heading.upcase
expect(pdf_body).to have_content("location_photo.png") expect(pdf_body).to have_content("location_photo.png")
expect(pdf_body).to have_content("Filming Hours")
expect(pdf_body).to have_content("06:00 - 20:00")
end end
context "when the user is associate" do context "when the user is associate" do
@@ -222,6 +227,10 @@ feature "User managing location releases" do
"location_release[person_phone]" "location_release[person_phone]"
end end
def filming_hours_field
"location_release[filming_hours]"
end
def have_photo(filename, attr: "src") def have_photo(filename, attr: "src")
have_selector("img[#{attr}*='#{filename}']") have_selector("img[#{attr}*='#{filename}']")
end end