Commit 71ba763a authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'dz-refactor-project-permissions-helper-method' into 'master'

Refactor project_permissions_panel_data so it can be extended in EE easily

See merge request gitlab-org/gitlab-ce!21370
parents 452fd703 a765934b
...@@ -447,7 +447,7 @@ module ProjectsHelper ...@@ -447,7 +447,7 @@ module ProjectsHelper
end end
def project_permissions_panel_data(project) def project_permissions_panel_data(project)
data = { {
currentSettings: project_permissions_settings(project), currentSettings: project_permissions_settings(project),
canChangeVisibilityLevel: can_change_visibility_level?(project, current_user), canChangeVisibilityLevel: can_change_visibility_level?(project, current_user),
allowedVisibilityOptions: project_allowed_visibility_levels(project), allowedVisibilityOptions: project_allowed_visibility_levels(project),
...@@ -457,8 +457,10 @@ module ProjectsHelper ...@@ -457,8 +457,10 @@ module ProjectsHelper
lfsAvailable: Gitlab.config.lfs.enabled, lfsAvailable: Gitlab.config.lfs.enabled,
lfsHelpPath: help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs') lfsHelpPath: help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
} }
end
data.to_json.html_safe def project_permissions_panel_data_json(project)
project_permissions_panel_data(project).to_json.html_safe
end end
def project_allowed_visibility_levels(project) def project_allowed_visibility_levels(project)
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
= form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "sharing-permissions-form" }, authenticity_token: true do |f| = form_for [@project.namespace.becomes(Namespace), @project], remote: true, html: { multipart: true, class: "sharing-permissions-form" }, authenticity_token: true do |f|
%input{ name: 'update_section', type: 'hidden', value: 'js-shared-permissions' } %input{ name: 'update_section', type: 'hidden', value: 'js-shared-permissions' }
-# haml-lint:disable InlineJavaScript -# haml-lint:disable InlineJavaScript
%script.js-project-permissions-form-data{ type: "application/json" }= project_permissions_panel_data(@project) %script.js-project-permissions-form-data{ type: "application/json" }= project_permissions_panel_data_json(@project)
.js-project-permissions-form .js-project-permissions-form
= f.submit 'Save changes', class: "btn btn-save" = f.submit 'Save changes', class: "btn btn-save"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment