diff --git a/app/controllers/task_requests_controller.rb b/app/controllers/task_requests_controller.rb
index c34964a..e319b18 100644
--- a/app/controllers/task_requests_controller.rb
+++ b/app/controllers/task_requests_controller.rb
@@ -13,7 +13,7 @@ class TaskRequestsController < ApplicationController
end
def create
- @task_request.attributes = task_request_params
+ @task_request.attributes = task_request_params_with_email
if @task_request.save
log_create_analytics
@@ -48,6 +48,10 @@ class TaskRequestsController < ApplicationController
params.require(:task_request).permit(:description, :deadline, :time_allowed, :additional_notes, files: [])
end
+ def task_request_params_with_email
+ task_request_params.merge(user_email: Current.user.email)
+ end
+
def set_project
@project = policy_scope(Project).find(params[:project_id])
end
diff --git a/app/helpers/description_list_helper.rb b/app/helpers/description_list_helper.rb
index 23f94e9..e6f8c66 100644
--- a/app/helpers/description_list_helper.rb
+++ b/app/helpers/description_list_helper.rb
@@ -7,8 +7,8 @@ module DescriptionListHelper
safe_join(tags)
end
- def description_list_pair_for(record, attribute, append: nil)
- term = translation_for(record, attribute)
+ def description_list_pair_for(record, attribute, append: nil, custom_label: nil)
+ term = custom_label.nil? ? translation_for(record, attribute) : custom_label
definition = record.send(attribute)
description_list_pair(term, definition, append: append)
diff --git a/app/helpers/dropzone_helper.rb b/app/helpers/dropzone_helper.rb
index 42dac83..60d2d4d 100644
--- a/app/helpers/dropzone_helper.rb
+++ b/app/helpers/dropzone_helper.rb
@@ -7,6 +7,8 @@ module DropzoneHelper
"To Add Audio Files to the release:
Drag & Drop Files
or
Click or Tap here to browse files"
when "directory"
"To Add Files to the Folder:
Drag & Drop Files
or
Click or Tap here to browse files"
+ when "task_request"
+ "To Add Files for the Task:
Drag & Drop Files
or
Click or Tap here to browse files"
else
"To Add Photos to the release:
Drag & Drop Files
or
Click or Tap here to browse photos and connect to Camera"
end
diff --git a/app/views/admin/task_requests/_form.html.erb b/app/views/admin/task_requests/_form.html.erb
index 34dde41..e8601fd 100644
--- a/app/views/admin/task_requests/_form.html.erb
+++ b/app/views/admin/task_requests/_form.html.erb
@@ -1,7 +1,7 @@
<%= errors_summary_for task_request %>
<%= bootstrap_form_with model: model, local: true do |form| %>
- <%= form.select :status, options_for_select(TaskRequest.statuses.except(:cancelled).keys, task_request.status), { class: "form-control" } %>
+ <%= form.select :status, options_for_select(TaskRequest.statuses.except(:cancelled).keys, task_request.status), {}, class: "form-control custom-select" %>
<%= form.text_field :deliverable_url %>
diff --git a/app/views/admin/task_requests/show.html.erb b/app/views/admin/task_requests/show.html.erb
index 147cb1c..163de81 100644
--- a/app/views/admin/task_requests/show.html.erb
+++ b/app/views/admin/task_requests/show.html.erb
@@ -1,6 +1,9 @@
+ <%= description_list_pair_for @task_request.project.account, :name, custom_label: "Account Name", append: ":" %>
+ <%= description_list_pair_for @task_request.project, :name, custom_label: "Project Name", append: ":" %>
<%= description_list_pair_for @task_request, :description, append: ":" %>
<%= description_list_pair_for @task_request, :created_at, append: ":" %>
+ <%= description_list_pair_for @task_request, :user_email, 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: ":" %>
diff --git a/app/views/application/_sidebar.html.erb b/app/views/application/_sidebar.html.erb
index ad6e63e..df75cad 100644
--- a/app/views/application/_sidebar.html.erb
+++ b/app/views/application/_sidebar.html.erb
@@ -11,6 +11,12 @@
diff --git a/app/views/task_requests/_form.html.erb b/app/views/task_requests/_form.html.erb
index 22d0464..56e796f 100644
--- a/app/views/task_requests/_form.html.erb
+++ b/app/views/task_requests/_form.html.erb
@@ -1,11 +1,11 @@
<%= errors_summary_for task_request %>
<%= bootstrap_form_with model: model, local: true do |form| %>
- <%= form.text_area :description %>
- <%= form.text_field :deadline, class: "datepicker-control" %>
- <%= form.text_field :time_allowed %>
- <%= form.text_area :additional_notes %>
- <%= field_set_tag content_tag(:span, "Files", class: "h6 text-muted text-uppercase") do %>
+ <%= form.text_area :description, label: t('.labels.description') %>
+ <%= form.text_field :deadline, class: "datepicker-control", label: t('.labels.deadline') %>
+ <%= form.text_field :time_allowed, label: t('.labels.time_allowed') %>
+ <%= form.text_area :additional_notes, label: t('.labels.additional_notes') %>
+ <%= field_set_tag content_tag(:span, t('.labels.files'), class: "h6 text-muted text-uppercase") do %>
<%= form.label :files %>
<%= form.file_field :files, disable: true, direct_upload: true, multiple: true, id: "task_request_files", hide_label: true %>
diff --git a/app/views/tasks/_task.html.erb b/app/views/tasks/_task.html.erb
index 35a1efe..f600c65 100644
--- a/app/views/tasks/_task.html.erb
+++ b/app/views/tasks/_task.html.erb
@@ -12,6 +12,6 @@
<%= task.status.titleize %>
- <%= task.deliverable_url %>
+ <%= link_to "View Deliverable", task.deliverable_url, target: "_blank" %>
|
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 2d4f792..0af5c39 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -944,6 +944,13 @@ en:
edit:
heading:
Edit Task Request
+ form:
+ labels:
+ additional_notes: Please add any additional notes we should be aware of regarding this task.
+ deadline: What is the deadline for this task?
+ description: Please describe the task.
+ files: Please attach any files related to this task
+ time_allowed: How many hours would like spend on this task?
index:
actions:
new: Create Task Request
diff --git a/db/migrate/20200610143327_add_user_email_to_task_requests.rb b/db/migrate/20200610143327_add_user_email_to_task_requests.rb
new file mode 100644
index 0000000..2fd1f0f
--- /dev/null
+++ b/db/migrate/20200610143327_add_user_email_to_task_requests.rb
@@ -0,0 +1,5 @@
+class AddUserEmailToTaskRequests < ActiveRecord::Migration[6.0]
+ def change
+ add_column :task_requests, :user_email, :string
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 96c7870..e1fe1e4 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -37,15 +37,15 @@ CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
---
--- Name: pg_search_dmetaphone(text); Type: FUNCTION; Schema: public; Owner: -
---
-
-CREATE FUNCTION public.pg_search_dmetaphone(text) RETURNS text
- LANGUAGE sql IMMUTABLE STRICT
+--
+-- Name: pg_search_dmetaphone(text); Type: FUNCTION; Schema: public; Owner: -
+--
+
+CREATE FUNCTION public.pg_search_dmetaphone(text) RETURNS text
+ LANGUAGE sql IMMUTABLE STRICT
AS $_$
SELECT array_to_string(ARRAY(SELECT dmetaphone(unnest(regexp_split_to_array($1, E'\\s+')))), ' ')
-$_$;
+$_$;
SET default_tablespace = '';
@@ -1340,7 +1340,8 @@ CREATE TABLE public.task_requests (
status integer DEFAULT 0,
created_at timestamp(6) without time zone NOT NULL,
updated_at timestamp(6) without time zone NOT NULL,
- deliverable_url character varying
+ deliverable_url character varying,
+ user_email character varying
);
@@ -3560,4 +3561,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200507110804'),
('20200512161738'),
('20200518200245'),
-('20200519191908');
+('20200519191908'),
+('20200610143327');
+
+
diff --git a/spec/controllers/task_requests_controller_spec.rb b/spec/controllers/task_requests_controller_spec.rb
index 177059d..3a67162 100644
--- a/spec/controllers/task_requests_controller_spec.rb
+++ b/spec/controllers/task_requests_controller_spec.rb
@@ -118,7 +118,7 @@ RSpec.describe TaskRequestsController, type: :controller do
private
def task_request_params
- attributes = attributes_for(:task_request).except(:status)
+ attributes = attributes_for(:task_request).except(:status, :user_email)
files = 2.times.map { Rack::Test::UploadedFile.new(file_fixture("location_photo.png"), "image/png") }
attributes.merge({ files: files })
diff --git a/spec/controllers/tasks_controller_spec.rb b/spec/controllers/tasks_controller_spec.rb
index 9860156..b92be38 100644
--- a/spec/controllers/tasks_controller_spec.rb
+++ b/spec/controllers/tasks_controller_spec.rb
@@ -24,7 +24,7 @@ RSpec.describe TasksController, type: :controller do
get :index, params: { project_id: project }
expect(response.body).to have_content "Completed"
- expect(response.body).to have_content "example.com/deliverables"
+ expect(response.body).to have_link "View Deliverable"
end
context "when there are many records" do
diff --git a/spec/factories/task_requests.rb b/spec/factories/task_requests.rb
index c417fa8..b533bdf 100644
--- a/spec/factories/task_requests.rb
+++ b/spec/factories/task_requests.rb
@@ -1,6 +1,7 @@
FactoryBot.define do
factory :task_request do
association :project
+ user_email 'test@email.com'
deadline { 10.days.from_now }
time_allowed "10 days"
description "Task request"
diff --git a/spec/features/admin_managing_task_requests_spec.rb b/spec/features/admin_managing_task_requests_spec.rb
index 83a7efd..45752bb 100644
--- a/spec/features/admin_managing_task_requests_spec.rb
+++ b/spec/features/admin_managing_task_requests_spec.rb
@@ -24,12 +24,21 @@ feature "Admin managing task requests" do
click_link 'View'
switch_to_window(windows.last)
+ expect(page).to have_content 'Account Name'
+ expect(page).to have_content task_request.project.account.name
+
+ expect(page).to have_content 'Project Name'
+ expect(page).to have_content task_request.project.name
+
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 'User Email'
+ expect(page).to have_content task_request.user_email
+
expect(page).to have_content 'Deadline'
expect(page).to have_content task_request.deadline