fix band section listing musicians
This commit is contained in:
parent
bcd819dfc3
commit
7c2ffe01ef
|
|
@ -23,8 +23,11 @@ module JamRuby
|
|||
validate :validate_photo_info
|
||||
validate :require_at_least_one_genre, :unless => :skip_genre_validation
|
||||
validate :limit_max_genres
|
||||
validates_numericality_of :hourly_rate, greater_than:0, less_than:100000, :if => :paid_gigs
|
||||
validates_numericality_of :gig_minimum, greater_than:0, less_than:200000, :if => :paid_gigs
|
||||
#validates_numericality_of :hourly_rate, greater_than:0, less_than:100000, :if => :paid_gigs, allow_blank: true
|
||||
validates :hourly_rate, numericality: { greater_than:0, less_than:100000 }, :if => :paid_gigs
|
||||
|
||||
#validates_numericality_of :gig_minimum, greater_than:0, less_than:200000, :if => :paid_gigs, allow_blank: true
|
||||
validates :gig_minimum, numericality: { greater_than:0, less_than:200000 }, :if => :paid_gigs
|
||||
|
||||
before_save :check_lat_lng
|
||||
before_save :check_website_url
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@
|
|||
|
||||
// refreshes the currently active tab
|
||||
function renderActive() {
|
||||
|
||||
console.log("_DEBUG_ renderActive isAdmin: " + isAdmin + " isMember: " + isMember);
|
||||
if (isMember) {
|
||||
$("#btn-follow-band").hide();
|
||||
$("#btn-edit-band-profile").show();
|
||||
|
|
@ -549,6 +549,7 @@
|
|||
error: app.ajaxError
|
||||
})
|
||||
.done(function(response) {
|
||||
console.log("_DEBUG_ determineMembership response: " + JSON.stringify(response));
|
||||
isAdmin = isMember = false;
|
||||
$.each(response, function(index, val) {
|
||||
if (val.id === context.JK.currentUserId) {
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@
|
|||
}
|
||||
|
||||
function renderErrors(errors) {
|
||||
logger.debug("Band setup errors: ", errors)
|
||||
console.log("Band setup errors: ", errors)
|
||||
var name = context.JK.format_errors("name", errors);
|
||||
var country = context.JK.format_errors("country", errors);
|
||||
var state = context.JK.format_errors("state", errors);
|
||||
|
|
@ -205,6 +205,8 @@
|
|||
var biography = context.JK.format_errors("biography", errors);
|
||||
var website = context.JK.format_errors("website", errors);
|
||||
var genres = context.JK.format_errors("genres", errors);
|
||||
var hourly_rate = context.JK.format_errors("hourly_rate", errors);
|
||||
var gig_minimum = context.JK.format_errors("gig_minimum", errors);
|
||||
|
||||
if(name) $("#band-name").closest('div.field').addClass('error').end().after(name);
|
||||
if(country) $("#band-country").closest('div.field').addClass('error').end().after(country);
|
||||
|
|
@ -213,6 +215,8 @@
|
|||
if(biography) $("#band-biography").closest('div.field').addClass('error').end().after(biography);
|
||||
if(website) $("#band-website").closest('div.field').addClass('error').end().after(website);
|
||||
if(genres) $("#band-genres").closest('div.field').addClass('error').end().after(genres);
|
||||
if(hourly_rate) $("#hourly-rate").closest('div.field').addClass('error').end().after(hourly_rate);
|
||||
if(gig_minimum) $("#gig-minimum").closest('div.field').addClass('error').end().after(gig_minimum);
|
||||
}
|
||||
|
||||
function buildBand() {
|
||||
|
|
@ -402,6 +406,7 @@
|
|||
|
||||
function loadBandDetails() {
|
||||
rest.getBand(bandId).done(function (band) {
|
||||
console.log("Band details: ", band)
|
||||
$("#band-name").val(band.name);
|
||||
$("#band-website").val(band.website);
|
||||
$("#band-biography").val(band.biography);
|
||||
|
|
@ -411,21 +416,27 @@
|
|||
concertCount.val(band.concert_count)
|
||||
|
||||
if (band.add_new_members){
|
||||
$("#new-member-no").iCheck('check').attr('checked', 'checked')
|
||||
} else {
|
||||
$("#new-member-yes").iCheck('check').attr('checked', 'checked')
|
||||
$("#new-member-no").iCheck('uncheck').removeAttr('checked')
|
||||
} else {
|
||||
$("#new-member-no").iCheck('check').attr('checked', 'checked')
|
||||
$("#new-member-yes").iCheck('uncheck').removeAttr('checked')
|
||||
}
|
||||
|
||||
if (band.paid_gigs) {
|
||||
$("#paid-gigs-no").iCheck('check').attr('checked', 'checked')
|
||||
} else {
|
||||
$("#paid-gigs-yes").iCheck('check').attr('checked', 'checked')
|
||||
$("#paid-gigs-no").iCheck('uncheck').removeAttr('checked')
|
||||
} else {
|
||||
$("#paid-gigs-no").iCheck('check').attr('checked', 'checked')
|
||||
$("#paid-gigs-yes").iCheck('uncheck').removeAttr('checked')
|
||||
}
|
||||
|
||||
if (band.free_gigs) {
|
||||
$("#free-gigs-no").iCheck('check').attr('checked', 'checked')
|
||||
} else {
|
||||
$("#free-gigs-yes").iCheck('check').attr('checked', 'checked')
|
||||
$("#free-gigs-no").iCheck('uncheck').removeAttr('checked')
|
||||
} else {
|
||||
$("#free-gigs-no").iCheck('check').attr('checked', 'checked')
|
||||
$("#free-gigs-yes").iCheck('uncheck').removeAttr('checked')
|
||||
}
|
||||
|
||||
$('#touring-option').val(band.touring_option ? 'yes' : 'no')
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ collection @musicians
|
|||
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :follower_count, :following_count, :recording_count, :session_count, :biography
|
||||
|
||||
node :band_admin do |musician|
|
||||
musician.respond_to?(:band_admin) && 't' == musician.band_admin ? true : false
|
||||
musician.respond_to?(:band_admin) && musician.band_admin ? true : false
|
||||
end
|
||||
|
||||
node :invitation_id do |musician|
|
||||
|
|
|
|||
|
|
@ -3,31 +3,44 @@ collection @bands
|
|||
# do not retrieve all child collections when showing a list of bands
|
||||
attributes :id, :name, :city, :state, :country, :location, :website, :biography, :photo_url, :logo_url, :liker_count, :follower_count, :recording_count, :session_count
|
||||
|
||||
node :musicians do |band|
|
||||
unless band.users.nil? || band.users.size == 0
|
||||
child :users => :musicians do
|
||||
attributes :id, :first_name, :last_name, :name, :photo_url, :biography
|
||||
# node :musicians do |band|
|
||||
# unless band.users.nil? || band.users.size == 0
|
||||
# child :users => :musicians do
|
||||
# attributes :id, :first_name, :last_name, :name, :photo_url, :biography
|
||||
|
||||
# TODO: figure out how to omit empty arrays
|
||||
node :instruments do |user|
|
||||
unless user.instruments.nil? || user.instruments.size == 0
|
||||
child :musician_instruments => :instruments do
|
||||
attributes :instrument_id, :description, :proficiency_level, :priority
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# # TODO: figure out how to omit empty arrays
|
||||
# node :instruments do |user|
|
||||
# unless user.instruments.nil? || user.instruments.size == 0
|
||||
# child :musician_instruments => :instruments do
|
||||
# attributes :instrument_id, :description, :proficiency_level, :priority
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
child :users => :musicians do
|
||||
attributes :id, :first_name, :last_name, :name, :photo_url, :biography
|
||||
child :musician_instruments => :instruments do
|
||||
attributes :instrument_id, :description, :proficiency_level, :priority
|
||||
end
|
||||
end
|
||||
|
||||
node :genres do |band|
|
||||
unless band.genres.nil? || band.genres.size == 0
|
||||
child :genres => :genres do
|
||||
attributes :id, :description
|
||||
end
|
||||
end
|
||||
# node :genres do |band|
|
||||
# unless band.genres.nil? || band.genres.size == 0
|
||||
# child :genres => :genres do
|
||||
# attributes :id, :description
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
child :genres do
|
||||
attributes :id, :description
|
||||
end
|
||||
|
||||
|
||||
node :biography do |band|
|
||||
band.biography.nil? ? "" : band.biography
|
||||
end
|
||||
|
|
|
|||
|
|
@ -149,9 +149,11 @@
|
|||
input#paid-gigs-no.iradio-inline.dependent-master type="radio" name="paid_gigs" value='no'
|
||||
label.radio-label for="paid-gigs-no" No
|
||||
td.paid-gigs-dependent
|
||||
input#hourly-rate name="hourly_rate"
|
||||
.field
|
||||
input#hourly-rate name="hourly_rate"
|
||||
td.paid-gigs-dependent
|
||||
input#gig-minimum name="gig_minimum"
|
||||
.field
|
||||
input#gig-minimum name="gig_minimum"
|
||||
tr
|
||||
td
|
||||
label for="free-gigs"
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ describe "Bands", :js => true, :type => :feature, :capybara_feature => true do
|
|||
|
||||
subject { page }
|
||||
|
||||
before(:all) do
|
||||
Capybara.default_max_wait_time = 15
|
||||
end
|
||||
# before(:all) do
|
||||
# Capybara.default_max_wait_time = 15
|
||||
# end
|
||||
|
||||
let(:fan) { FactoryGirl.create(:fan) }
|
||||
let(:user) { FactoryGirl.create(:user) }
|
||||
|
|
|
|||
Loading…
Reference in New Issue