From 0a8d0924fe9a1525b92423411dc1bfcdc9760833 Mon Sep 17 00:00:00 2001 From: Mike Greiling Date: Sat, 26 Aug 2017 02:43:45 -0500 Subject: [PATCH] expand the help text with links and additional instructions --- app/assets/javascripts/project_visibility.js | 8 ++++++-- app/helpers/namespaces_helper.rb | 9 ++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/project_visibility.js b/app/assets/javascripts/project_visibility.js index b43c8ba56e2..c3f5e8cb907 100644 --- a/app/assets/javascripts/project_visibility.js +++ b/app/assets/javascripts/project_visibility.js @@ -3,7 +3,7 @@ function setVisibilityOptions(namespaceSelector) { return; } const selectedNamespace = namespaceSelector.options[namespaceSelector.selectedIndex]; - const { name, visibility, visibilityLevel } = selectedNamespace.dataset; + const { name, visibility, visibilityLevel, showPath, editPath } = selectedNamespace.dataset; document.querySelectorAll('.visibility-level-setting .radio').forEach((option) => { const optionInput = option.querySelector('input[type=radio]'); @@ -18,7 +18,11 @@ function setVisibilityOptions(namespaceSelector) { optionInput.disabled = true; const reason = option.querySelector('.option-disabled-reason'); if (reason) { - reason.innerText = `This project cannot be ${optionName} because the visibility of ${name} is ${visibility}.`; + reason.innerHTML = + `This project cannot be ${optionName} because the visibility of + ${name} is ${visibility}. To make this project + ${optionName}, you must first change the visibility + of the parent group.`; } } else { option.classList.remove('disabled'); diff --git a/app/helpers/namespaces_helper.rb b/app/helpers/namespaces_helper.rb index ca149ac2c20..33d6875a704 100644 --- a/app/helpers/namespaces_helper.rb +++ b/app/helpers/namespaces_helper.rb @@ -41,7 +41,14 @@ module NamespacesHelper elements = namespaces.sort_by(&:human_name).map! do |n| [display_path ? n.full_path : n.human_name, n.id, - data: { options_parent: type, visibility_level: n.visibility_level_value, visibility: n.visibility, name: n.name }] + data: { + options_parent: type, + visibility_level: n.visibility_level_value, + visibility: n.visibility, + name: n.name, + show_path: n.is_a?(Group) ? group_path(n) : user_path(n), + edit_path: n.is_a?(Group) ? edit_group_path(n) : nil + }] end [type.camelize, elements]