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
+4 -2
View File
@@ -5,10 +5,12 @@ class ArtistController < ApplicationController
if params[:name].nil?
name = ''
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
@artist = Artist.getByName(name)
pp @artist
end
def autocomplete
+1 -5
View File
@@ -7,11 +7,7 @@ class TrackController < ApplicationController
pp album = Album.where(:id => release.album_id).first
pp artist = Artist.where(:id => album.artist_id).first
data = 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"
url = Vkontakte.get(artist.name, track.name, (track.length / 1000).round)
#render :text => data
redirect_to data
end
end
+6 -4
View File
@@ -1,10 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<title>BeatHaven</title>
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :all %>
<%= csrf_meta_tag %>
<title>BeatHaven</title>
<link rel="icon" href="/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :all %>
<%= csrf_meta_tag %>
</head>
<body>
<div id="contents">
-1
View File
@@ -13,7 +13,6 @@
</script>
<div class="search">
<h1>SEARCH</h1>
<%= form_tag('/artist', :method => 'post') %>
<%= text_field_tag 'name', nil %>
</div>