Created
February 6, 2012 21:46
-
-
Save robertothais/1755114 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="search_section" data-section-name="tags"> | |
| <div class="heading"> | |
| Tags | |
| <% rn_tooltip "Tags" do -%> | |
| Use this filter to restrict your search to artists for which you have applied the selected tags. | |
| <% end -%> | |
| </div> | |
| <div class="content"> | |
| <%= f.select 'tags', [], {}, :multiple => true, 'data-placeholder' => 'Choose tags', 'data-bind' => | |
| 'options: all_tags, optionsText: \'name\', optionsValue: \'value\', selectedOptions: \'selected_tags\'' %> | |
| </div> | |
| </div> | |
| . | |
| . | |
| . | |
| <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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| this.viewModel.all_tags = ko.observableArray(options.allTags); | |
| this.viewModel.search_options.selected_tags = ko.observableArray([]) | |
| this.viewModel.selected_tags = ko.observableArray([]) |
davars
commented
Feb 6, 2012
<%= f.select 'tags', [], {}, :multiple => true, 'data-placeholder' => 'Choose tags', 'data-bind' =>
'options: all_tags, optionsText: \'name\', optionsValue: \'value\', selectedOptions: selected_tags' %>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment