* VRFS-3528 - make sure open jamtrack dialog passes 'show_purchased_only'

This commit is contained in:
Seth Call 2015-09-06 19:03:08 -05:00
parent 6d010a561b
commit 386ed8144c
3 changed files with 15 additions and 3 deletions

View File

@ -230,6 +230,8 @@ module JamRuby
return {artists: [], songs: []}
end
options[:show_purchased_only] = options[:show_purchased_only]
options[:limit] = options[:limit] || 5
options[:artist_search] = options[:match]
@ -387,6 +389,11 @@ module JamRuby
query = query.where("jam_tracks.status = ?", 'Production') unless user.admin
if options[:show_purchased_only]
query = query.joins(:jam_track_rights)
query = query.where("jam_track_rights.user_id = ?", user.id)
end
if options[:artist_search]
tsquery = Search.create_tsquery(options[:artist_search])
if tsquery

View File

@ -77,7 +77,7 @@ MIX_MODES = context.JK.MIX_MODES
#@search()
getOptions: (input, callback) =>
getOptions: (input, callback) ->
#@logger.debug("getOptions input #{input}", this)
@ -88,7 +88,12 @@ MIX_MODES = context.JK.MIX_MODES
callback(null, {options: [], complete: false})
return
@rest.autocompleteJamTracks({match:input, limit:5})
query = {match:input, limit:5}
if @props.show_purchased_only
query.show_purchased_only = true
@rest.autocompleteJamTracks(query)
.done((autocomplete) =>
options = []

View File

@ -7,7 +7,7 @@
.dialog-inner
= react_component 'JamTrackAutoComplete', {:onSearch => 'window.JK.OpenJamTrackDialogInstance.search'}
= react_component 'JamTrackAutoComplete', {:onSearch => 'window.JK.OpenJamTrackDialogInstance.search', show_purchased_only:true}
button.search-btn.button-orange SEARCH
.recording-wrapper