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
0a10d859
Commit
0a10d859
authored
Mar 02, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update JS to use new standards
parent
b7c30cae
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
83 additions
and
60 deletions
+83
-60
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+0
-1
app/assets/javascripts/dispatcher.js.es6
app/assets/javascripts/dispatcher.js.es6
+6
-0
app/assets/javascripts/groups_list.js
app/assets/javascripts/groups_list.js
+47
-50
app/views/dashboard/_groups_head.html.haml
app/views/dashboard/_groups_head.html.haml
+1
-1
app/views/dashboard/groups/_groups.html.haml
app/views/dashboard/groups/_groups.html.haml
+1
-1
app/views/dashboard/groups/index.html.haml
app/views/dashboard/groups/index.html.haml
+0
-3
app/views/explore/groups/_groups.html.haml
app/views/explore/groups/_groups.html.haml
+1
-1
app/views/explore/groups/index.html.haml
app/views/explore/groups/index.html.haml
+0
-3
config/webpack.config.js
config/webpack.config.js
+1
-0
spec/features/dashboard/groups_list_spec.rb
spec/features/dashboard/groups_list_spec.rb
+13
-0
spec/features/explore/groups_list_spec.rb
spec/features/explore/groups_list_spec.rb
+13
-0
No files found.
app/assets/javascripts/application.js
View file @
0a10d859
...
@@ -177,7 +177,6 @@ require('./project_select');
...
@@ -177,7 +177,6 @@ require('./project_select');
require
(
'
./project_show
'
);
require
(
'
./project_show
'
);
require
(
'
./project_variables
'
);
require
(
'
./project_variables
'
);
require
(
'
./projects_list
'
);
require
(
'
./projects_list
'
);
require
(
'
./groups_list
'
);
require
(
'
./render_gfm
'
);
require
(
'
./render_gfm
'
);
require
(
'
./render_math
'
);
require
(
'
./render_math
'
);
require
(
'
./right_sidebar
'
);
require
(
'
./right_sidebar
'
);
...
...
app/assets/javascripts/dispatcher.js.es6
View file @
0a10d859
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
/* global Labels */
/* global Labels */
/* global Shortcuts */
/* global Shortcuts */
import GroupsList from './groups_list';
const ShortcutsBlob = require('./shortcuts_blob');
const ShortcutsBlob = require('./shortcuts_blob');
const UserCallout = require('./user_callout');
const UserCallout = require('./user_callout');
...
@@ -96,6 +98,10 @@ const UserCallout = require('./user_callout');
...
@@ -96,6 +98,10 @@ const UserCallout = require('./user_callout');
case 'dashboard:todos:index':
case 'dashboard:todos:index':
new gl.Todos();
new gl.Todos();
break;
break;
case 'dashboard:groups:index':
case 'explore:groups:index':
new GroupsList();
break;
case 'projects:milestones:new':
case 'projects:milestones:new':
case 'projects:milestones:edit':
case 'projects:milestones:edit':
case 'projects:milestones:update':
case 'projects:milestones:update':
...
...
app/assets/javascripts/groups_list.js
View file @
0a10d859
/* eslint-disable func-names, space-before-function-paren, object-shorthand, quotes, no-var, one-var, one-var-declaration-per-line, prefer-arrow-callback, consistent-return, no-unused-vars, camelcase, prefer-template, comma-dangle, max-len */
/**
* Based on project list search.
(
function
()
{
* Makes search request for groups when user types a value in the search input.
window
.
GroupsList
=
{
* Updates the html content of the page with the received one.
init
:
function
()
{
*/
$
(
"
.groups-list-filter
"
).
off
(
'
keyup
'
);
export
default
class
GroupsList
{
this
.
initSearch
();
constructor
()
{
return
this
.
initPagination
();
this
.
groupsListFilterElement
=
document
.
querySelector
(
'
.js-groups-list-filter
'
);
},
this
.
groupsListHolderElement
=
document
.
querySelector
(
'
.js-groups-list-holder
'
);
initSearch
:
function
()
{
var
debounceFilter
,
groupsListFilter
;
this
.
initSearch
();
groupsListFilter
=
$
(
'
.groups-list-filter
'
);
}
debounceFilter
=
_
.
debounce
(
window
.
GroupsList
.
filterResults
,
500
);
return
groupsListFilter
.
on
(
'
keyup
'
,
function
(
e
)
{
initSearch
()
{
if
(
groupsListFilter
.
val
()
!==
''
)
{
this
.
debounceFilter
=
_
.
debounce
(
this
.
filterResults
.
bind
(
this
),
500
);
return
debounceFilter
();
}
this
.
groupsListFilterElement
.
removeEventListener
(
'
input
'
,
this
.
debounceFilter
);
});
this
.
groupsListFilterElement
.
addEventListener
(
'
input
'
,
this
.
debounceFilter
);
},
}
filterResults
:
function
()
{
var
form
,
group_filter_url
,
search
;
filterResults
()
{
$
(
'
.groups-list-holder
'
).
fadeTo
(
250
,
0.5
);
const
form
=
document
.
querySelector
(
'
form#group-filter-form
'
);
form
=
null
;
const
groupFilterUrl
=
`
${
form
.
getAttribute
(
'
action
'
)}
?
${
$
(
form
).
serialize
()}
`
;
form
=
$
(
"
form#group-filter-form
"
);
search
=
$
(
"
.groups-list-filter
"
).
val
();
$
(
this
.
groupsListHolderElement
).
fadeTo
(
250
,
0.5
);
group_filter_url
=
form
.
attr
(
'
action
'
)
+
'
?
'
+
form
.
serialize
();
return
$
.
ajax
({
return
$
.
ajax
({
type
:
"
GET
"
,
url
:
form
.
getAttribute
(
'
action
'
),
url
:
form
.
attr
(
'
action
'
),
data
:
$
(
form
).
serialize
(),
data
:
form
.
serialize
(),
type
:
'
GET
'
,
complete
:
function
()
{
dataType
:
'
json
'
,
return
$
(
'
.groups-list-holder
'
).
fadeTo
(
250
,
1
);
context
:
this
,
},
complete
()
{
success
:
function
(
data
)
{
$
(
this
.
groupsListHolderElement
).
fadeTo
(
250
,
1
);
$
(
'
.groups-list-holder
'
).
replaceWith
(
data
.
html
);
},
return
history
.
replaceState
({
success
(
data
)
{
page
:
group_filter_url
this
.
groupsListHolderElement
.
innerHTML
=
data
.
html
;
// Change url so if user reload a page - search results are saved
},
document
.
title
,
group_filter_url
);
// Change url so if user reload a page - search results are saved
},
return
window
.
history
.
replaceState
({
dataType
:
"
json
"
page
:
groupFilterUrl
,
});
},
},
document
.
title
,
groupFilterUrl
);
initPagination
:
function
()
{
},
return
$
(
'
.groups-list-holder .pagination
'
).
on
(
'
ajax:success
'
,
function
(
e
,
data
)
{
});
return
$
(
'
.groups-list-holder
'
).
replaceWith
(
data
.
html
);
}
});
}
}
};
}).
call
(
window
);
app/views/dashboard/_groups_head.html.haml
View file @
0a10d859
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
Explore Groups
Explore Groups
.nav-controls
.nav-controls
=
form_tag
request
.
path
,
method: :get
,
class:
'group-filter-form'
,
id:
'group-filter-form'
do
|
f
|
=
form_tag
request
.
path
,
method: :get
,
class:
'group-filter-form'
,
id:
'group-filter-form'
do
|
f
|
=
search_field_tag
:filter_groups
,
params
[
:filter_groups
],
placeholder:
'Filter by name...'
,
class:
'group-filter-form-field form-control input-short groups-list-filter'
,
spellcheck:
false
,
id:
'group-filter-form-field'
,
tabindex:
"2"
=
search_field_tag
:filter_groups
,
params
[
:filter_groups
],
placeholder:
'Filter by name...'
,
class:
'group-filter-form-field form-control input-short
js-
groups-list-filter'
,
spellcheck:
false
,
id:
'group-filter-form-field'
,
tabindex:
"2"
=
render
'shared/groups/dropdown'
=
render
'shared/groups/dropdown'
-
if
current_user
.
can_create_group?
-
if
current_user
.
can_create_group?
=
link_to
new_group_path
,
class:
"btn btn-new"
do
=
link_to
new_group_path
,
class:
"btn btn-new"
do
...
...
app/views/dashboard/groups/_groups.html.haml
View file @
0a10d859
.groups-list-holder
.
js-
groups-list-holder
%ul
.content-list
%ul
.content-list
-
@group_members
.
each
do
|
group_member
|
-
@group_members
.
each
do
|
group_member
|
-
group
=
group_member
.
group
-
group
=
group_member
.
group
...
...
app/views/dashboard/groups/index.html.haml
View file @
0a10d859
...
@@ -6,6 +6,3 @@
...
@@ -6,6 +6,3 @@
=
render
'empty_state'
=
render
'empty_state'
-
else
-
else
=
render
'groups'
=
render
'groups'
:javascript
GroupsList
.
init
();
app/views/explore/groups/_groups.html.haml
View file @
0a10d859
.groups-list-holder
.
js-
groups-list-holder
%ul
.content-list
%ul
.content-list
-
@groups
.
each
do
|
group
|
-
@groups
.
each
do
|
group
|
=
render
'shared/groups/group'
,
group:
group
=
render
'shared/groups/group'
,
group:
group
...
...
app/views/explore/groups/index.html.haml
View file @
0a10d859
...
@@ -13,6 +13,3 @@
...
@@ -13,6 +13,3 @@
.nothing-here-block
No public groups
.nothing-here-block
No public groups
=
paginate
@groups
,
theme:
"gitlab"
=
paginate
@groups
,
theme:
"gitlab"
:javascript
GroupsList
.
init
();
config/webpack.config.js
View file @
0a10d859
...
@@ -28,6 +28,7 @@ var config = {
...
@@ -28,6 +28,7 @@ var config = {
environments_folder
:
'
./environments/folder/environments_folder_bundle.js
'
,
environments_folder
:
'
./environments/folder/environments_folder_bundle.js
'
,
filtered_search
:
'
./filtered_search/filtered_search_bundle.js
'
,
filtered_search
:
'
./filtered_search/filtered_search_bundle.js
'
,
graphs
:
'
./graphs/graphs_bundle.js
'
,
graphs
:
'
./graphs/graphs_bundle.js
'
,
groups_list
:
'
./groups_list.js
'
,
issuable
:
'
./issuable/issuable_bundle.js
'
,
issuable
:
'
./issuable/issuable_bundle.js
'
,
merge_conflicts
:
'
./merge_conflicts/merge_conflicts_bundle.js
'
,
merge_conflicts
:
'
./merge_conflicts/merge_conflicts_bundle.js
'
,
merge_request_widget
:
'
./merge_request_widget/ci_bundle.js
'
,
merge_request_widget
:
'
./merge_request_widget/ci_bundle.js
'
,
...
...
spec/features/dashboard/groups_list_spec.rb
View file @
0a10d859
...
@@ -31,4 +31,17 @@ RSpec.describe 'Dashboard Groups page', js: true, feature: true do
...
@@ -31,4 +31,17 @@ RSpec.describe 'Dashboard Groups page', js: true, feature: true do
expect
(
page
).
not_to
have_content
(
nested_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
nested_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
another_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
another_group
.
full_name
)
end
end
it
'resets search when user cleans the input'
do
fill_in
'filter_groups'
,
with:
group
.
name
wait_for_ajax
fill_in
'filter_groups'
,
with:
""
wait_for_ajax
expect
(
page
).
to
have_content
(
group
.
full_name
)
expect
(
page
).
to
have_content
(
public_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
private_group
.
full_name
)
expect
(
page
.
all
(
'.js-groups-list-holder .content-list li'
).
length
).
to
eq
2
end
end
end
spec/features/explore/groups_list_spec.rb
View file @
0a10d859
...
@@ -30,4 +30,17 @@ RSpec.describe 'Explore Groups page', js: true, feature: true do
...
@@ -30,4 +30,17 @@ RSpec.describe 'Explore Groups page', js: true, feature: true do
expect
(
page
).
not_to
have_content
(
public_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
public_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
private_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
private_group
.
full_name
)
end
end
it
'resets search when user cleans the input'
do
fill_in
'filter_groups'
,
with:
group
.
name
wait_for_ajax
fill_in
'filter_groups'
,
with:
""
wait_for_ajax
expect
(
page
).
to
have_content
(
group
.
full_name
)
expect
(
page
).
to
have_content
(
public_group
.
full_name
)
expect
(
page
).
not_to
have_content
(
private_group
.
full_name
)
expect
(
page
.
all
(
'.js-groups-list-holder .content-list li'
).
length
).
to
eq
2
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