BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
2c5e70be
Commit
2c5e70be
authored
May 12, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix conflict on users_select
parent
28ebd706
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
29 deletions
+22
-29
users_select.js
app/assets/javascripts/users_select.js
+22
-29
No files found.
app/assets/javascripts/users_select.js
View file @
2c5e70be
...
...
@@ -5,15 +5,10 @@
// TODO: remove eventHub hack after code splitting refactor
window
.
emitSidebarEvent
=
window
.
emitSidebarEvent
||
$
.
noop
;
(
function
()
{
var
bind
=
function
(
fn
,
me
)
{
return
function
()
{
return
fn
.
apply
(
me
,
arguments
);
};
},
slice
=
[].
slice
;
this
.
UsersSelect
=
(
function
()
{
function
UsersSelect
(
currentUser
,
els
)
{
function
UsersSelect
(
currentUser
,
els
)
{
var
$els
;
this
.
users
=
bind
(
this
.
users
,
this
);
this
.
user
=
bind
(
this
.
user
,
this
);
this
.
users
=
this
.
users
.
bind
(
this
);
this
.
user
=
this
.
user
.
bind
(
this
);
this
.
usersPath
=
"/autocomplete/users.json"
;
this
.
userPath
=
"/autocomplete/users/:id.json"
;
if
(
currentUser
!=
null
)
{
...
...
@@ -566,17 +561,17 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
},
initSelection
:
function
()
{
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
args
=
1
<=
arguments
.
length
?
[].
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
initSelection
.
apply
(
_this
,
args
);
},
formatResult
:
function
()
{
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
args
=
1
<=
arguments
.
length
?
[].
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
formatResult
.
apply
(
_this
,
args
);
},
formatSelection
:
function
()
{
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
args
=
1
<=
arguments
.
length
?
[].
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
formatSelection
.
apply
(
_this
,
args
);
},
dropdownCssClass
:
"ajax-users-dropdown"
,
...
...
@@ -587,9 +582,9 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
});
};
})(
this
));
}
}
UsersSelect
.
prototype
.
initSelection
=
function
(
element
,
callback
)
{
UsersSelect
.
prototype
.
initSelection
=
function
(
element
,
callback
)
{
var
id
,
nullUser
;
id
=
$
(
element
).
val
();
if
(
id
===
"0"
)
{
...
...
@@ -600,9 +595,9 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
}
else
if
(
id
!==
""
)
{
return
this
.
user
(
id
,
callback
);
}
};
};
UsersSelect
.
prototype
.
formatResult
=
function
(
user
)
{
UsersSelect
.
prototype
.
formatResult
=
function
(
user
)
{
var
avatar
;
if
(
user
.
avatar_url
)
{
avatar
=
user
.
avatar_url
;
...
...
@@ -610,13 +605,13 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
avatar
=
gon
.
default_avatar_url
;
}
return
"<div class='user-result "
+
(
!
user
.
username
?
'no-username'
:
void
0
)
+
"'> <div class='user-image'><img class='avatar s24' src='"
+
avatar
+
"'></div> <div class='user-name'>"
+
user
.
name
+
"</div> <div class='user-username'>"
+
(
user
.
username
||
""
)
+
"</div> </div>"
;
};
};
UsersSelect
.
prototype
.
formatSelection
=
function
(
user
)
{
UsersSelect
.
prototype
.
formatSelection
=
function
(
user
)
{
return
user
.
name
;
};
};
UsersSelect
.
prototype
.
user
=
function
(
user_id
,
callback
)
{
UsersSelect
.
prototype
.
user
=
function
(
user_id
,
callback
)
{
if
(
!
/^
\d
+$/
.
test
(
user_id
))
{
return
false
;
}
...
...
@@ -630,11 +625,11 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
}).
done
(
function
(
user
)
{
return
callback
(
user
);
});
};
};
// Return users list. Filtered by query
// Only active users retrieved
UsersSelect
.
prototype
.
users
=
function
(
query
,
options
,
callback
)
{
// Return users list. Filtered by query
// Only active users retrieved
UsersSelect
.
prototype
.
users
=
function
(
query
,
options
,
callback
)
{
var
url
;
url
=
this
.
buildUrl
(
this
.
usersPath
);
return
$
.
ajax
({
...
...
@@ -657,15 +652,13 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
}).
done
(
function
(
users
)
{
return
callback
(
users
);
});
};
};
UsersSelect
.
prototype
.
buildUrl
=
function
(
url
)
{
UsersSelect
.
prototype
.
buildUrl
=
function
(
url
)
{
if
(
gon
.
relative_url_root
!=
null
)
{
url
=
gon
.
relative_url_root
.
replace
(
/
\/
$/
,
''
)
+
url
;
}
return
url
;
};
};
return
UsersSelect
;
})();
}).
call
(
window
);
export
default
UsersSelect
;
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