|
1 | | -<aside class="filters row"> |
2 | | - <%= form_tag(site_mappings_path(@site), method: 'get', role: 'form', class: 'col-md-6') do %> |
3 | | - <ul class="nav nav-pills list-inline"> |
4 | | - <li class="nav-pill-text"> |
5 | | - <strong>Filter by</strong> |
6 | | - </li> |
7 | | - <li class="dropdown dropdown-with-text-input"> |
8 | | - <a href="#filter" class="inherit" data-toggle="dropdown" role="button"> |
9 | | - Path <span class="glyphicon glyphicon-chevron-down" style="font-size: 80%"></span> |
| 1 | +<% |
| 2 | + filtered = @filtered |
| 3 | + filtered_by_new_url = @filtered_by_new_url |
| 4 | + filtered_by_path = @filtered_by_path |
| 5 | + filtered_by_tag = @filtered_by_tag |
| 6 | + filtered_by_type = @filtered_by_type |
| 7 | +%> |
| 8 | + |
| 9 | +<aside class="filters row remove-bottom-margin add-top-margin" style="clear: both"> |
| 10 | + |
| 11 | + <div class="col-md-8"> |
| 12 | + <div class="panel panel-default"> |
| 13 | + <div class="panel-footer" style="background: transparent; border-top: none"> |
| 14 | + <% if filtered %> |
| 15 | + <a href="?" class="pull-right inherit close-filter" style="margin-top: 5px"> |
| 16 | + <span class="glyphicon glyphicon-remove"></span> |
10 | 17 | </a> |
11 | | - <div class="dropdown-menu" role="menu"> |
12 | | - <%= label_tag :contains, 'Path' %> |
13 | | - <div class="input-group"> |
14 | | - <%= text_field_tag :contains, @path_contains, class: 'form-control', placeholder: 'eg /home' %> |
15 | | - <span class="input-group-btn"> |
16 | | - <%= button_tag 'Filter', name: nil, class: 'btn btn-default ' %> |
17 | | - </span> |
18 | | - </div> |
19 | | - </div> |
20 | | - </li> |
21 | | - <li class="dropdown dropdown-with-text-input"> |
22 | | - <a href="#filter" class="inherit" data-toggle="dropdown" role="button"> |
23 | | - New URL <span class="glyphicon glyphicon-chevron-down" style="font-size: 80%"></span> |
24 | | - </a> |
25 | | - <div class="dropdown-menu" role="menu"> |
26 | | - <%= label_tag :contains, 'New URL' %> |
27 | | - <div class="input-group"> |
28 | | - <%= text_field_tag :contains, @path_contains, class: 'form-control', placeholder: 'eg https://www.gov.uk' %> |
29 | | - <span class="input-group-btn"> |
30 | | - <%= button_tag 'Filter', name: nil, class: 'btn btn-default ' %> |
31 | | - </span> |
32 | | - </div> |
33 | | - </div> |
34 | | - </li> |
35 | | - <li class="dropdown"> |
36 | | - <a href="#filter" class="inherit" data-toggle="dropdown" role="button"> |
37 | | - Tag <span class="glyphicon glyphicon-chevron-down" style="font-size: 80%"></span> |
38 | | - </a> |
39 | | - <% tags = most_used_tags_for_site(@site, limit: 10) %> |
40 | | - <ul class="dropdown-menu" role="menu"> |
41 | | - <% tags.each do |tag| %> |
42 | | - <li><a href="?tagged=<%= tag %>"><%= tag %></a></li> |
43 | | - <% end %> |
44 | | - </ul> |
45 | | - </li> |
46 | | - <li class="dropdown"> |
47 | | - <a href="#filter" class="inherit" data-toggle="dropdown" role="button"> |
48 | | - Type <span class="glyphicon glyphicon-chevron-down" style="font-size: 80%"></span> |
49 | | - </a> |
50 | | - <ul class="dropdown-menu" role="menu"> |
| 18 | + <% end %> |
| 19 | + <ul class="nav nav-pills list-inline"> |
| 20 | + <li class="nav-pill-text"> |
| 21 | + <strong>Filter by</strong> |
| 22 | + </li> |
| 23 | + <% if filtered_by_path %> |
51 | 24 | <li> |
52 | | - <a href="#filter">Archive (200)</a> |
| 25 | + <a href="?" class="inherit bold selected-filter"> |
| 26 | + <span class="glyphicon glyphicon-remove" style="font-size: 80%"></span> Path |
| 27 | + </a> |
| 28 | + </li> |
| 29 | + <% else %> |
| 30 | + <li class="dropdown dropdown-with-text-input"> |
| 31 | + <a href="#filter" class="inherit <% if filtered_by_path %>bold<% end %>" data-toggle="dropdown" role="button"> |
| 32 | + Path <span class="glyphicon glyphicon-chevron-down" style="font-size: 80%"></span> |
| 33 | + </a> |
| 34 | + <div class="dropdown-menu" role="menu"> |
| 35 | + <%= form_tag(site_mappings_path(@site), method: 'get', role: 'form', class: 'form') do %> |
| 36 | + <%= label_tag :contains, 'Path' %> |
| 37 | + <div class="input-group"> |
| 38 | + <%= text_field_tag :contains, @path_contains, class: 'form-control', placeholder: 'eg /home' %> |
| 39 | + <span class="input-group-btn"> |
| 40 | + <%= button_tag 'Filter', name: nil, class: 'btn btn-default ' %> |
| 41 | + </span> |
| 42 | + </div> |
| 43 | + <% end %> |
| 44 | + </div> |
53 | 45 | </li> |
| 46 | + <% end %> |
| 47 | + <% if filtered_by_new_url %> |
54 | 48 | <li> |
55 | | - <a href="#filter">Redirect (1,456)</a> |
| 49 | + <a href="?" class="inherit bold selected-filter"> |
| 50 | + <span class="glyphicon glyphicon-remove" style="font-size: 80%"></span> New URL |
| 51 | + </a> |
| 52 | + </li> |
| 53 | + <% else %> |
| 54 | + <li class="dropdown dropdown-with-text-input"> |
| 55 | + <a href="#filter" class="inherit" data-toggle="dropdown" role="button"> |
| 56 | + New URL <span class="glyphicon glyphicon-chevron-down" style="font-size: 80%"></span> |
| 57 | + </a> |
| 58 | + <div class="dropdown-menu" role="menu"> |
| 59 | + <%= form_tag(site_mappings_path(@site), method: 'get', role: 'form', class: 'form') do %> |
| 60 | + <%= hidden_field_tag 'filter_field', 'new_url' %> |
| 61 | + <%= label_tag :contains, 'New URL' %> |
| 62 | + <div class="input-group"> |
| 63 | + <%= text_field_tag :contains, @path_contains, class: 'form-control', placeholder: 'eg https://www.gov.uk' %> |
| 64 | + <span class="input-group-btn"> |
| 65 | + <%= button_tag 'Filter', name: nil, class: 'btn btn-default ' %> |
| 66 | + </span> |
| 67 | + </div> |
| 68 | + <% end %> |
| 69 | + </div> |
56 | 70 | </li> |
57 | | - </ul> |
58 | | - </li> |
59 | | - <li class="nav-pill-text text-muted">Sorted by path</li> |
60 | | - </ul> |
61 | | - <% end %> |
| 71 | + <% end %> |
| 72 | + <li class="dropdown"> |
| 73 | + <a href="#filter" class="inherit <% if filtered_by_tag %>bold selected-filter<% end %>" data-toggle="dropdown" role="button"> |
| 74 | + Tag <span class="glyphicon glyphicon-chevron-down" style="font-size: 80%"></span> |
| 75 | + </a> |
| 76 | + <% tags = most_used_tags_for_site(@site, limit: 10) %> |
| 77 | + <ul class="dropdown-menu" role="menu"> |
| 78 | + <% tags.each do |tag| %> |
| 79 | + <li><a href="?tagged=<%= tag %>"><%= tag %></a></li> |
| 80 | + <% end %> |
| 81 | + </ul> |
| 82 | + </li> |
| 83 | + <li class="dropdown"> |
| 84 | + <a href="#filter" class="inherit <% if filtered_by_type %>bold selected-filter<% end %>" data-toggle="dropdown" role="button"> |
| 85 | + <% if filtered_by_type %><%= http_status_name(params[:http_status]).pluralize %><% else %>Type<% end %> <span class="glyphicon glyphicon-chevron-down" style="font-size: 80%"></span> |
| 86 | + </a> |
| 87 | + <ul class="dropdown-menu" role="menu"> |
| 88 | + <% if filtered_by_type %> |
| 89 | + <li> |
| 90 | + <a href="?">All types</a> |
| 91 | + </li> |
| 92 | + <% end %> |
| 93 | + <li> |
| 94 | + <a href="?http_status=410">Archive (200)</a> |
| 95 | + </li> |
| 96 | + <li> |
| 97 | + <a href="?http_status=301">Redirect (1,456)</a> |
| 98 | + </li> |
| 99 | + </ul> |
| 100 | + </li> |
| 101 | + <li class="nav-pill-text text-muted">Sorted by path</li> |
| 102 | + </ul> |
| 103 | + |
| 104 | + <% if filtered %> |
| 105 | + </div> |
| 106 | + <% if filtered_by_path || filtered_by_new_url || filtered_by_tag %> |
| 107 | + <div class="panel-body" style="border-top: 1px solid #ddd"> |
| 108 | + <% if filtered_by_path %> |
| 109 | + <div class="active-filter"> |
| 110 | + <%= label_tag :contains, 'Path' %> |
| 111 | + <div class="input-group"> |
| 112 | + <%= text_field_tag :contains, @path_contains, class: 'form-control' %> |
| 113 | + <span class="input-group-btn"> |
| 114 | + <%= button_tag 'Update path', name: nil, class: 'btn btn-default ' %> |
| 115 | + </span> |
| 116 | + </div> |
| 117 | + </div> |
| 118 | + <% end %> |
| 119 | + <% if filtered_by_new_url %> |
| 120 | + <div class="active-filter"> |
| 121 | + <%= label_tag :contains, 'New URL' %> |
| 122 | + <div class="input-group"> |
| 123 | + <%= text_field_tag :contains, @path_contains, class: 'form-control' %> |
| 124 | + <span class="input-group-btn"> |
| 125 | + <%= button_tag 'Update URL', name: nil, class: 'btn btn-default ' %> |
| 126 | + </span> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | + <% end %> |
| 130 | + <% if filtered_by_tag %> |
| 131 | + <div class="active-filter"> |
| 132 | + <label>Tagged</label> |
| 133 | + <ul class="tag-list remove-bottom-margin"> |
| 134 | + <% filtered_by_tags.each do |tag| %> |
| 135 | + <li> |
| 136 | + <%= link_to remove_tag_from_filter_path(tag), class: 'tag', title: "Remove “#{tag}” tag filter" do %> |
| 137 | + <span class="glyphicon glyphicon-remove"></span> <%= tag %> |
| 138 | + <% end %> |
| 139 | + </li> |
| 140 | + <% end %> |
| 141 | + </ul> |
| 142 | + </div> |
| 143 | + <% end %> |
| 144 | + </div> |
| 145 | + <% end %> |
| 146 | + </div> |
| 147 | + <% end %> |
| 148 | + |
| 149 | + </div> |
62 | 150 | </aside> |
63 | 151 | <script> |
64 | 152 | $('.dropdown-with-text-input .dropdown-menu').click(function (e) { |
|
0 commit comments