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
Léo-Paul Géneau
gitlab-ce
Commits
9cce812a
Commit
9cce812a
authored
Dec 24, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add `client_detection` helper to add browser and plaform flags
parent
60d3fe58
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+11
-0
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+15
-0
No files found.
app/helpers/application_helper.rb
View file @
9cce812a
...
@@ -268,6 +268,17 @@ module ApplicationHelper
...
@@ -268,6 +268,17 @@ module ApplicationHelper
_
(
'You are on a read-only GitLab instance.'
)
_
(
'You are on a read-only GitLab instance.'
)
end
end
def
client_class_list
"gl-browser-
#{
browser
.
id
}
gl-platform-
#{
browser
.
platform
.
id
}
"
end
def
client_js_flags
{
"is
#{
browser
.
id
.
to_s
.
titlecase
}
"
:
true
,
"is
#{
browser
.
platform
.
id
.
to_s
.
titlecase
}
"
:
true
}
end
def
autocomplete_data_sources
(
object
,
noteable_type
)
def
autocomplete_data_sources
(
object
,
noteable_type
)
return
{}
unless
object
&&
noteable_type
return
{}
unless
object
&&
noteable_type
...
...
spec/helpers/application_helper_spec.rb
View file @
9cce812a
...
@@ -168,6 +168,21 @@ describe ApplicationHelper do
...
@@ -168,6 +168,21 @@ describe ApplicationHelper do
end
end
end
end
describe
'#client_class_list'
do
it
'returns string containing CSS classes representing client browser and platform'
do
class_list
=
helper
.
client_class_list
expect
(
class_list
).
to
eq
(
'gl-browser-generic gl-platform-other'
)
end
end
describe
'#client_js_flags'
do
it
'returns map containing JS flags representing client browser and platform'
do
flags_list
=
helper
.
client_js_flags
expect
(
flags_list
[
:isGeneric
]).
to
eq
(
true
)
expect
(
flags_list
[
:isOther
]).
to
eq
(
true
)
end
end
describe
'#autocomplete_data_sources'
do
describe
'#autocomplete_data_sources'
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:noteable_type
)
{
Issue
}
let
(
:noteable_type
)
{
Issue
}
...
...
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