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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
a5624882
Commit
a5624882
authored
Jul 11, 2019
by
Filipa Lacerda
Committed by
Douglas Barbosa Alexandre
Jul 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move methods to TreeHelper
Create an EE::TreeHelper version Add specs for the method
parent
31737656
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
1 deletion
+68
-1
app/helpers/tree_helper.rb
app/helpers/tree_helper.rb
+9
-0
app/views/projects/tree/_tree_content.html.haml
app/views/projects/tree/_tree_content.html.haml
+1
-1
ee/app/helpers/ee/tree_helper.rb
ee/app/helpers/ee/tree_helper.rb
+16
-0
ee/spec/helpers/ee/tree_helper_spec.rb
ee/spec/helpers/ee/tree_helper_spec.rb
+42
-0
No files found.
app/helpers/tree_helper.rb
View file @
a5624882
...
...
@@ -147,4 +147,13 @@ module TreeHelper
def
relative_url_root
Gitlab
.
config
.
gitlab
.
relative_url_root
.
presence
||
'/'
end
# project and path are used on the EE version
def
tree_content_data
(
logs_path
,
project
,
path
)
{
"logs-path"
=>
logs_path
}
end
end
TreeHelper
.
prepend
(
::
EE
::
TreeHelper
)
app/views/projects/tree/_tree_content.html.haml
View file @
a5624882
.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
.table
#tree-slider
{
class:
"table_#{@hex_path} tree-table qa-file-tree"
}
%thead
...
...
ee/app/helpers/ee/tree_helper.rb
0 → 100644
View file @
a5624882
# 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
ee/spec/helpers/ee/tree_helper_spec.rb
0 → 100644
View file @
a5624882
# 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
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