mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
(refs #8)Merge user name proposal API to IndexController.
This commit is contained in:
@@ -5,10 +5,12 @@ import service._
|
|||||||
import jp.sf.amateras.scalatra.forms._
|
import jp.sf.amateras.scalatra.forms._
|
||||||
|
|
||||||
class IndexController extends IndexControllerBase
|
class IndexController extends IndexControllerBase
|
||||||
with RepositoryService with AccountService with SystemSettingsService with ActivityService
|
with RepositoryService with SystemSettingsService with ActivityService with AccountService
|
||||||
|
with UsersAuthenticator
|
||||||
|
|
||||||
trait IndexControllerBase extends ControllerBase { self: RepositoryService
|
trait IndexControllerBase extends ControllerBase {
|
||||||
with SystemSettingsService with ActivityService =>
|
self: RepositoryService with SystemSettingsService with ActivityService with AccountService
|
||||||
|
with UsersAuthenticator =>
|
||||||
|
|
||||||
get("/"){
|
get("/"){
|
||||||
val loginAccount = context.loginAccount
|
val loginAccount = context.loginAccount
|
||||||
@@ -20,4 +22,14 @@ trait IndexControllerBase extends ControllerBase { self: RepositoryService
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JSON API for collaborator completion.
|
||||||
|
*/
|
||||||
|
// TODO Move to other controller?
|
||||||
|
get("/_user/proposals")(usersOnly {
|
||||||
|
contentType = formats("json")
|
||||||
|
org.json4s.jackson.Serialization.write(Map("options" -> getAllUsers.filter(!_.isGroupAccount).map(_.userName).toArray))
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,14 +57,14 @@ trait RepositorySettingsControllerBase extends ControllerBase with FlashMapSuppo
|
|||||||
settings.html.collaborators(getCollaborators(repository.owner, repository.name), repository)
|
settings.html.collaborators(getCollaborators(repository.owner, repository.name), repository)
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* JSON API for collaborator completion.
|
// * JSON API for collaborator completion.
|
||||||
*/
|
// */
|
||||||
// TODO Merge with UserManagementController
|
// // TODO Merge with UserManagementController
|
||||||
get("/:owner/:repository/settings/collaborators/proposals")(usersOnly {
|
// get("/:owner/:repository/settings/collaborators/proposals")(usersOnly {
|
||||||
contentType = formats("json")
|
// contentType = formats("json")
|
||||||
org.json4s.jackson.Serialization.write(Map("options" -> getAllUsers.filter(!_.isGroupAccount).map(_.userName).toArray))
|
// org.json4s.jackson.Serialization.write(Map("options" -> getAllUsers.filter(!_.isGroupAccount).map(_.userName).toArray))
|
||||||
})
|
// })
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the collaborator.
|
* Add the collaborator.
|
||||||
|
|||||||
@@ -126,13 +126,13 @@ trait UserManagementControllerBase extends AccountManagementControllerBase {
|
|||||||
} getOrElse NotFound
|
} getOrElse NotFound
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* JSON API for collaborator completion.
|
// * JSON API for collaborator completion.
|
||||||
*/
|
// */
|
||||||
// TODO Merge with RepositorySettingsController
|
// // TODO Merge with RepositorySettingsController
|
||||||
get("/admin/users/_members"){
|
// get("/admin/users/_members"){
|
||||||
contentType = formats("json")
|
// contentType = formats("json")
|
||||||
org.json4s.jackson.Serialization.write(Map("options" -> getAllUsers.filter(!_.isGroupAccount).map(_.userName).toArray))
|
// org.json4s.jackson.Serialization.write(Map("options" -> getAllUsers.filter(!_.isGroupAccount).map(_.userName).toArray))
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
$(function(){
|
$(function(){
|
||||||
$('#memberName').typeahead({
|
$('#memberName').typeahead({
|
||||||
source: function (query, process) {
|
source: function (query, process) {
|
||||||
return $.get('@path/admin/users/_members', { query: query },
|
return $.get('@path/_user/proposals', { query: query },
|
||||||
function (data) {
|
function (data) {
|
||||||
return process(data.options);
|
return process(data.options);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
$(function(){
|
$(function(){
|
||||||
$('#userName').typeahead({
|
$('#userName').typeahead({
|
||||||
source: function (query, process) {
|
source: function (query, process) {
|
||||||
return $.get('@url(repository)/settings/collaborators/proposals', { query: query },
|
return $.get('@path/_user/proposals', { query: query },
|
||||||
function (data) {
|
function (data) {
|
||||||
return process(data.options);
|
return process(data.options);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user