Commit 5b08a5f
Changed files (9)
app
admin
controllers
models
views
config
db
app/admin/resources.rb
@@ -0,0 +1,3 @@
+ActiveAdmin.register Resource do
+
+end
app/controllers/resources_controller.rb
@@ -0,0 +1,5 @@
+class ResourcesController < ApplicationController
+ def index
+ @resources = Resource.all
+ end
+end
app/models/resource.rb
@@ -0,0 +1,3 @@
+class Resource < ActiveRecord::Base
+ attr_accessible :title, :link, :description
+end
\ No newline at end of file
app/views/layouts/_header.html.erb
@@ -12,6 +12,7 @@
<li><%= link_to "Needs", needs_path %></li>
<li><%= link_to "Neighbourhoods", neighbourhoods_path %></li>
<li><a href="http://t.co/exF4flyIPd" target="_blank">Map</a></li>
+ <li><%= link_to "Resources", resources_path %></li>
</ul>
<ul class="nav pull-right">
<li><a href="http://github.com/mokhan/yycrebuild">Developers <i class="icon-github"></i></a> </li>
app/views/neighbourhoods/index.html.erb
@@ -1,6 +1,6 @@
<div class="row neighbourhoods">
<div class="span12">
- <h1>neighbourhoods</h1>
+ <h1>Neighbourhoods</h1>
<table class="table">
<thead>
<tr>
app/views/resources/index.html.erb
@@ -0,0 +1,21 @@
+<div class="row resources">
+ <div class="span12">
+ <h1>Resources</h1>
+ <table class="table">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Status</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @resources.each do |resource| %>
+ <tr>
+ <td><%= link_to resource.title, resource.link %></td>
+ <td><%= resource.description %></td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+</div>
config/routes.rb
@@ -7,5 +7,6 @@ Yycrebuild::Application.routes.draw do
resources :needs
resources :neighbourhoods
+ resources :resources
resources :tags, :only => [:show], :path => :t
end
db/migrate/20130624022039_create_resources.rb
@@ -0,0 +1,11 @@
+class CreateResources < ActiveRecord::Migration
+ def change
+ create_table :resources do |t|
+ t.string :title
+ t.string :link
+ t.string :description
+
+ t.timestamps
+ end
+ end
+end
db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130623045925) do
+ActiveRecord::Schema.define(:version => 20130624022039) do
create_table "active_admin_comments", :force => true do |t|
t.string "resource_id", :null => false
@@ -63,6 +63,14 @@ ActiveRecord::Schema.define(:version => 20130623045925) do
t.datetime "updated_at", :null => false
end
+ create_table "resources", :force => true do |t|
+ t.string "title"
+ t.string "link"
+ t.string "description"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
create_table "taggings", :force => true do |t|
t.integer "tag_id"
t.integer "taggable_id"