fixed bug for autocomplete in member personal journals
This commit is contained in:
parent
075acef5d8
commit
5ac4d065e2
|
@ -1,16 +1,15 @@
|
|||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#search').typeahead({
|
||||
source: function (query, process) {
|
||||
members = [];
|
||||
map = {};
|
||||
|
||||
var data = <%=raw @members_data%>;
|
||||
var map = {},
|
||||
members = [],
|
||||
data = <%= raw @members_data %>;
|
||||
$.each(data, function (i, member) {
|
||||
map[member.memberName] = member;
|
||||
members.push(member.memberName);
|
||||
});
|
||||
process(members);
|
||||
$(document).ready(function(){
|
||||
$('#member_autocomplete').typeahead({
|
||||
source: function (query, process) {
|
||||
return members;
|
||||
},
|
||||
updater: function (item) {
|
||||
selectedMember = map[item].memberId;
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<div class="control-group input-title">
|
||||
<label class="control-label muted"><%= t("personal_journal.author") %></label>
|
||||
<div class="controls">
|
||||
<%= f.text_field :member_profile_id, id: "search", autocomplete: "off", data: { provide: "typeahead"}, class: "input-block-level", value: (@journal_paper.member_profile.name rescue nil), placeholder: t("personal_journal.author")%>
|
||||
<%= f.text_field :member_profile_id, id: "member_autocomplete", autocomplete: "off", data: { provide: "typeahead"}, class: "input-block-level", value: (@journal_paper.member_profile.name rescue nil), placeholder: t("personal_journal.author")%>
|
||||
|
||||
<%= f.hidden_field :member_profile_id, value: (@journal_paper.member_profile_id ? @journal_paper.member_profile_id : ""), id: "member_value" %>
|
||||
</div>
|
||||
|
@ -311,8 +311,6 @@
|
|||
<%= f.submit t('submit'), class: 'btn btn-primary' %>
|
||||
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
|
||||
</div>
|
||||
|
||||
|
||||
<%= render 'author_autocomplete'%>
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
|
|
Loading…
Reference in New Issue