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:
authorStan Hu <stanhu@gmail.com>2016-11-23 23:48:53 +0300
committerAlejandro Rodríguez <alejorro70@gmail.com>2016-11-24 18:20:56 +0300
commit6b5445d3713219bf7931c340a6dc1cb4b002a1dc (patch)
tree4866ededbd20313e161ac2338f32ee19be94a9c4
parentcde955c9645ddfaae2f154d3d3aded79c9fc574f (diff)
Merge branch 'fix-lfs-enabled-select-box' into 'master'
Fix `LFS enabled` select box. A refactor of the project edit page caused the `lfs_enabled` setting to be reverted to a non functioning state. This MR fixes that. This will most likely need to be ported back to 8.13 and 8.14. 8.12 contained the correct code. Fixes #24645 Related commits: - ea3bbbdef86ae30fcf76baaba11a3fceb6d2aa03 - da07c2e4d3d382c05ec287ee60f639b870074fe7 cc @stanhu @dblessing @dbalexandre @rymai See merge request !7716
-rw-r--r--app/views/projects/edit.html.haml13
-rw-r--r--spec/views/projects/edit.html.haml_spec.rb24
2 files changed, 31 insertions, 6 deletions
diff --git a/app/views/projects/edit.html.haml b/app/views/projects/edit.html.haml
index 0aa8801c2d8..3a5af2723c6 100644
--- a/app/views/projects/edit.html.haml
+++ b/app/views/projects/edit.html.haml
@@ -92,14 +92,15 @@
= project_feature_access_select(:wiki_access_level)
- if Gitlab.config.lfs.enabled && current_user.admin?
- .checkbox
- = f.label :lfs_enabled do
- = f.check_box :lfs_enabled
- %strong LFS
- %br
- %span.descr
+ .row
+ .col-md-9
+ = f.label :lfs_enabled, 'LFS', class: 'label-light'
+ %span.help-block
Git Large File Storage
= 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', data: { field: 'lfs_enabled' }
+
- if Gitlab.config.registry.enabled
.form-group.js-container-registry{ style: ("display: none;" if @project.project_feature.send(:repository_access_level) == 0) }
diff --git a/spec/views/projects/edit.html.haml_spec.rb b/spec/views/projects/edit.html.haml_spec.rb
new file mode 100644
index 00000000000..d2575702ecc
--- /dev/null
+++ b/spec/views/projects/edit.html.haml_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe 'projects/edit' do
+ include Devise::Test::ControllerHelpers
+
+ let(:project) { create(:empty_project) }
+ let(:user) { create(:admin) }
+
+ before do
+ assign(:project, project)
+
+ allow(controller).to receive(:current_user).and_return(user)
+ allow(view).to receive_messages(current_user: user, can?: true)
+ allow(Gitlab.config.lfs).to receive(:enabled).and_return(true)
+ end
+
+ context 'LFS enabled setting' do
+ it 'displays the correct elements' do
+ render
+ expect(rendered).to have_select('project_lfs_enabled')
+ expect(rendered).to have_content('Git Large File Storage')
+ end
+ end
+end