diff --git a/app/views/task_requests/_form.html.erb b/app/views/task_requests/_form.html.erb index 1606356..5c9e42e 100644 --- a/app/views/task_requests/_form.html.erb +++ b/app/views/task_requests/_form.html.erb @@ -8,7 +8,7 @@ <%= 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.number_field :time_allowed, label: t('.labels.time_allowed'), min: 2, step: 1, pattern: "\d+" %> <%= 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 %>
diff --git a/app/views/task_requests/_task_request.html.erb b/app/views/task_requests/_task_request.html.erb index c3f970c..d63dc81 100644 --- a/app/views/task_requests/_task_request.html.erb +++ b/app/views/task_requests/_task_request.html.erb @@ -5,6 +5,18 @@ <%= task_request.deadline.try(:strftime, '%D') %> + + <%= truncate(task_request.description) { + link_to t('.actions.read_more'), + '#', + class: 'alert-link', + data: { + toggle: "popover", + content: task_request.description, + trigger: "hover" + } + } %> + <%= task_request.time_allowed %> diff --git a/app/views/task_requests/create.html.erb b/app/views/task_requests/create.html.erb index 86a9ba9..3504502 100644 --- a/app/views/task_requests/create.html.erb +++ b/app/views/task_requests/create.html.erb @@ -1,13 +1,15 @@ <% if params[:show_chat] %> - <%= javascript_include_tag "https://js.hs-scripts.com/7344617.js", defer: "defer", async: true, id: "hs-script-loader" %> + <%= javascript_include_tag "//js.hs-scripts.com/7344617.js", defer: "defer", async: true, id: "hs-script-loader" %> <%= javascript_tag nonce: true do %> - $(document).ready(function(){ - window.hsConversationsOnReady = [ - function() { - window.HubSpotConversations.widget.open(); - } - ] - }); + function onConversationsAPIReady() { + window.HubSpotConversations.widget.load({ widgetOpen: true }); + window.HubSpotConversations.widget.open(); + } + if (window.HubSpotConversations) { + onConversationsAPIReady(); + } else { + window.hsConversationsOnReady = [onConversationsAPIReady]; + } <% end %> <% end %>

<%= t '.success_message' %>

diff --git a/app/views/task_requests/index.html.erb b/app/views/task_requests/index.html.erb index 4c6c61d..6173997 100644 --- a/app/views/task_requests/index.html.erb +++ b/app/views/task_requests/index.html.erb @@ -16,6 +16,7 @@ <%= t(".table_headers.task_request_created_on") %> <%= t(".table_headers.task_request_deadline") %> + <%= t(".table_headers.task_request_description") %> <%= t(".table_headers.task_request_time_allowed") %> <%= t(".table_headers.task_request_status") %> @@ -26,7 +27,7 @@ <%= render @task_requests %> <% else %> - <%= t(".empty") %> + <%= t(".empty") %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ee67a04..b49020c 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -305,6 +305,8 @@ en: notice: The release has been updated helpers: help: + task_request: + time_allowed: Minimum of 2 hours, no partial hours allowed video: audio_only_edl_file: If you do not upload an Audio Only EDL, the software will not generate a BiG Music Cue Sheet. edl_file: Please follow our directions on exporting the All Tracks EDL. Failure to do so could result in inaccurate and incomplete reporting. @@ -954,7 +956,7 @@ en: 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? + time_allowed: How many hours would you like a TaskME representative to work on this task? index: actions: new: Create Task Request @@ -962,6 +964,7 @@ en: table_headers: task_request_created_on: Created On task_request_deadline: Deadline + task_request_description: Description task_request_results: Task Results task_request_status: Status task_request_time_allowed: Time Allowed @@ -973,6 +976,7 @@ en: actions: manage: Manage open_deliverable: Open Deliverable + read_more: read more update: notice: Task request updated successfully. tasks: diff --git a/config/locales/es.yml b/config/locales/es.yml index 207c37e..30e4aa8 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -187,7 +187,11 @@ es: success_message: Your task request was successfully submitted. Thank you. A chat window will pop up on the lower right in a few seconds. (ES) form: info_message: After submitting this task request, you'll be connected via chat with a ME Suite representative. (ES) + index: + table_headers: + task_request_description: Description (ES) task_request: actions: manage: Manage (ES) open_deliverable: Open Deliverable (ES) + read_more: read more (ES) diff --git a/spec/features/user_managing_task_requests_spec.rb b/spec/features/user_managing_task_requests_spec.rb index 00f5956..80c4f1c 100644 --- a/spec/features/user_managing_task_requests_spec.rb +++ b/spec/features/user_managing_task_requests_spec.rb @@ -13,6 +13,7 @@ feature "User managing task requests" do expect(page).to have_content "Created On" expect(page).to have_content "Deadline" + expect(page).to have_content description_column expect(page).to have_content "Time Allowed" expect(page).to have_content "Status" end @@ -34,6 +35,40 @@ feature "User managing task requests" do expect(page).to have_content task_request.status.capitalize end + scenario "full description is shown if description text is not truncated" do + visit project_task_requests_path(project) + + task_request = create(:task_request, project: project, description: 'Short Desc') + visit project_task_requests_path(project) + + expect(page).to have_content task_request.description + end + + scenario "truncated description is shown if description text is too long" do + visit project_task_requests_path(project) + + task_request = create(:task_request, + project: project, + description: long_description_text) + visit project_task_requests_path(project) + + expect(page).not_to have_content task_request.description + truncated_text = "#{task_request.description[0..26]}...read more" + expect(page).to have_content truncated_text + end + + scenario "full description is shown when user hovers over read more link in description colum", js: true do + visit project_task_requests_path(project) + + task_request = create(:task_request, + project: project, + description: long_description_text) + visit project_task_requests_path(project) + + page.execute_script '$("a[data-toggle=popover]").trigger("mouseover")' + expect(page).to have_content task_request.description + end + scenario "user does not see open deliverable action in manage dropdown if task status is not completed" do task_request = create(:task_request, project: project) visit project_task_requests_path(project) @@ -70,4 +105,12 @@ feature "User managing task requests" do def add_new_project_label t "projects.index.actions.new" end + + def description_column + t 'task_requests.index.table_headers.task_request_description' + end + + def long_description_text + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' + end end