diff --git a/rails/.gitignore b/rails/.gitignore
new file mode 100644
index 0000000..0a6e766
--- /dev/null
+++ b/rails/.gitignore
@@ -0,0 +1,3 @@
+rails/tmp/
+rails/log/*.log
+
diff --git a/rails/app/controllers/artist_controller.rb b/rails/app/controllers/artist_controller.rb
index 25d291b..21bb779 100644
--- a/rails/app/controllers/artist_controller.rb
+++ b/rails/app/controllers/artist_controller.rb
@@ -5,3 +5,4 @@ class ArtistController < ApplicationController
@artist = Artist.getByName(params[:name].gsub('+', ' ').gsub('%20', ' '))
end
end
+
diff --git a/rails/app/controllers/main_controller.rb b/rails/app/controllers/main_controller.rb
new file mode 100644
index 0000000..a9708bd
--- /dev/null
+++ b/rails/app/controllers/main_controller.rb
@@ -0,0 +1,5 @@
+class MainController < ApplicationController
+ def index
+ end
+
+end
diff --git a/rails/app/helpers/main_helper.rb b/rails/app/helpers/main_helper.rb
new file mode 100644
index 0000000..826effe
--- /dev/null
+++ b/rails/app/helpers/main_helper.rb
@@ -0,0 +1,2 @@
+module MainHelper
+end
diff --git a/rails/app/views/artist/view.rhtml b/rails/app/views/artist/view.rhtml
index 231b9d0..2c842a9 100644
--- a/rails/app/views/artist/view.rhtml
+++ b/rails/app/views/artist/view.rhtml
@@ -1,22 +1,30 @@
-
-
-
<%= album.name %> <%= (album.year ? album.year : '') %>
- <%
- releases = album.releases
- first_release = releases.first
- %>
-
- <% first_release.tracks.each do |track| %>
- -
-
- <%= track.name %>
- <%= track.length.toTime %>
-
- <% end %>
-
+<% if @artist.nil? %>
+
+
We don`t know such artist yet..
+ <%= link_to "Try again", main_path %>
+<% else %>
+
<%= @artist.name %>
+ <% @artist.albums.each do |album| %>
+ <% unless album.releases.empty? %>
+
+
+
<%= album.name %> <%= (album.year ? album.year : '') %>
+ <%
+ releases = album.releases
+ first_release = releases.first
+ %>
+
+ <% first_release.tracks.each do |track| %>
+ -
+
+ <%= track.name %>
+ <%= track.length.toTime %>
+
+ <% end %>
+
+
+ <% end %>
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
+
diff --git a/rails/app/views/main/index.html.erb b/rails/app/views/main/index.html.erb
new file mode 100644
index 0000000..3eb1856
--- /dev/null
+++ b/rails/app/views/main/index.html.erb
@@ -0,0 +1,6 @@
+
+
SEARCH
+<%= form_tag('/artist', :method => 'post') %>
+ <%= text_field_tag 'name', nil %>
+
+
diff --git a/rails/config/routes.rb b/rails/config/routes.rb
index fc1e854..81eda36 100644
--- a/rails/config/routes.rb
+++ b/rails/config/routes.rb
@@ -1,4 +1,6 @@
Beathaven::Application.routes.draw do
+ get "main/index"
+
# The priority is based upon order of creation:
# first created -> highest priority.
@@ -49,12 +51,14 @@ Beathaven::Application.routes.draw do
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
+ root :to => "main#index", :as => "main"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
-
- match 'artist/:name' => 'artist#view'
+
+ match 'artist(/:name)' => 'artist#view'
end
+
diff --git a/rails/public/index.html b/rails/public/index.html
deleted file mode 100644
index b45ef6f..0000000
--- a/rails/public/index.html
+++ /dev/null
@@ -1 +0,0 @@
-Hello, World!
\ No newline at end of file
diff --git a/rails/public/stylesheets/beathaven.css b/rails/public/stylesheets/beathaven.css
index 738ca93..5a90559 100644
--- a/rails/public/stylesheets/beathaven.css
+++ b/rails/public/stylesheets/beathaven.css
@@ -74,4 +74,18 @@ body {
background-image: url(/images/play.png);
width: 31px;
height: 30px;
- margin: 0 0.3em 0 0;
\ No newline at end of file
+ margin: 0 0.3em 0 0;
+}
+
+.search {
+ width: 100%;
+ text-align: center;
+}
+
+.search #name {
+ border: 1px solid ##bdbdbd;
+ background: #555555;
+ color: #ffffff;
+ font-size: 1.1em;
+}
+
diff --git a/rails/test/functional/main_controller_test.rb b/rails/test/functional/main_controller_test.rb
new file mode 100644
index 0000000..ce24b34
--- /dev/null
+++ b/rails/test/functional/main_controller_test.rb
@@ -0,0 +1,9 @@
+require 'test_helper'
+
+class MainControllerTest < ActionController::TestCase
+ test "should get index" do
+ get :index
+ assert_response :success
+ end
+
+end
diff --git a/rails/test/unit/helpers/main_helper_test.rb b/rails/test/unit/helpers/main_helper_test.rb
new file mode 100644
index 0000000..22da3c4
--- /dev/null
+++ b/rails/test/unit/helpers/main_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class MainHelperTest < ActionView::TestCase
+end