4 Commits

Author SHA1 Message Date
  Dylan Baker 645d78c8af Harden 4 years ago
  Dylan Baker 635fd6d1d4 Hide 'next' button if no results 4 years ago
  Dylan Baker 60d2a86b9a Run build script on deploy 4 years ago
  Dylan Baker 6208a1f40c Tweak results styles 4 years ago
4 changed files with 10 additions and 7 deletions
  1. 1
    0
      Rakefile
  2. 1
    3
      web/assets/styles/results.scss
  3. 3
    1
      web/server.rb
  4. 5
    3
      web/views/results.erb

+ 1
- 0
Rakefile View File

@@ -29,5 +29,6 @@ task 'deploy' do
29 29
   puts `rsync -rv ./Rakefile #{username}@#{hostname}:/var/www/vlv-search/`
30 30
   puts `rsync -rv ./Gemfile #{username}@#{hostname}:/var/www/vlv-search/`
31 31
   puts `rsync -rv ./Gemfile.lock #{username}@#{hostname}:/var/www/vlv-search/`
32
+  puts `ssh #{username}@#{hostname} 'cd /var/www/vlv-search; rake build'`
32 33
   puts `ssh #{username}@#{hostname} '~/restart-unicorn'`
33 34
 end

+ 1
- 3
web/assets/styles/results.scss View File

@@ -1,6 +1,4 @@
1 1
 .results-container {
2
-  margin: auto;
3
-  max-width: 800px;
4 2
   padding-bottom: 1em;
5 3
 }
6 4
 
@@ -27,7 +25,7 @@
27 25
   font-size: 12px;
28 26
   justify-content: space-between;
29 27
 
30
-  @media(max-width: 500px) {
28
+  @media (max-width: 500px) {
31 29
     flex-direction: column;
32 30
 
33 31
     span {

+ 3
- 1
web/server.rb View File

@@ -22,8 +22,10 @@ class VLVSearch < Sinatra::Base
22 22
   get '/search' do
23 23
     redirect '/login' unless signed_in?
24 24
     params[:type] = 'threads' unless params[:type]
25
-    params[:page] = 1 unless params[:page]
25
+    params[:page] = 1 unless params[:page] && params[:page].match(/\d+/)
26 26
     params[:page] = params[:page].to_i
27
+    params[:q] = String.new unless params[:q]
28
+    params[:username] = String.new unless params[:username]
27 29
 
28 30
     results = search(params)
29 31
     previous_url, next_url = build_urls(params)

+ 5
- 3
web/views/results.erb View File

@@ -53,9 +53,11 @@
53 53
         </a>
54 54
       <% end %>
55 55
 
56
-      <a class="btn btn--small btn--next" href="<%= next_url %>">
57
-        next page
58
-      </a>
56
+      <% unless results.empty? %>
57
+        <a class="btn btn--small btn--next" href="<%= next_url %>">
58
+          next page
59
+        </a>
60
+      <% end %>
59 61
     <% end %>
60 62
   </div>
61 63
 </div>

Loading…
Cancel
Save