mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-03 03:55:58 +01:00
Generalize the account completion field.
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<input type="text" id="memberName" style="width: 200px; margin-bottom: 0px;"/>
|
||||
@helper.html.account("memberName", 200)
|
||||
<input type="button" class="btn" value="Add" id="addMember"/>
|
||||
<input type="hidden" id="memberNames" name="memberNames" value="@members.mkString(",")"/>
|
||||
<div>
|
||||
@@ -50,15 +50,6 @@
|
||||
}
|
||||
<script>
|
||||
$(function(){
|
||||
$('#memberName').typeahead({
|
||||
source: function (query, process) {
|
||||
return $.get('@path/_user/proposals', { query: query },
|
||||
function (data) {
|
||||
return process(data.options);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$('#addMember').click(function(){
|
||||
$('#error-memberName').text('');
|
||||
var userName = $('#memberName').val();
|
||||
|
||||
15
src/main/twirl/helper/account.scala.html
Normal file
15
src/main/twirl/helper/account.scala.html
Normal file
@@ -0,0 +1,15 @@
|
||||
@(id: String, width: Int)(implicit context: app.Context)
|
||||
@import context._
|
||||
<input type="text" name="@id" id="@id" style="width: @{width}px; margin-bottom: 0px;"/>
|
||||
<script>
|
||||
$(function(){
|
||||
$('#@id').typeahead({
|
||||
source: function (query, process) {
|
||||
return $.get('@path/_user/proposals', { query: query },
|
||||
function (data) {
|
||||
return process(data.options);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -22,21 +22,9 @@
|
||||
<div>
|
||||
<span class="error" id="error-userName"></span>
|
||||
</div>
|
||||
<input type="text" name="userName" id="userName" style="width: 300px; margin-bottom: 0px;"/>
|
||||
@helper.html.account("userName", 300)
|
||||
<input type="submit" class="btn" value="Add"/>
|
||||
</form>
|
||||
}
|
||||
}
|
||||
}
|
||||
<script>
|
||||
$(function(){
|
||||
$('#userName').typeahead({
|
||||
source: function (query, process) {
|
||||
return $.get('@path/_user/proposals', { query: query },
|
||||
function (data) {
|
||||
return process(data.options);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user