new MainController, empty artist result fix

This commit is contained in:
Hipster Hitman
2011-04-09 17:02:28 +04:00
parent 2f611742ba
commit 861bb9c69b
11 changed files with 79 additions and 24 deletions
@@ -5,3 +5,4 @@ class ArtistController < ApplicationController
@artist = Artist.getByName(params[:name].gsub('+', ' ').gsub('%20', ' '))
end
end
+5
View File
@@ -0,0 +1,5 @@
class MainController < ApplicationController
def index
end
end
+2
View File
@@ -0,0 +1,2 @@
module MainHelper
end
+28 -20
View File
@@ -1,22 +1,30 @@
<h1 class="artist"><%= @artist.name %></h1>
<% @artist.albums.each do |album| %>
<% unless album.releases.empty? %>
<div class="album">
<div class="pic"></div>
<h3 class="name"><%= album.name %> <%= (album.year ? album.year : '') %></h3>
<%
releases = album.releases
first_release = releases.first
%>
<ul class="tracks">
<% first_release.tracks.each do |track| %>
<li>
<span class="play"></span>
<span class="track-name"><%= track.name %></span>
<span class="duration"><%= track.length.toTime %></span>
</li>
<% end %>
</ul>
<% if @artist.nil? %>
<div class="search">
<h1>We don`t know such artist yet..</h1>
<%= link_to "Try again", main_path %>
</div>
<% else %>
<h1 class="artist"><%= @artist.name %></h1>
<% @artist.albums.each do |album| %>
<% unless album.releases.empty? %>
<div class="album">
<div class="pic"></div>
<h3 class="name"><%= album.name %> <%= (album.year ? album.year : '') %></h3>
<%
releases = album.releases
first_release = releases.first
%>
<ul class="tracks">
<% first_release.tracks.each do |track| %>
<li>
<span class="play"></span>
<span class="track-name"><%= track.name %></span>
<span class="duration"><%= track.length.toTime %></span>
</li>
<% end %>
</ul>
</div>
<% end %>
<% end %>
<% end %>
<% end %>
+6
View File
@@ -0,0 +1,6 @@
<div class="search">
<h1>SEARCH</h1>
<%= form_tag('/artist', :method => 'post') %>
<%= text_field_tag 'name', nil %>
</div>