Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

Commit c788c66a authored by Patricio Cano's avatar Patricio Cano
Browse files

Improved helper methods, better flow for `project.lfs_enabled?`, and UI fixes.

parent 5259eae1ab55
......@@ -25,7 +25,26 @@ def group_title(group, name = nil, url = nil)
def projects_with_lfs_enabled(group)
total = group.projects.size
"#{total -{ |p| !p.lfs_enabled? }.size}/#{total} projects have it enabled"
lfs_enabled =
size = group.projects.size
if lfs_enabled == size || lfs_enabled == 0
' on all projects'
" on #{lfs_enabled}/#{size} projects"
def group_lfs_status(group)
if group.lfs_enabled?
output = content_tag(:span, class: 'lfs-enabled') do
output = content_tag(:span, class: 'lfs-disabled') do
output << projects_with_lfs_enabled(group)
......@@ -202,8 +202,8 @@ def get_project_nav_tabs(project, current_user)
def lfs_status_helper(subject)
if subject.lfs_enabled?
def project_lfs_status(project)
if project.lfs_enabled?
content_tag(:span, class: 'lfs-enabled') do
......@@ -393,10 +393,6 @@ def cached_count
def lfs_enabled?
# Specifically check is lfs_enabled is false
return false if self[:lfs_enabled] == false
# Should only fallback to the namespace value if no value is set for the project
return namespace.lfs_enabled? if self[:lfs_enabled].nil?
self[:lfs_enabled] && Gitlab.config.lfs.enabled
......@@ -40,8 +40,7 @@
%span.light Group Git LFS status:
= lfs_status_helper(@group)
= projects_with_lfs_enabled(@group)
= group_lfs_status(@group)
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
......@@ -77,7 +77,7 @@
%span.light Git LFS status:
= lfs_status_helper(@project)
= project_lfs_status(@project)
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
- else
......@@ -84,15 +84,14 @@
= project_feature_access_select(:snippets_access_level)
- if Gitlab.config.lfs.enabled && current_user.admin?
= f.label :lfs_enabled do
= f.check_box :lfs_enabled, checked: @project.lfs_enabled?
%strong LFS
Git Large File Storage
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
= f.label :lfs_enabled, 'LFS', class: 'label-light'
Git Large File Storage
= link_to icon('question-circle'), help_page_path('workflow/lfs/manage_large_binaries_with_git_lfs')
= :lfs_enabled, [%w(Enabled true), %w(Disabled false)], {}, selected: @project.lfs_enabled?, class: 'pull-right form-control'
- if Gitlab.config.registry.enabled
......@@ -4,25 +4,8 @@
class AddLfsEnabledToNamespaces < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
# When a migration requires downtime you **must** uncomment the following
# constant and define a short and easy to understand explanation as to why the
# migration requires downtime.
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
# existing transaction. When using "add_concurrent_index" make sure that this
# method is the _only_ method called in the migration, any other changes
# should go in a separate migration. This ensures that upon failure _only_ the
# index creation fails and can be retried or reverted easily.
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def change
add_column :namespaces, :lfs_enabled, :boolean
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