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
Boxiang Sun
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
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
599 additions
and
606 deletions
+599
-606
app/assets/javascripts/users_select.js
app/assets/javascripts/users_select.js
+599
-606
No files found.
app/assets/javascripts/users_select.js
View file @
2c5e70be
...
@@ -5,15 +5,10 @@
...
@@ -5,15 +5,10 @@
// TODO: remove eventHub hack after code splitting refactor
// TODO: remove eventHub hack after code splitting refactor
window
.
emitSidebarEvent
=
window
.
emitSidebarEvent
||
$
.
noop
;
window
.
emitSidebarEvent
=
window
.
emitSidebarEvent
||
$
.
noop
;
(
function
()
{
function
UsersSelect
(
currentUser
,
els
)
{
var
bind
=
function
(
fn
,
me
)
{
return
function
()
{
return
fn
.
apply
(
me
,
arguments
);
};
},
slice
=
[].
slice
;
this
.
UsersSelect
=
(
function
()
{
function
UsersSelect
(
currentUser
,
els
)
{
var
$els
;
var
$els
;
this
.
users
=
bind
(
this
.
users
,
this
);
this
.
users
=
this
.
users
.
bind
(
this
);
this
.
user
=
bind
(
this
.
user
,
this
);
this
.
user
=
this
.
user
.
bind
(
this
);
this
.
usersPath
=
"
/autocomplete/users.json
"
;
this
.
usersPath
=
"
/autocomplete/users.json
"
;
this
.
userPath
=
"
/autocomplete/users/:id.json
"
;
this
.
userPath
=
"
/autocomplete/users/:id.json
"
;
if
(
currentUser
!=
null
)
{
if
(
currentUser
!=
null
)
{
...
@@ -566,17 +561,17 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
...
@@ -566,17 +561,17 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
},
},
initSelection
:
function
()
{
initSelection
:
function
()
{
var
args
;
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
args
=
1
<=
arguments
.
length
?
[].
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
initSelection
.
apply
(
_this
,
args
);
return
_this
.
initSelection
.
apply
(
_this
,
args
);
},
},
formatResult
:
function
()
{
formatResult
:
function
()
{
var
args
;
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
args
=
1
<=
arguments
.
length
?
[].
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
formatResult
.
apply
(
_this
,
args
);
return
_this
.
formatResult
.
apply
(
_this
,
args
);
},
},
formatSelection
:
function
()
{
formatSelection
:
function
()
{
var
args
;
var
args
;
args
=
1
<=
arguments
.
length
?
slice
.
call
(
arguments
,
0
)
:
[];
args
=
1
<=
arguments
.
length
?
[].
slice
.
call
(
arguments
,
0
)
:
[];
return
_this
.
formatSelection
.
apply
(
_this
,
args
);
return
_this
.
formatSelection
.
apply
(
_this
,
args
);
},
},
dropdownCssClass
:
"
ajax-users-dropdown
"
,
dropdownCssClass
:
"
ajax-users-dropdown
"
,
...
@@ -587,9 +582,9 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
...
@@ -587,9 +582,9 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
});
});
};
};
})(
this
));
})(
this
));
}
}
UsersSelect
.
prototype
.
initSelection
=
function
(
element
,
callback
)
{
UsersSelect
.
prototype
.
initSelection
=
function
(
element
,
callback
)
{
var
id
,
nullUser
;
var
id
,
nullUser
;
id
=
$
(
element
).
val
();
id
=
$
(
element
).
val
();
if
(
id
===
"
0
"
)
{
if
(
id
===
"
0
"
)
{
...
@@ -600,9 +595,9 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
...
@@ -600,9 +595,9 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
}
else
if
(
id
!==
""
)
{
}
else
if
(
id
!==
""
)
{
return
this
.
user
(
id
,
callback
);
return
this
.
user
(
id
,
callback
);
}
}
};
};
UsersSelect
.
prototype
.
formatResult
=
function
(
user
)
{
UsersSelect
.
prototype
.
formatResult
=
function
(
user
)
{
var
avatar
;
var
avatar
;
if
(
user
.
avatar_url
)
{
if
(
user
.
avatar_url
)
{
avatar
=
user
.
avatar_url
;
avatar
=
user
.
avatar_url
;
...
@@ -610,13 +605,13 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
...
@@ -610,13 +605,13 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
avatar
=
gon
.
default_avatar_url
;
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>
"
;
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
;
return
user
.
name
;
};
};
UsersSelect
.
prototype
.
user
=
function
(
user_id
,
callback
)
{
UsersSelect
.
prototype
.
user
=
function
(
user_id
,
callback
)
{
if
(
!
/^
\d
+$/
.
test
(
user_id
))
{
if
(
!
/^
\d
+$/
.
test
(
user_id
))
{
return
false
;
return
false
;
}
}
...
@@ -630,11 +625,11 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
...
@@ -630,11 +625,11 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
}).
done
(
function
(
user
)
{
}).
done
(
function
(
user
)
{
return
callback
(
user
);
return
callback
(
user
);
});
});
};
};
// Return users list. Filtered by query
// Return users list. Filtered by query
// Only active users retrieved
// Only active users retrieved
UsersSelect
.
prototype
.
users
=
function
(
query
,
options
,
callback
)
{
UsersSelect
.
prototype
.
users
=
function
(
query
,
options
,
callback
)
{
var
url
;
var
url
;
url
=
this
.
buildUrl
(
this
.
usersPath
);
url
=
this
.
buildUrl
(
this
.
usersPath
);
return
$
.
ajax
({
return
$
.
ajax
({
...
@@ -657,15 +652,13 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
...
@@ -657,15 +652,13 @@ window.emitSidebarEvent = window.emitSidebarEvent || $.noop;
}).
done
(
function
(
users
)
{
}).
done
(
function
(
users
)
{
return
callback
(
users
);
return
callback
(
users
);
});
});
};
};
UsersSelect
.
prototype
.
buildUrl
=
function
(
url
)
{
UsersSelect
.
prototype
.
buildUrl
=
function
(
url
)
{
if
(
gon
.
relative_url_root
!=
null
)
{
if
(
gon
.
relative_url_root
!=
null
)
{
url
=
gon
.
relative_url_root
.
replace
(
/
\/
$/
,
''
)
+
url
;
url
=
gon
.
relative_url_root
.
replace
(
/
\/
$/
,
''
)
+
url
;
}
}
return
url
;
return
url
;
};
};
return
UsersSelect
;
export
default
UsersSelect
;
})();
}).
call
(
window
);
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