From fc320a342182e3ca0800691774aeaf8b43c9582f Mon Sep 17 00:00:00 2001 From: Bilal Date: Tue, 14 Jul 2020 15:00:13 +0200 Subject: [PATCH 1/4] rebase --- db/structure.sql | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index ba4ce52..e30e5ed 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -9,20 +9,6 @@ SET xmloption = content; SET client_min_messages = warning; SET row_security = off; --- --- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: - --- - -CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog; - - --- --- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: - --- - -COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language'; - - -- -- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: - -- -- 2.47.3 From bde18ab0f10487a333306348477bc4cec721ce98 Mon Sep 17 00:00:00 2001 From: Bilal Date: Tue, 14 Jul 2020 18:34:06 +0200 Subject: [PATCH 2/4] add Chat Now button --- app/views/task_requests/_form.html.erb | 16 +++++++++++++--- config/locales/en.yml | 4 +++- config/locales/es.yml | 4 +++- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/views/task_requests/_form.html.erb b/app/views/task_requests/_form.html.erb index 5c9e42e..e36b06c 100644 --- a/app/views/task_requests/_form.html.erb +++ b/app/views/task_requests/_form.html.erb @@ -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| %> -
- <%= fa_icon "info-circle" %> - <%= t '.info_message' %> + +
+
+
+
+ <%= fa_icon "info-circle" %> + <%= t '.info_message' %> +
+
+
+ <%= 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") } %> +
+
<%= form.text_area :description, label: t('.labels.description') %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 54ae14f..d55b90d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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? diff --git a/config/locales/es.yml b/config/locales/es.yml index 1bae211..0e413b2 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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) -- 2.47.3 From d12cec8487282e0937ad6c4f0bab89565abca394 Mon Sep 17 00:00:00 2001 From: Bilal Date: Tue, 14 Jul 2020 18:47:43 +0200 Subject: [PATCH 3/4] remove validation and add specs --- app/models/task_request.rb | 2 -- .../user_managing_task_requests_spec.rb | 31 +++++++++++++++++++ spec/models/task_request_spec.rb | 4 --- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/app/models/task_request.rb b/app/models/task_request.rb index 04345ac..458e86a 100644 --- a/app/models/task_request.rb +++ b/app/models/task_request.rb @@ -5,6 +5,4 @@ class TaskRequest < ApplicationRecord enum status: [:pending, :completed, :cancelled] scope :order_by_recent, -> { order(created_at: :desc) } - - validates :time_allowed, numericality: { only_integer: true, greater_than_or_equal_to: 2 } end diff --git a/spec/features/user_managing_task_requests_spec.rb b/spec/features/user_managing_task_requests_spec.rb index c40cd88..6174088 100644 --- a/spec/features/user_managing_task_requests_spec.rb +++ b/spec/features/user_managing_task_requests_spec.rb @@ -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 diff --git a/spec/models/task_request_spec.rb b/spec/models/task_request_spec.rb index 2e67c29..cf5ea56 100644 --- a/spec/models/task_request_spec.rb +++ b/spec/models/task_request_spec.rb @@ -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 -- 2.47.3 From c17f41525dbed7f4c185195ca1f97da039decebd Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 15 Jul 2020 19:03:35 +0200 Subject: [PATCH 4/4] fix MR comment --- app/models/task_request.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/models/task_request.rb b/app/models/task_request.rb index 458e86a..7f43e18 100644 --- a/app/models/task_request.rb +++ b/app/models/task_request.rb @@ -5,4 +5,6 @@ class TaskRequest < ApplicationRecord enum status: [:pending, :completed, :cancelled] scope :order_by_recent, -> { order(created_at: :desc) } + + validates :time_allowed, numericality: { only_integer: true, greater_than_or_equal_to: 2 }, allow_blank: true end -- 2.47.3