VRFS-1442 refresh session band list each time entering step3

This commit is contained in:
Jonathan Kolyer 2014-12-03 08:08:43 +00:00
parent 868ca0b476
commit e834a1dfd6
3 changed files with 21 additions and 3 deletions

View File

@ -443,6 +443,16 @@
});
}
function getBands(userId) {
var url = "/api/users/" + userId + "/bands";
return $.ajax({
type: "GET",
dataType: "json",
url: url,
processData:false
});
}
function getSession(id) {
var url = "/api/sessions/" + id;
return $.ajax({

View File

@ -215,6 +215,17 @@
}
function beforeShowStep3() {
rest.getBands(context.JK.currentUserId)
.done(function(result) {
var options = $("#session-band-list");
options.empty();
options.append($("<option />").val('').text('No'));
$.each(result, function(idx, item) {
options.append($("<option />").attr('value',item.id).text(item.name));
});
context.JK.dropdown($bandList);
})
.fail(app.ajaxError)
}
function beforeShowStep4() {

View File

@ -242,9 +242,6 @@
<h3 class="session-band-list-header">Is this a band session?</h3>
<select id="session-band-list">
<option value="">No</option>
<% current_user.bands.each do |band| %>
<option value="<%= band.id %>"><%= band.name[0..64] %></option>
<% end %>
</select>
<div class="clearall"></div>
<h3 class="session-language-list-header">What language will be spoken?</h3>