Skip to content

Instantly share code, notes, and snippets.

@robertothais
Created February 6, 2012 21:45
Show Gist options
  • Save robertothais/1755105 to your computer and use it in GitHub Desktop.
Save robertothais/1755105 to your computer and use it in GitHub Desktop.
<script type="text/javascript">
var options = {
elemId: 'venue_submissions_filters',
allGenres:<%= Artist::GENRES.to_json %>,
allTags: <%= submission_tag_options.map{|name,v|{:name => name, :value => v}}.to_json %>,
webServer: '<%= WEB_SERVER %>',
widgetServer: '<%= widget_server %>',
pageSize: <%= ArtistSearch::PAGE_SIZE %>,
maxPages: <%= ArtistSearch::MAX_PAGE %>,
venueId: '<%= @venue.id %>',
submissionCounts: <%= @venue.submission_counts.to_json %>
};
Reverb.VenueSubmissionFilter.instance = new Reverb.VenueSubmissionFilter(options);
Reverb.VenueSubmissionFilter.instance.applyParams(<%= @venue.most_recent_search %>);
</script>
On venue_submissions.js the first observableArray actually maps properly into the UI element. Programmatically pushing a new object adds the options into the select element. This doesn't happen with the second two observableArrays in either direction. This is reflected in the params that get posted: no tag information is to be found.
this.viewModel.all_tags = ko.observableArray(options.allTags);
this.viewModel.search_options.selected_tags = ko.observableArray([])
this.viewModel.selected_tags = ko.observableArray([])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment