From 00d114c928cf3918683ba89c0e3990bd7f43145a Mon Sep 17 00:00:00 2001 From: bilal Date: Tue, 9 Jun 2020 17:16:19 +0200 Subject: [PATCH] show account and project name in task request details for BIG admin --- app/helpers/description_list_helper.rb | 4 ++-- app/views/admin/task_requests/show.html.erb | 2 ++ spec/features/admin_managing_task_requests_spec.rb | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) 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/views/admin/task_requests/show.html.erb b/app/views/admin/task_requests/show.html.erb index 147cb1c..8dbc336 100644 --- a/app/views/admin/task_requests/show.html.erb +++ b/app/views/admin/task_requests/show.html.erb @@ -1,4 +1,6 @@
+ <%= 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, :deadline, append: ":" %> diff --git a/spec/features/admin_managing_task_requests_spec.rb b/spec/features/admin_managing_task_requests_spec.rb index 83a7efd..f6cf548 100644 --- a/spec/features/admin_managing_task_requests_spec.rb +++ b/spec/features/admin_managing_task_requests_spec.rb @@ -24,6 +24,12 @@ 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