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
Jérome Perrin
gitlab-ce
Commits
6149c2e2
Commit
6149c2e2
authored
Jun 30, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor VisibilitySelect class to ES module syntax
parent
f8909396
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
9 deletions
+5
-9
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+0
-1
app/assets/javascripts/project_new.js
app/assets/javascripts/project_new.js
+3
-1
app/assets/javascripts/visibility_select.js
app/assets/javascripts/visibility_select.js
+1
-4
spec/javascripts/visibility_select_spec.js
spec/javascripts/visibility_select_spec.js
+1
-3
No files found.
app/assets/javascripts/main.js
View file @
6149c2e2
...
@@ -160,7 +160,6 @@ import './user_tabs';
...
@@ -160,7 +160,6 @@ import './user_tabs';
import
'
./username_validator
'
;
import
'
./username_validator
'
;
import
'
./users_select
'
;
import
'
./users_select
'
;
import
'
./version_check_image
'
;
import
'
./version_check_image
'
;
import
'
./visibility_select
'
;
// eslint-disable-next-line global-require, import/no-commonjs
// eslint-disable-next-line global-require, import/no-commonjs
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
require
(
'
./test_utils/
'
);
if
(
process
.
env
.
NODE_ENV
!==
'
production
'
)
require
(
'
./test_utils/
'
);
...
...
app/assets/javascripts/project_new.js
View file @
6149c2e2
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-vars, one-var, no-underscore-dangle, prefer-template, no-else-return, prefer-arrow-callback, max-len */
/* eslint-disable func-names, space-before-function-paren, no-var, prefer-rest-params, wrap-iife, no-unused-vars, one-var, no-underscore-dangle, prefer-template, no-else-return, prefer-arrow-callback, max-len */
import
VisibilitySelect
from
'
./visibility_select
'
;
function
highlightChanges
(
$elm
)
{
function
highlightChanges
(
$elm
)
{
$elm
.
addClass
(
'
highlight-changes
'
);
$elm
.
addClass
(
'
highlight-changes
'
);
setTimeout
(()
=>
$elm
.
removeClass
(
'
highlight-changes
'
),
10
);
setTimeout
(()
=>
$elm
.
removeClass
(
'
highlight-changes
'
),
10
);
...
@@ -30,7 +32,7 @@ function highlightChanges($elm) {
...
@@ -30,7 +32,7 @@ function highlightChanges($elm) {
ProjectNew
.
prototype
.
initVisibilitySelect
=
function
()
{
ProjectNew
.
prototype
.
initVisibilitySelect
=
function
()
{
const
visibilityContainer
=
document
.
querySelector
(
'
.js-visibility-select
'
);
const
visibilityContainer
=
document
.
querySelector
(
'
.js-visibility-select
'
);
if
(
!
visibilityContainer
)
return
;
if
(
!
visibilityContainer
)
return
;
const
visibilitySelect
=
new
gl
.
VisibilitySelect
(
visibilityContainer
);
const
visibilitySelect
=
new
VisibilitySelect
(
visibilityContainer
);
visibilitySelect
.
init
();
visibilitySelect
.
init
();
const
$visibilitySelect
=
$
(
visibilityContainer
).
find
(
'
select
'
);
const
$visibilitySelect
=
$
(
visibilityContainer
).
find
(
'
select
'
);
...
...
app/assets/javascripts/visibility_select.js
View file @
6149c2e2
class
VisibilitySelect
{
export
default
class
VisibilitySelect
{
constructor
(
container
)
{
constructor
(
container
)
{
if
(
!
container
)
throw
new
Error
(
'
VisibilitySelect requires a container element as argument 1
'
);
if
(
!
container
)
throw
new
Error
(
'
VisibilitySelect requires a container element as argument 1
'
);
this
.
container
=
container
;
this
.
container
=
container
;
...
@@ -19,6 +19,3 @@ class VisibilitySelect {
...
@@ -19,6 +19,3 @@ class VisibilitySelect {
this
.
helpBlock
.
textContent
=
this
.
select
.
querySelector
(
'
option:checked
'
).
dataset
.
description
;
this
.
helpBlock
.
textContent
=
this
.
select
.
querySelector
(
'
option:checked
'
).
dataset
.
description
;
}
}
}
}
window
.
gl
=
window
.
gl
||
{};
window
.
gl
.
VisibilitySelect
=
VisibilitySelect
;
spec/javascripts/visibility_select_spec.js
View file @
6149c2e2
import
'
~/visibility_select
'
;
import
VisibilitySelect
from
'
~/visibility_select
'
;
(()
=>
{
(()
=>
{
const
VisibilitySelect
=
gl
.
VisibilitySelect
;
describe
(
'
VisibilitySelect
'
,
function
()
{
describe
(
'
VisibilitySelect
'
,
function
()
{
const
lockedElement
=
document
.
createElement
(
'
div
'
);
const
lockedElement
=
document
.
createElement
(
'
div
'
);
lockedElement
.
dataset
.
helpBlock
=
'
lockedHelpBlock
'
;
lockedElement
.
dataset
.
helpBlock
=
'
lockedHelpBlock
'
;
...
...
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