Compare commits

..

4 Commits

Author SHA1 Message Date
Bilal
c17f41525d fix MR comment 2020-07-15 19:03:35 +02:00
Bilal
d12cec8487 remove validation and add specs 2020-07-15 12:25:54 +02:00
Bilal
bde18ab0f1 add Chat Now button 2020-07-15 12:25:54 +02:00
Bilal
fc320a3421 rebase 2020-07-15 12:25:54 +02:00
8 changed files with 58 additions and 17 deletions

View File

@@ -6,5 +6,5 @@ class TaskRequest < ApplicationRecord
scope :order_by_recent, -> { order(created_at: :desc) }
validates :time_allowed, numericality: { only_integer: true, greater_than_or_equal_to: 2 }
validates :time_allowed, numericality: { only_integer: true, greater_than_or_equal_to: 2 }, allow_blank: true
end

View File

@@ -7,7 +7,7 @@
<dl>
<%= description_list_pair t('.description_labels.producer'), releasable.project.account.name %>
<%= description_list_pair t('.description_labels.production'), releasable.project.name %>
<%= description_list_pair t('.description_labels.issued_to'), releasable.name %>
<%= description_list_pair t('.description_labels.employee_issued_to'), releasable.name %>
<%= description_list_pair t('.description_labels.issued_by'), releasable.approved_by_user_name %>
<%= description_list_pair t('.description_labels.date_issued'), releasable.approved_at %>
</dl>

View File

@@ -1,9 +1,19 @@
<%= errors_summary_for task_request %>
<%= bootstrap_form_with model: model, url: [@project, @task_request, show_chat: true], local: true do |form| %>
<div class="alert alert-info text-center text-md-left">
<%= fa_icon "info-circle" %>
<strong><%= t '.info_message' %></strong>
<div class="d-flex">
<div class="row">
<div class="col-xl-10 col-12">
<div class="alert alert-info text-center text-md-left">
<%= fa_icon "info-circle" %>
<strong><%= t '.info_message' %></strong>
</div>
</div>
<div class="col-xl-2 col-12">
<%= form.submit t('.actions.chat_now'), class: "btn btn-block btn-warning pt-4 pb-4 mb-1", data: { disable_with: t("shared.disable_with") } %>
</div>
</div>
</div>
<%= form.text_area :description, label: t('.labels.description') %>

View File

@@ -306,8 +306,8 @@ en:
for_office_use_only:
description_labels:
date_issued: Date Issued
employee_issued_to: Employee Issued To
issued_by: Issued By
issued_to: Issued To
producer: Producer
production: Production
heading: For Office Use Only
@@ -1284,7 +1284,9 @@ en:
heading:
Edit Task Request
form:
info_message: After submitting this task request, you'll be connected via chat with a ME Suite representative.
actions:
chat_now: Chat Now
info_message: For best results, please fill out this form prior to being connected with a TaskME assistant. However, if urgent, you can start speaking with a TaskME assistant by pressing the Chat Now button to the right
labels:
additional_notes: Please add any additional notes we should be aware of regarding this task.
deadline: What is the deadline for this task?

View File

@@ -138,8 +138,8 @@ es:
for_office_use_only:
description_labels:
date_issued: Date Issued (ES)
employee_issued_to: Employee Issued To (ES)
issued_by: Issued By (ES)
issued_to: Issued To (ES)
producer: Producer (ES)
production: Production (ES)
heading: For Office Use Only (ES)
@@ -484,7 +484,9 @@ es:
create:
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)
actions:
chat_now: Chat Now (ES)
info_message: For best results, please fill out this form prior to being connected with a TaskME assistant. However, if urgent, you can start speaking with a TaskME assistant by pressing the Chat Now button to the right (ES)
index:
table_headers:
task_request_description: Description (ES)

View File

@@ -260,7 +260,7 @@ feature "User managing medical releases" do
expect(pdf_body).to have_content for_office_use_only.upcase
expect(pdf_body).to have_content producer_label
expect(pdf_body).to have_content production_label
expect(pdf_body).to have_content issued_to_label
expect(pdf_body).to have_content employee_issued_to_label
expect(pdf_body).to have_content issued_by_label
expect(pdf_body).to have_content date_issued
expect(pdf_body).to have_content 'Big Joe'
@@ -282,7 +282,7 @@ feature "User managing medical releases" do
expect(pdf_body).not_to have_content for_office_use_only.upcase
expect(pdf_body).not_to have_content producer_label
expect(pdf_body).not_to have_content production_label
expect(pdf_body).not_to have_content issued_to_label
expect(pdf_body).not_to have_content employee_issued_to_label
expect(pdf_body).not_to have_content issued_by_label
expect(pdf_body).not_to have_content date_issued
expect(pdf_body).not_to have_content 'Big Joe'
@@ -580,8 +580,8 @@ feature "User managing medical releases" do
t 'contracts.for_office_use_only.description_labels.production'
end
def issued_to_label
t 'contracts.for_office_use_only.description_labels.issued_to'
def employee_issued_to_label
t 'contracts.for_office_use_only.description_labels.employee_issued_to'
end
def issued_by_label

View File

@@ -91,6 +91,21 @@ feature "User managing task requests" do
expect(page).to have_content add_new_project_label
end
scenario "user can click Chat Now and start chat event with a blank form" do
visit project_task_requests_path(project)
click_on create_task_request
expect(page).to have_content chat_now_button
expect(page).to have_content form_notice
expect do
click_on chat_now_button
end.to change(TaskRequest, :count).by(1)
expect(page).to have_content task_request_created_notice
end
private
def no_task_requests_label
@@ -120,4 +135,20 @@ feature "User managing task requests" do
def schedule_demo
t 'task_requests.splash.actions.book_demo'
end
def create_task_request
t 'task_requests.index.actions.new'
end
def chat_now_button
t 'task_requests.form.actions.chat_now'
end
def form_notice
t 'task_requests.form.info_message'
end
def task_request_created_notice
t 'task_requests.create.success_message'
end
end

View File

@@ -13,8 +13,4 @@ RSpec.describe TaskRequest, type: :model do
subject { described_class }
it { is_expected.to respond_to(:order_by_recent) }
end
describe "#validations" do
it { should validate_numericality_of(:time_allowed).only_integer.is_greater_than_or_equal_to(2) }
end
end