Commit 4bf34cf8 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'ee-12557-tree-content' into 'master'

EE: Move EE differences for `app/views/projects/tree/_tree_content.html.haml`

See merge request gitlab-org/gitlab-ee!14590
parents 31737656 a5624882
...@@ -147,4 +147,13 @@ module TreeHelper ...@@ -147,4 +147,13 @@ module TreeHelper
def relative_url_root def relative_url_root
Gitlab.config.gitlab.relative_url_root.presence || '/' Gitlab.config.gitlab.relative_url_root.presence || '/'
end end
# project and path are used on the EE version
def tree_content_data(logs_path, project, path)
{
"logs-path" => logs_path
}
end
end end
TreeHelper.prepend(::EE::TreeHelper)
.tree-content-holder.js-tree-content{ 'data-logs-path': @logs_path, 'data-path-locks-available': (@project.feature_available?(:file_locks) ? 'true' : 'false'), 'data-path-locks-toggle': toggle_project_path_locks_path(@project), 'data-path-locks-path': @path } .tree-content-holder.js-tree-content{ data: tree_content_data(@logs_path, @project, @path) }
.table-holder.bordered-box .table-holder.bordered-box
%table.table#tree-slider{ class: "table_#{@hex_path} tree-table qa-file-tree" } %table.table#tree-slider{ class: "table_#{@hex_path} tree-table qa-file-tree" }
%thead %thead
......
# frozen_string_literal: true
module EE
module TreeHelper
extend ::Gitlab::Utils::Override
override :tree_content_data
def tree_content_data(logs_path, project, path)
super.merge({
"path-locks-available" => project.feature_available?(:file_locks).to_s,
"path-locks-toggle" => toggle_project_path_locks_path(project),
"path-locks-path" => path
})
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe TreeHelper do
let(:project) { create(:project, :repository) }
describe '#tree_content_data' do
let(:logs_path) { "#{project.full_path}/refs/master/logs_tree/" }
let(:path) { '.gitlab/template_test' }
context 'when file locks is available' do
it 'returns the logs path' do
stub_licensed_features(file_locks: true)
tree_content_data = {
"logs-path" => logs_path,
"path-locks-available" => "true",
"path-locks-toggle" => toggle_project_path_locks_path(project),
"path-locks-path" => path
}
expect(helper.tree_content_data(logs_path, project, path)).to eq(tree_content_data)
end
end
context 'when file lock is not avaiable' do
it 'returns the path information' do
stub_licensed_features(file_locks: false)
tree_content_data = {
"logs-path" => logs_path,
"path-locks-available" => "false",
"path-locks-toggle" => toggle_project_path_locks_path(project),
"path-locks-path" => path
}
expect(helper.tree_content_data(logs_path, project, path)).to eq(tree_content_data)
end
end
end
end
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