1
0
Fork 0

Search fix

This commit is contained in:
magnolia-fan 2011-04-11 07:12:06 +04:00
parent b5e2563bf9
commit 242c170a41
8 changed files with 49 additions and 22 deletions

View File

@ -5,10 +5,12 @@ class ArtistController < ApplicationController
if params[:name].nil? if params[:name].nil?
name = '' name = ''
else else
name = params[:name].gsub('+', ' ').gsub('%20', ' ') if request.request_method == 'POST'
redirect_to :action => 'view', :name => params[:name].gsub(' ', '+')
end
name = params[:name].gsub('+', ' ')
end end
@artist = Artist.getByName(name) @artist = Artist.getByName(name)
pp @artist
end end
def autocomplete def autocomplete

View File

@ -7,11 +7,7 @@ class TrackController < ApplicationController
pp album = Album.where(:id => release.album_id).first pp album = Album.where(:id => release.album_id).first
pp artist = Artist.where(:id => album.artist_id).first pp artist = Artist.where(:id => album.artist_id).first
data = Vkontakte.get(artist.name, track.name, (track.length / 1000).round) url = Vkontakte.get(artist.name, track.name, (track.length / 1000).round)
#data = open('/Users/chez/Sites/beathaven/tmp/media.mp3').read
#send_data data, :type=>"audio/mp3"
#render :text => data
redirect_to data
end end
end end

View File

@ -1,10 +1,12 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>BeatHaven</title> <title>BeatHaven</title>
<%= stylesheet_link_tag :all %> <link rel="icon" href="/favicon.ico" type="image/x-icon">
<%= javascript_include_tag :all %> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<%= csrf_meta_tag %> <%= stylesheet_link_tag :all %>
<%= javascript_include_tag :all %>
<%= csrf_meta_tag %>
</head> </head>
<body> <body>
<div id="contents"> <div id="contents">

View File

@ -13,7 +13,6 @@
</script> </script>
<div class="search"> <div class="search">
<h1>SEARCH</h1>
<%= form_tag('/artist', :method => 'post') %> <%= form_tag('/artist', :method => 'post') %>
<%= text_field_tag 'name', nil %> <%= text_field_tag 'name', nil %>
</div> </div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -99,9 +99,9 @@ body {
.search #name { .search #name {
width: 300px; width: 300px;
border: 1px solid ##bdbdbd; border: #AAA 3px solid;
background: #555555; border-radius: 7px;
color: #ffffff; font-size: 1.5em;
font-size: 1.1em; padding: 0.2em;
} }

View File

@ -1,7 +1,35 @@
 .autocomplete-w1 {
.autocomplete-w1 { background:url(../images/shadow.png) no-repeat bottom right; position:absolute; top:0px; left:0px; margin:8px 0 0 6px; /* IE6 fix: */ _background:none; _margin:0; } background: url(../images/shadow.png) no-repeat bottom right;
.autocomplete { border:1px solid #999; background:#FFF; cursor:default; text-align:left; max-height:350px; overflow:auto; margin:-6px 6px 6px -6px; /* IE6 specific: */ _height:350px; _margin:0; _overflow-x:hidden; } position: absolute;
.autocomplete .selected { background:#F0F0F0; } top: 0px;
.autocomplete div { padding:2px 5px; white-space:nowrap; } left: 0px;
.autocomplete strong { font-weight:normal; color:#3399FF; } margin: 8px 0 0 6px;
/* IE6 fix: */
_background: none;
_margin: 0;
}
.autocomplete {
border:1px solid #999;
background:#FFF;
cursor:default;
text-align:left;
max-height:350px;
overflow:auto;
margin:-6px 6px 6px -6px;
/* IE6 specific: */
_height: 350px;
_margin: 0;
_overflow-x: hidden;
}
.autocomplete .selected {
background: #F0F0F0;
}
.autocomplete div {
padding: 2px 5px;
white-space: nowrap;
}
.autocomplete strong {
font-weight: normal;
color: #3399FF;
}