Browse Source

bugs

master
Dylan Baker 2 months ago
parent
commit
1d2d251fb8
3 changed files with 16 additions and 11 deletions
  1. 2
    1
      web/assets/script.js
  2. 8
    4
      web/assets/styles/form.scss
  3. 6
    6
      web/views/partials/search.erb

+ 2
- 1
web/assets/script.js View File

@@ -1,6 +1,7 @@
1 1
 var types = document.querySelectorAll('input[type=radio][name=type]');
2 2
 types.forEach(function (type) {
3 3
   type.addEventListener('change', function (e) {
4
-    document.querySelector('.filters__section--sort').classList.toggle('open');
4
+    document.querySelector('.filters__subsection--sort').classList.toggle('open');
5
+    document.querySelector('.filters__subsection--sort input[type=radio]:first-child').checked = true;
5 6
   });
6 7
 });

+ 8
- 4
web/assets/styles/form.scss View File

@@ -22,17 +22,21 @@
22 22
   padding: .5em 0;
23 23
 }
24 24
 
25
-.filters__section--sort {
26
-  display: none;
25
+.filters__subsection--sort {
26
+  visibility: hidden;
27 27
 }
28 28
 
29
-.filters__section--sort.open {
30
-  display: flex;
29
+.filters__subsection--sort.open {
30
+  visibility: visible;
31 31
 }
32 32
 
33 33
 .filters__subsection {
34 34
   flex: 1;
35 35
   padding: 0 1em;
36
+
37
+  &.filters__subsection--static {
38
+    flex: 1;
39
+  }
36 40
 }
37 41
 
38 42
 .form__field {

+ 6
- 6
web/views/partials/search.erb View File

@@ -40,8 +40,12 @@
40 40
         </label>
41 41
       </div>
42 42
     </div>
43
-    <div class="filters__section filters__section--sort <%= params[:type] == 'threads' ? 'open' : '' %>">
44
-      <div class="filters__subsection">
43
+    <div class="filters__section">
44
+      <div class="filters__subsection filters__subsection--static">
45
+        <p>Posted by:</p>
46
+        <input type="text" name="username" value="<%= params[:username] %>" class="form__text-field">
47
+      </div>
48
+      <div class="filters__subsection filters__subsection--sort <%= params[:type] == 'threads' ? 'open' : '' %>">
45 49
         <p>Sort by:</p>
46 50
         <label class="form__label">
47 51
           <input type="radio" name="sort" value="thread" <% if [nil, "thread"].include? params[:sort] %>checked<% end%>>
@@ -52,10 +56,6 @@
52 56
           Most recent post
53 57
         </label>
54 58
       </div>
55
-      <div class="filters__subsection">
56
-        <p>Posted by:</p>
57
-        <input type="text" name="username" value="<%= params[:username] %>" class="form__text-field">
58
-      </div>
59 59
     </div>
60 60
   </div>
61 61
   <input type="submit" value="Search" class="btn form__submit">

Loading…
Cancel
Save