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
Tatuya Kamada
gitlab-ce
Commits
27ee0fc5
Commit
27ee0fc5
authored
Dec 30, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Helper for ajax group selectbox
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
2660e83c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
0 deletions
+50
-0
app/assets/javascripts/api.js.coffee
app/assets/javascripts/api.js.coffee
+29
-0
app/assets/stylesheets/generic/selects.scss
app/assets/stylesheets/generic/selects.scss
+12
-0
app/helpers/selects_helper.rb
app/helpers/selects_helper.rb
+9
-0
No files found.
app/assets/javascripts/api.js.coffee
View file @
27ee0fc5
@
Api
=
groups_path
:
"/api/:version/groups.json"
group_path
:
"/api/:version/groups/:id.json"
users_path
:
"/api/:version/users.json"
user_path
:
"/api/:version/users/:id.json"
notes_path
:
"/api/:version/projects/:id/notes.json"
...
...
@@ -51,6 +53,33 @@
).
done
(
users
)
->
callback
(
users
)
group
:
(
group_id
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
group_path
)
url
=
url
.
replace
(
':id'
,
group_id
)
$
.
ajax
(
url
:
url
data
:
private_token
:
gon
.
api_token
dataType
:
"json"
).
done
(
group
)
->
callback
(
group
)
# Return groups list. Filtered by query
# Only active groups retrieved
groups
:
(
query
,
skip_ldap
,
callback
)
->
url
=
Api
.
buildUrl
(
Api
.
groups_path
)
$
.
ajax
(
url
:
url
data
:
private_token
:
gon
.
api_token
search
:
query
per_page
:
20
dataType
:
"json"
).
done
(
groups
)
->
callback
(
groups
)
# Return project users list. Filtered by query
# Only active users retrieved
projectUsers
:
(
project_id
,
query
,
callback
)
->
...
...
app/assets/stylesheets/generic/selects.scss
View file @
27ee0fc5
...
...
@@ -116,6 +116,18 @@ select {
}
}
.group-result
{
.group-image
{
float
:
left
;
}
.group-name
{
font-weight
:
bold
;
}
.group-path
{
color
:
#999
;
}
}
.user-result
{
.user-image
{
float
:
left
;
...
...
app/helpers/selects_helper.rb
View file @
27ee0fc5
...
...
@@ -17,4 +17,13 @@ module SelectsHelper
project_id
=
opts
[
:project_id
]
||
@project
.
id
hidden_field_tag
(
id
,
value
,
class:
css_class
,
'data-placeholder'
=>
placeholder
,
'data-project-id'
=>
project_id
)
end
def
groups_select_tag
(
id
,
opts
=
{})
css_class
=
"ajax-groups-select "
css_class
<<
"multiselect "
if
opts
[
:multiple
]
css_class
<<
(
opts
[
:class
]
||
''
)
value
=
opts
[
:selected
]
||
''
hidden_field_tag
(
id
,
value
,
class:
css_class
)
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