Skip to content
Browse files

begin listesøk

  • Loading branch information...
1 parent dc6a332 commit 6604f52dc94a69faf514b36deb68d226c4cef70d @boutros boutros committed Mar 28, 2013
Showing with 26 additions and 7 deletions.
  1. +6 −1 public/js/app.js
  2. +2 −0 routes/main.rb
  3. +18 −6 views/search.erb
View
7 public/js/app.js
@@ -525,4 +525,9 @@ $('.liste-tittel').on('click', function() {
$('.rss-copy').on('click', function() {
window.prompt("Trykk Ctrl+C, så Enter for å kopiere", $(this).prev().val());
-});
+});
+
+
+// Avansert søk
+$('#search-author').chosen({no_results_text: "Ingen treff for", allow_single_deselect: true});
+$('#search-title').chosen({no_results_text: "Ingen treff for", allow_single_deselect: true})
View
2 routes/main.rb
@@ -21,7 +21,9 @@ class BokanbefalingerApp < Sinatra::Application
end
get "/søk" do
+ puts params
@title = "Søk etter anbefalinger"
+ @dropdown = List.populate_dropdowns
erb :search
end
end
View
24 views/search.erb
@@ -1,12 +1,24 @@
<div class="main-left">
<p class="lokkeskrift">Søk etter anbefalinger</p>
<form id="advanced-search">
- <label>Boktittel</label><input type="text"><br>
- <label>Forfatter av boken</label><input type="text"><br>
- <label>ISBN-nummer</label><input type="text"><br>
- <label>Illustratør</label><input type="text"><br>
- <label>Oversetter</label><input type="text"><br>
- <label>Anbefalers navn</label><input type="text"><br>
+ <label>Boktittel</label>
+ <select name="forfatter" id="search-author" style="width:305px" data-placeholder="søk/velg tittel">
+ <option></option>
+ <% @dropdown.titles.sort_by { |k,v| v }.each do |k,v| %>
+ <option value="<%= k %>"><%= v %></option>
+ <% end %>
+ </select><br><br>
+ <label>Forfatter av boken</label>
+ <select name="tittel" id="search-title" style="width:305px" data-placeholder="søk/velg forfatter">
+ <option></option>
+ <% @dropdown.authors.sort_by { |k,v| v }.each do |k,v| %>
+ <option value="<%= k %>"><%= v %></option>
+ <% end %>
+ </select><br>
+ <label>ISBN-nummer</label><input name="isbn" type="text"><br>
+ <label>Illustratør</label><input type="text" placeholder="ikke implementert ennå" disabled="disabled"><br>
+ <label>Oversetter</label><input type="text" placeholder="ikke implementert ennå" disabled="disabled"><br>
+ <label>Anbefalers navn</label><input type="text" placeholder="ikke implementert ennå" disabled="disabled"><br>
<button type="submit" class="red medium">Søk</button>
<div class="clearfix"></div>
</form>

0 comments on commit 6604f52

Please sign in to comment.
Something went wrong with that request. Please try again.