Skip to content
This repository has been archived by the owner on May 5, 2018. It is now read-only.

Commit

Permalink
Updating footer links
Browse files Browse the repository at this point in the history
  • Loading branch information
florida committed Nov 29, 2012
1 parent deb94c3 commit 9f9fecc
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 7 deletions.
3 changes: 3 additions & 0 deletions app/admin/footer_links.rb
@@ -0,0 +1,3 @@
ActiveAdmin.register FooterLink do

end
6 changes: 5 additions & 1 deletion app/controllers/application_controller.rb
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/models/footer_link.rb
@@ -0,0 +1,3 @@
class FooterLink < ActiveRecord::Base
attr_accessible :name, :url
end
10 changes: 5 additions & 5 deletions app/views/layouts/application.html.erb
Expand Up @@ -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>

Expand Down
10 changes: 10 additions & 0 deletions 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
9 changes: 8 additions & 1 deletion db/schema.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
9 changes: 9 additions & 0 deletions 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
7 changes: 7 additions & 0 deletions 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

0 comments on commit 9f9fecc

Please sign in to comment.