Generalize the account completion field.

This commit is contained in:
takezoe
2013-09-22 13:35:05 +09:00
parent e9901a8abf
commit a79180699e
3 changed files with 17 additions and 23 deletions

View File

@@ -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();

View 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>

View File

@@ -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>