Task mvp upstream sync
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -7,6 +7,8 @@ module DropzoneHelper
|
||||
"To Add Audio Files to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse files"
|
||||
when "directory"
|
||||
"To Add Files to the Folder:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse files"
|
||||
when "task_request"
|
||||
"To Add Files for the Task:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse files"
|
||||
else
|
||||
"To Add Photos to the release:<br>Drag & Drop Files<br>or<br>Click or Tap here to browse photos and connect to Camera"
|
||||
end
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
<div class="row align-items-center text-center mt-4">
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<dl>
|
||||
<%= 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: ":" %>
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
<hr class="divider-light mx-n4">
|
||||
<nav>
|
||||
<ul class="nav nav-pills nav-pills-dark flex-column">
|
||||
<li class="nav-item">
|
||||
<%= link_to [project, :task_requests], class: class_string("nav-link", "active" => controller_name == "task_requests") do %>
|
||||
<%= lock_icon_for(Current.account, :taskme) %>
|
||||
<%= product_wordmark :task_me, class: class_string("d-inline-block", "disabled" => !Current.account.taskme_enabled?) %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to [project, :contract_templates], class: class_string("nav-link", "active" => %w(contract_templates release_template_imports).include?(controller_name)) do %>
|
||||
<%= lock_icon_for Current.account, :releaseme %>
|
||||
@@ -35,12 +41,6 @@
|
||||
<%= product_wordmark :deliver_me, class: class_string("d-inline-block", "disabled" => !Current.account.deliverme_enabled?) %>
|
||||
<% end %>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<%= link_to [project, :task_requests], class: class_string("nav-link", "active" => controller_name == "task_requests") do %>
|
||||
<%= lock_icon_for(Current.account, :taskme) %>
|
||||
<%= product_wordmark :task_me, class: class_string("d-inline-block", "disabled" => !Current.account.taskme_enabled?) %>
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
<hr class="divider-light mx-n4">
|
||||
|
||||
@@ -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 %>
|
||||
<div class="field d-none">
|
||||
<%= form.label :files %>
|
||||
<%= form.file_field :files, disable: true, direct_upload: true, multiple: true, id: "task_request_files", hide_label: true %>
|
||||
|
||||
@@ -12,6 +12,6 @@
|
||||
<%= task.status.titleize %>
|
||||
</td>
|
||||
<td>
|
||||
<%= task.deliverable_url %>
|
||||
<%= link_to "View Deliverable", task.deliverable_url, target: "_blank" %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddUserEmailToTaskRequests < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :task_requests, :user_email, :string
|
||||
end
|
||||
end
|
||||
@@ -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');
|
||||
|
||||
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user