Skip to content

Instantly share code, notes, and snippets.

@robertothais
Created February 6, 2012 21:45
Show Gist options
  • Select an option

  • Save robertothais/1755105 to your computer and use it in GitHub Desktop.

Select an option

Save robertothais/1755105 to your computer and use it in GitHub Desktop.

Revisions

  1. robertothais created this gist Feb 6, 2012.
    15 changes: 15 additions & 0 deletions _submissions_home(2).rhtml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <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>
    1 change: 1 addition & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    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.
    3 changes: 3 additions & 0 deletions venue_submissions.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    this.viewModel.all_tags = ko.observableArray(options.allTags);
    this.viewModel.search_options.selected_tags = ko.observableArray([])
    this.viewModel.selected_tags = ko.observableArray([])