diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb index e1a004a..a9959a4 100644 --- a/app/controllers/categories_controller.rb +++ b/app/controllers/categories_controller.rb @@ -1,5 +1,4 @@ class CategoriesController < ApplicationController - layout "photos" # GET /categories # GET /categories.xml def index diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb index 9fd7cc7..32e32e1 100644 --- a/app/controllers/contacts_controller.rb +++ b/app/controllers/contacts_controller.rb @@ -1,6 +1,4 @@ class ContactsController < ApplicationController - layout "photos" - def new @contact = Contact.new(:id => 1) @page_title = 'Contact' diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 95f2992..0ce5713 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -1,4 +1,5 @@ class HomeController < ApplicationController def index + @photo = Photo.featured.order('RANDOM()').first end end diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb index 1060e69..e1a428a 100644 --- a/app/controllers/pages_controller.rb +++ b/app/controllers/pages_controller.rb @@ -1,13 +1,6 @@ class PagesController < ApplicationController - layout "photos" - - def index - @photo = Photo.featured.order('RANDOM()').first - end - - def about - @page = Page.find_by_name('about') - @content = @page.content - @page_title = 'About' + def show + @page = Page.find_by_name(params[:name]) + @page_title = @page.title end end diff --git a/app/views/pages/index.html.erb b/app/views/home/index.html.erb similarity index 89% rename from app/views/pages/index.html.erb rename to app/views/home/index.html.erb index 4b58f0b..71957bb 100644 --- a/app/views/pages/index.html.erb +++ b/app/views/home/index.html.erb @@ -1,5 +1,5 @@
- <%= link_to raw('about'), about_path %> + <%= link_to raw('about'), page_path(:about) %>
<%= link_to raw('portfolio'), :controller => 'categories' %> diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml deleted file mode 100644 index 1491738..0000000 --- a/app/views/home/index.html.haml +++ /dev/null @@ -1 +0,0 @@ -%h1= APP_CONFIG['name'] \ No newline at end of file diff --git a/app/views/layouts/photos.html.erb b/app/views/layouts/application.html.erb similarity index 100% rename from app/views/layouts/photos.html.erb rename to app/views/layouts/application.html.erb diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml deleted file mode 100644 index 25669f0..0000000 --- a/app/views/layouts/application.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -!!! -%html - %head - %title= APP_CONFIG['name'] - = stylesheet_link_tag "application" - = javascript_include_tag "application" - = csrf_meta_tags - %body - = yield diff --git a/app/views/layouts/categories.html.erb b/app/views/layouts/categories.html.erb deleted file mode 100644 index 76dd042..0000000 --- a/app/views/layouts/categories.html.erb +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - Categories: <%= controller.action_name %> - <%= stylesheet_link_tag 'scaffold' %> - - - -

<%= notice %>

- -<%= yield %> - - - diff --git a/app/views/pages/about.html.erb b/app/views/pages/show.html.erb similarity index 93% rename from app/views/pages/about.html.erb rename to app/views/pages/show.html.erb index 89d8132..a424308 100644 --- a/app/views/pages/about.html.erb +++ b/app/views/pages/show.html.erb @@ -9,7 +9,7 @@
- <%= raw(@content.to_html) %> + <%= raw(@page.content.to_html) %>
diff --git a/config/routes.rb b/config/routes.rb index 7678adf..e3244f0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -86,23 +86,24 @@ DanBarberPhoto::Application.routes.draw do get :log_view end end - + resources :photos do member do get :log_view end end - - match 'about' => 'pages#about', :as => :about + #match 'contact' => 'pages#contact', :as => :contact resources :contacts, :only => [:new, :create] + match '/:name' => 'pages#show', :as => :page + # 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)))' # root :to => 'welcome#index' - root :to => 'pages#index' + root :to => 'home#index' # See how all your routes lay out with "rake routes"