From 9f9fecc4e50126d8d71a78972b5a5fc7c162b5b3 Mon Sep 17 00:00:00 2001 From: Florida Elago Date: Thu, 29 Nov 2012 12:49:31 -0600 Subject: [PATCH] Updating footer links --- app/admin/footer_links.rb | 3 +++ app/controllers/application_controller.rb | 6 +++++- app/models/footer_link.rb | 3 +++ app/views/layouts/application.html.erb | 10 +++++----- db/migrate/20121129050147_create_footer_links.rb | 10 ++++++++++ db/schema.rb | 9 ++++++++- test/fixtures/footer_links.yml | 9 +++++++++ test/unit/footer_link_test.rb | 7 +++++++ 8 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 app/admin/footer_links.rb create mode 100644 app/models/footer_link.rb create mode 100644 db/migrate/20121129050147_create_footer_links.rb create mode 100644 test/fixtures/footer_links.yml create mode 100644 test/unit/footer_link_test.rb diff --git a/app/admin/footer_links.rb b/app/admin/footer_links.rb new file mode 100644 index 0000000..5309b34 --- /dev/null +++ b/app/admin/footer_links.rb @@ -0,0 +1,3 @@ +ActiveAdmin.register FooterLink do + +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 7e1335a..77354a4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -3,12 +3,16 @@ class ApplicationController < ActionController::Base helper_method :current_user private - before_filter :get_pages + before_filter :get_pages, :get_footer_links def get_pages @pages = Page.all end + def get_footer_links + @footer_links = FooterLink.all + end + def current_user @current_user ||= User.find(session[:user_id]) if session[:user_id] end diff --git a/app/models/footer_link.rb b/app/models/footer_link.rb new file mode 100644 index 0000000..f27c828 --- /dev/null +++ b/app/models/footer_link.rb @@ -0,0 +1,3 @@ +class FooterLink < ActiveRecord::Base + attr_accessible :name, :url +end diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index b53d2ae..a9f1272 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -54,11 +54,11 @@ diff --git a/db/migrate/20121129050147_create_footer_links.rb b/db/migrate/20121129050147_create_footer_links.rb new file mode 100644 index 0000000..98eba25 --- /dev/null +++ b/db/migrate/20121129050147_create_footer_links.rb @@ -0,0 +1,10 @@ +class CreateFooterLinks < ActiveRecord::Migration + def change + create_table :footer_links do |t| + t.string :name + t.string :url + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index cca20db..a65d95a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20121129041452) do +ActiveRecord::Schema.define(:version => 20121129050147) do create_table "active_admin_comments", :force => true do |t| t.string "resource_id", :null => false @@ -52,6 +52,13 @@ t.datetime "updated_at", :null => false end + create_table "footer_links", :force => true do |t| + t.string "name" + t.string "url" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "lineitems", :force => true do |t| t.integer "product_id" t.integer "order_id" diff --git a/test/fixtures/footer_links.yml b/test/fixtures/footer_links.yml new file mode 100644 index 0000000..e46058f --- /dev/null +++ b/test/fixtures/footer_links.yml @@ -0,0 +1,9 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +one: + name: MyString + url: MyString + +two: + name: MyString + url: MyString diff --git a/test/unit/footer_link_test.rb b/test/unit/footer_link_test.rb new file mode 100644 index 0000000..a24f61a --- /dev/null +++ b/test/unit/footer_link_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class FooterLinkTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end