Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
c788c66a
Commit
c788c66a
authored
Sep 05, 2016
by
Patricio Cano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved helper methods, better flow for `project.lfs_enabled?`, and UI fixes.
parent
a8b0d501
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
37 deletions
+33
-37
app/helpers/groups_helper.rb
app/helpers/groups_helper.rb
+21
-2
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+2
-2
app/models/project.rb
app/models/project.rb
+0
-4
app/views/admin/groups/show.html.haml
app/views/admin/groups/show.html.haml
+1
-2
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+1
-1
app/views/projects/edit.html.haml
app/views/projects/edit.html.haml
+8
-9
db/migrate/20160901213340_add_lfs_enabled_to_namespaces.rb
db/migrate/20160901213340_add_lfs_enabled_to_namespaces.rb
+0
-17
No files found.
app/helpers/groups_helper.rb
View file @
c788c66a
...
@@ -25,7 +25,26 @@ module GroupsHelper
...
@@ -25,7 +25,26 @@ module GroupsHelper
end
end
def
projects_with_lfs_enabled
(
group
)
def
projects_with_lfs_enabled
(
group
)
total
=
group
.
projects
.
size
lfs_enabled
=
group
.
projects
.
select
(
&
:lfs_enabled?
).
size
"
#{
total
-
group
.
projects
.
select
{
|
p
|
!
p
.
lfs_enabled?
}
.size}/
#{
total
}
projects have it enabled"
size
=
group
.
projects
.
size
if
lfs_enabled
==
size
||
lfs_enabled
==
0
' on all projects'
else
" on
#{
lfs_enabled
}
/
#{
size
}
projects"
end
end
def
group_lfs_status
(
group
)
if
group
.
lfs_enabled?
output
=
content_tag
(
:span
,
class:
'lfs-enabled'
)
do
'Enabled'
end
else
output
=
content_tag
(
:span
,
class:
'lfs-disabled'
)
do
'Disabled'
end
end
output
<<
projects_with_lfs_enabled
(
group
)
end
end
end
end
app/helpers/projects_helper.rb
View file @
c788c66a
...
@@ -202,8 +202,8 @@ module ProjectsHelper
...
@@ -202,8 +202,8 @@ module ProjectsHelper
nav_tabs
.
flatten
nav_tabs
.
flatten
end
end
def
lfs_status_helper
(
sub
ject
)
def
project_lfs_status
(
pro
ject
)
if
sub
ject
.
lfs_enabled?
if
pro
ject
.
lfs_enabled?
content_tag
(
:span
,
class:
'lfs-enabled'
)
do
content_tag
(
:span
,
class:
'lfs-enabled'
)
do
'Enabled'
'Enabled'
end
end
...
...
app/models/project.rb
View file @
c788c66a
...
@@ -393,10 +393,6 @@ class Project < ActiveRecord::Base
...
@@ -393,10 +393,6 @@ class Project < ActiveRecord::Base
end
end
def
lfs_enabled?
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?
return
namespace
.
lfs_enabled?
if
self
[
:lfs_enabled
].
nil?
self
[
:lfs_enabled
]
&&
Gitlab
.
config
.
lfs
.
enabled
self
[
:lfs_enabled
]
&&
Gitlab
.
config
.
lfs
.
enabled
...
...
app/views/admin/groups/show.html.haml
View file @
c788c66a
...
@@ -40,8 +40,7 @@
...
@@ -40,8 +40,7 @@
%li
%li
%span
.light
Group Git LFS status:
%span
.light
Group Git LFS status:
%strong
%strong
=
lfs_status_helper
(
@group
)
=
group_lfs_status
(
@group
)
=
projects_with_lfs_enabled
(
@group
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
.panel.panel-default
.panel.panel-default
...
...
app/views/admin/projects/show.html.haml
View file @
c788c66a
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
%li
%li
%span
.light
Git LFS status:
%span
.light
Git LFS status:
%strong
%strong
=
lfs_status_helper
(
@project
)
=
project_lfs_status
(
@project
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
-
else
-
else
%li
%li
...
...
app/views/projects/edit.html.haml
View file @
c788c66a
...
@@ -84,15 +84,14 @@
...
@@ -84,15 +84,14 @@
=
project_feature_access_select
(
:snippets_access_level
)
=
project_feature_access_select
(
:snippets_access_level
)
-
if
Gitlab
.
config
.
lfs
.
enabled
&&
current_user
.
admin?
-
if
Gitlab
.
config
.
lfs
.
enabled
&&
current_user
.
admin?
.form-group
.row
.checkbox
.col-md-9
=
f
.
label
:lfs_enabled
do
=
f
.
label
:lfs_enabled
,
'LFS'
,
class:
'label-light'
=
f
.
check_box
:lfs_enabled
,
checked:
@project
.
lfs_enabled?
%span
.help-block
%strong
LFS
%br
%span
.descr
Git Large File Storage
Git Large File Storage
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
=
link_to
icon
(
'question-circle'
),
help_page_path
(
'workflow/lfs/manage_large_binaries_with_git_lfs'
)
.col-md-3
=
f
.
select
:lfs_enabled
,
[
%w(Enabled true)
,
%w(Disabled false)
],
{},
selected:
@project
.
lfs_enabled?
,
class:
'pull-right form-control'
-
if
Gitlab
.
config
.
registry
.
enabled
-
if
Gitlab
.
config
.
registry
.
enabled
.form-group
.form-group
...
...
db/migrate/20160901213340_add_lfs_enabled_to_namespaces.rb
View file @
c788c66a
...
@@ -4,25 +4,8 @@
...
@@ -4,25 +4,8 @@
class
AddLfsEnabledToNamespaces
<
ActiveRecord
::
Migration
class
AddLfsEnabledToNamespaces
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
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.
# DOWNTIME_REASON = ''
# 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
def
change
add_column
:namespaces
,
:lfs_enabled
,
:boolean
add_column
:namespaces
,
:lfs_enabled
,
:boolean
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment