Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r--app/helpers/projects_helper.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 827d2cb7164..084c962d34c 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -660,6 +660,31 @@ module ProjectsHelper
project.unlink_forks_upon_visibility_decrease_enabled? && project.visibility_level > Gitlab::VisibilityLevel::PRIVATE && project.forks_count > 0
end
+ def confirm_reduce_visibility_message(project)
+ strong_start = "<strong>".html_safe
+ strong_end = "</strong>".html_safe
+ message = _("You're about to reduce the visibility of the project %{strong_start}%{project_name}%{strong_end}.")
+
+ if project.group
+ message = _("You're about to reduce the visibility of the project %{strong_start}%{project_name}%{strong_end} in %{strong_start}%{group_name}%{strong_end}.")
+ end
+
+ html_escape(message) % { strong_start: strong_start, strong_end: strong_end, project_name: project.name, group_name: project.group ? project.group.name : nil }
+ end
+
+ def visibility_confirm_modal_data(project, target_form_id = nil)
+ {
+ target_form_id: target_form_id,
+ button_testid: 'reduce-project-visibility-button',
+ confirm_button_text: _('Reduce project visibility'),
+ confirm_danger_message: confirm_reduce_visibility_message(project),
+ phrase: project.full_path,
+ additional_information: _('Note: current forks will keep their visibility level.'),
+ html_confirmation_message: true.to_s,
+ show_visibility_confirm_modal: show_visibility_confirm_modal?(project).to_s
+ }
+ end
+
def build_project_breadcrumb_link(project)
project_name = simple_sanitize(project.name)