Skip to content

Commit

Permalink
Make js dropdown work properly for sorting mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
jennyd committed May 6, 2014
1 parent e1fc8a0 commit 801ab87
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/views/mappings/_filters.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
<%= render partial: 'mappings/filter/by_new_url_menu' %>
<%= render partial: 'mappings/filter/by_tag_menu' %>
<%= render partial: 'mappings/filter/by_type_menu' %>

<li class="if-no-js-hide nav-pill-text add-left-margin">
<strong>Sort by</strong>
</li>
<%= render partial: 'mappings/sort' %>
<li class="if-js-hide">
<%= link_to 'Filter mappings', filter_site_mappings_path(@site) %>
Expand Down
10 changes: 6 additions & 4 deletions app/views/mappings/_sort.html.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<li class="if-no-js-hide">
<ul class="dropdown">
<li class="if-no-js-hide sort-by">
<% sorted_by = @sorted_by_traffic ? 'Traffic' : 'Path' %>
<%= filter_option_link(@site, sorted_by) %>
<ul class="dropdown-menu" role="menu">
<li>
<%= link_to 'Sort by path', sort_by_path_path, class: 'inherit' %>
<%= link_to 'Path', sort_by_path_path, class: 'inherit' %>
</li>
<li>
<%= link_to 'Sort by traffic', sort_by_traffic_path, class: 'inherit' %>
<%= link_to 'Traffic', sort_by_traffic_path, class: 'inherit' %>
</li>
</ul>
</li>
6 changes: 4 additions & 2 deletions features/step_definitions/mappings_interaction_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@

When(/^I sort the mappings by traffic$/) do
if @_javascript
# click_link "Sort by path" # this is the default, selected, option
click_link "Sort by traffic"
within '.sort-by' do
click_link "Path" # this is the default, selected, option
click_link "Traffic"
end
else
click_link "Filter mappings"
choose('by traffic')
Expand Down

0 comments on commit 801ab87

Please sign in to comment.