Permalink
Browse files

Updating footer links

  • Loading branch information...
1 parent deb94c3 commit 9f9fecc4e50126d8d71a78972b5a5fc7c162b5b3 @florida committed Nov 29, 2012
@@ -0,0 +1,3 @@
+ActiveAdmin.register FooterLink do
+
+end
@@ -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
@@ -0,0 +1,3 @@
+class FooterLink < ActiveRecord::Base
+ attr_accessible :name, :url
+end
@@ -54,11 +54,11 @@
<section id="footer_amplifier"></section>
<section id="footer_container">
<ul>
- <li><%= link_to 'Link', '#'%></li>
- <li><%= link_to 'Link', '#'%></li>
- <li><%= link_to 'Link', '#'%></li>
- <li><%= link_to 'Link', '#'%></li>
- <li><%= link_to 'Link', '#'%></li>
+ <% unless @footer_links.empty? %>
+ <% @footer_links.each do |link| %>
+ <li><%= link_to link.name, "#{link.url}" %></li>
+ <% end %>
+ <% end %>
</ul>
</section>
@@ -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
View
@@ -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"
@@ -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
@@ -0,0 +1,7 @@
+require 'test_helper'
+
+class FooterLinkTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end

0 comments on commit 9f9fecc

Please sign in to comment.