vrfs988: sync api wrapper with search model

This commit is contained in:
Jonathan Kolyer 2014-01-11 09:12:26 -06:00
parent 0279b05454
commit ecdfde2cdb
2 changed files with 19 additions and 15 deletions

View File

@ -192,20 +192,24 @@ module JamRuby
public
def musicians_text?
def musicians_text_search?
:musicians == @search_type
end
def fans_text?
def fans_text_search?
:fans == @search_type
end
def bands_text?
def bands_text_search?
:bands == @search_type
end
def is_filter?
@search_type == :musicians_filter || @search_type == :band_filter
def musicians_filter_search?
:musicians_filter == @search_type
end
def bands_filter_search?
:band_filter == @search_type
end
def follow_count(musician)

View File

@ -1,13 +1,13 @@
object @search
if @search.bands_text.present?
child(:bands => @search.text_results) {
if @search.bands_text_search?
child(:text_results => :bands) {
attributes :id, :name, :location, :photo_url, :logo_url
}
end
if @search.musicians_text?
child(:musicians => @search.text_results) {
if @search.musicians_text_search?
child(:text_results => :musicians) {
attributes :id, :first_name, :last_name, :name, :location, :photo_url
node :is_friend do |musician|
@ -20,7 +20,7 @@ if @search.musicians_text?
}
end
if @search.musicians_filter.present?
if @search.musicians_filter_search?
node :city do |user|
current_user.try(:location)
@ -30,7 +30,7 @@ if @search.musicians_filter.present?
@search.page_count
end
child(:musicians_filter => :musicians) {
child(:filter_results => :musicians) {
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :email, :online, :musician, :photo_url, :biography
node :is_friend do |musician|
@ -58,13 +58,13 @@ if @search.musicians_filter.present?
}
end
if @search.bands_filter.present?
if @search.bands_filter_search?
node :page_count do |foo|
@search.page_count
end
child(:bands_filter => :bands) {
child(:filter_results => :bands) {
attributes :id, :name, :city, :state, :country, :email, :photo_url, :biography, :logo_url
node :is_following do |band|
@ -88,8 +88,8 @@ if @search.bands_filter.present?
}
end
if @search.fans_text?
child(:fans => @search.text_results) {
if @search.fans_text_search?
child(:text_results => :fans) {
attributes :id, :first_name, :last_name, :name, :location, :photo_url
node :is_friend do |fan|