@@ -1,7 +1,7 @@ | |||||
body { | body { | ||||
background-color: #fff; | background-color: #fff; | ||||
color: #333; | color: #333; | ||||
font-family: verdana, arial, helvetica, sans-serif; | |||||
font-family: "Helvetica Neue", arial, helvetica, sans-serif; | |||||
font-size: 13px; | font-size: 13px; | ||||
line-height: 18px; | line-height: 18px; | ||||
width: 800px; | width: 800px; | ||||
@@ -9,7 +9,6 @@ body { | |||||
} | } | ||||
p, ol, ul, td { | p, ol, ul, td { | ||||
font-family: verdana, arial, helvetica, sans-serif; | |||||
font-size: 13px; | font-size: 13px; | ||||
line-height: 18px; } | line-height: 18px; } | ||||
@@ -69,4 +68,10 @@ div { | |||||
a.button, a.button:visited { | a.button, a.button:visited { | ||||
color: #fff; | color: #fff; | ||||
text-decoration: none; | text-decoration: none; | ||||
} | |||||
#new_feed { | |||||
background-color: beige; | |||||
padding: 5px 10px; | |||||
margin: 10px 0; | |||||
} | } |
@@ -2,10 +2,9 @@ class FeedsController < ApplicationController | |||||
# GET /feeds | # GET /feeds | ||||
# GET /feeds.json | # GET /feeds.json | ||||
def index | def index | ||||
@feed = Feed.new | |||||
@feeds = Feed.all | @feeds = Feed.all | ||||
# render :template => '/feeds/index.html.haml' | |||||
respond_to do |format| | respond_to do |format| | ||||
format.html # index.html.erb | format.html # index.html.erb | ||||
format.json { render json: @feeds } | format.json { render json: @feeds } | ||||
@@ -46,7 +45,7 @@ class FeedsController < ApplicationController | |||||
respond_to do |format| | respond_to do |format| | ||||
if @feed.save | if @feed.save | ||||
format.html { redirect_to @feed, notice: 'Feed was successfully created.' } | |||||
format.html { redirect_to'/', notice: 'Feed was successfully created.' } | |||||
format.json { render json: @feed, status: :created, location: @feed } | format.json { render json: @feed, status: :created, location: @feed } | ||||
else | else | ||||
format.html { render action: "new" } | format.html { render action: "new" } | ||||
@@ -1,7 +1,7 @@ | |||||
class Feed | class Feed | ||||
include MongoMapper::Document | include MongoMapper::Document | ||||
key :title, String | |||||
key :title, String, :default => "[New feed - hasn't been fetched yet]" | |||||
key :link, String | key :link, String | ||||
key :last_fetched, Time, :default => nil | key :last_fetched, Time, :default => nil | ||||
timestamps! | timestamps! | ||||
@@ -1,4 +1,6 @@ | |||||
= form_for @feed do |f| | = form_for @feed do |f| | ||||
%h2 Add a feed | |||||
-if @feed.errors.any? | -if @feed.errors.any? | ||||
#error_explanation | #error_explanation | ||||
%h2= "#{pluralize(@feed.errors.count, "error")} prohibited this feed from being saved:" | %h2= "#{pluralize(@feed.errors.count, "error")} prohibited this feed from being saved:" | ||||
@@ -7,14 +9,15 @@ | |||||
%li= msg | %li= msg | ||||
.field | .field | ||||
-# | |||||
= f.label :title | = f.label :title | ||||
= f.text_field :title | = f.text_field :title | ||||
.field | .field | ||||
= f.label :link | |||||
= f.text_field :link | |||||
= f.label "URL" | |||||
= f.text_field :link, :size => 120 | |||||
= f.submit 'Save' | |||||
-# | -# | ||||
.field | .field | ||||
= f.label :last_fetched | = f.label :last_fetched | ||||
= f.datetime_select :last_fetched | = f.datetime_select :last_fetched | ||||
.actions | .actions | ||||
= f.submit 'Save' |
@@ -1,8 +1,5 @@ | |||||
%h1 Feeds | %h1 Feeds | ||||
%p= link_to 'Add a feed', new_feed_path, :class => 'button' | |||||
%table | %table | ||||
%tr | %tr | ||||
%th Title | %th Title | ||||
@@ -25,3 +22,5 @@ | |||||
%td= link_to 'Edit', edit_feed_path(feed) | %td= link_to 'Edit', edit_feed_path(feed) | ||||
%td= link_to 'Destroy', feed, :confirm => 'Are you sure?', :method => :delete | %td= link_to 'Destroy', feed, :confirm => 'Are you sure?', :method => :delete | ||||
#new_feed | |||||
= render 'form' |
@@ -1,5 +1,3 @@ | |||||
%p#notice= notice | |||||
%p | %p | ||||
%b Title: | %b Title: | ||||
= @feed.title | = @feed.title | ||||
@@ -9,6 +9,9 @@ | |||||
%body | %body | ||||
= image_tag "TAL_logo_blue-h100.png", :size => "275x100", :alt => "Talk About Local logo" | = image_tag "TAL_logo_blue-h100.png", :size => "275x100", :alt => "Talk About Local logo" | ||||
%p#notice= notice | |||||
= yield | = yield | ||||
@@ -50,7 +50,7 @@ Apollo::Application.routes.draw do | |||||
# You can have the root of your site routed with "root" | # You can have the root of your site routed with "root" | ||||
# just remember to delete public/index.html. | # just remember to delete public/index.html. | ||||
# root :to => 'welcome#index' | |||||
root :to => 'feeds#index' | |||||
# See how all your routes lay out with "rake routes" | # See how all your routes lay out with "rake routes" | ||||
@@ -1,241 +0,0 @@ | |||||
<!DOCTYPE html> | |||||
<html> | |||||
<head> | |||||
<title>Ruby on Rails: Welcome aboard</title> | |||||
<style type="text/css" media="screen"> | |||||
body { | |||||
margin: 0; | |||||
margin-bottom: 25px; | |||||
padding: 0; | |||||
background-color: #f0f0f0; | |||||
font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana"; | |||||
font-size: 13px; | |||||
color: #333; | |||||
} | |||||
h1 { | |||||
font-size: 28px; | |||||
color: #000; | |||||
} | |||||
a {color: #03c} | |||||
a:hover { | |||||
background-color: #03c; | |||||
color: white; | |||||
text-decoration: none; | |||||
} | |||||
#page { | |||||
background-color: #f0f0f0; | |||||
width: 750px; | |||||
margin: 0; | |||||
margin-left: auto; | |||||
margin-right: auto; | |||||
} | |||||
#content { | |||||
float: left; | |||||
background-color: white; | |||||
border: 3px solid #aaa; | |||||
border-top: none; | |||||
padding: 25px; | |||||
width: 500px; | |||||
} | |||||
#sidebar { | |||||
float: right; | |||||
width: 175px; | |||||
} | |||||
#footer { | |||||
clear: both; | |||||
} | |||||
#header, #about, #getting-started { | |||||
padding-left: 75px; | |||||
padding-right: 30px; | |||||
} | |||||
#header { | |||||
background-image: url("assets/rails.png"); | |||||
background-repeat: no-repeat; | |||||
background-position: top left; | |||||
height: 64px; | |||||
} | |||||
#header h1, #header h2 {margin: 0} | |||||
#header h2 { | |||||
color: #888; | |||||
font-weight: normal; | |||||
font-size: 16px; | |||||
} | |||||
#about h3 { | |||||
margin: 0; | |||||
margin-bottom: 10px; | |||||
font-size: 14px; | |||||
} | |||||
#about-content { | |||||
background-color: #ffd; | |||||
border: 1px solid #fc0; | |||||
margin-left: -55px; | |||||
margin-right: -10px; | |||||
} | |||||
#about-content table { | |||||
margin-top: 10px; | |||||
margin-bottom: 10px; | |||||
font-size: 11px; | |||||
border-collapse: collapse; | |||||
} | |||||
#about-content td { | |||||
padding: 10px; | |||||
padding-top: 3px; | |||||
padding-bottom: 3px; | |||||
} | |||||
#about-content td.name {color: #555} | |||||
#about-content td.value {color: #000} | |||||
#about-content ul { | |||||
padding: 0; | |||||
list-style-type: none; | |||||
} | |||||
#about-content.failure { | |||||
background-color: #fcc; | |||||
border: 1px solid #f00; | |||||
} | |||||
#about-content.failure p { | |||||
margin: 0; | |||||
padding: 10px; | |||||
} | |||||
#getting-started { | |||||
border-top: 1px solid #ccc; | |||||
margin-top: 25px; | |||||
padding-top: 15px; | |||||
} | |||||
#getting-started h1 { | |||||
margin: 0; | |||||
font-size: 20px; | |||||
} | |||||
#getting-started h2 { | |||||
margin: 0; | |||||
font-size: 14px; | |||||
font-weight: normal; | |||||
color: #333; | |||||
margin-bottom: 25px; | |||||
} | |||||
#getting-started ol { | |||||
margin-left: 0; | |||||
padding-left: 0; | |||||
} | |||||
#getting-started li { | |||||
font-size: 18px; | |||||
color: #888; | |||||
margin-bottom: 25px; | |||||
} | |||||
#getting-started li h2 { | |||||
margin: 0; | |||||
font-weight: normal; | |||||
font-size: 18px; | |||||
color: #333; | |||||
} | |||||
#getting-started li p { | |||||
color: #555; | |||||
font-size: 13px; | |||||
} | |||||
#sidebar ul { | |||||
margin-left: 0; | |||||
padding-left: 0; | |||||
} | |||||
#sidebar ul h3 { | |||||
margin-top: 25px; | |||||
font-size: 16px; | |||||
padding-bottom: 10px; | |||||
border-bottom: 1px solid #ccc; | |||||
} | |||||
#sidebar li { | |||||
list-style-type: none; | |||||
} | |||||
#sidebar ul.links li { | |||||
margin-bottom: 5px; | |||||
} | |||||
.filename { | |||||
font-style: italic; | |||||
} | |||||
</style> | |||||
<script type="text/javascript"> | |||||
function about() { | |||||
info = document.getElementById('about-content'); | |||||
if (window.XMLHttpRequest) | |||||
{ xhr = new XMLHttpRequest(); } | |||||
else | |||||
{ xhr = new ActiveXObject("Microsoft.XMLHTTP"); } | |||||
xhr.open("GET","rails/info/properties",false); | |||||
xhr.send(""); | |||||
info.innerHTML = xhr.responseText; | |||||
info.style.display = 'block' | |||||
} | |||||
</script> | |||||
</head> | |||||
<body> | |||||
<div id="page"> | |||||
<div id="sidebar"> | |||||
<ul id="sidebar-items"> | |||||
<li> | |||||
<h3>Browse the documentation</h3> | |||||
<ul class="links"> | |||||
<li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li> | |||||
<li><a href="http://api.rubyonrails.org/">Rails API</a></li> | |||||
<li><a href="http://www.ruby-doc.org/core/">Ruby core</a></li> | |||||
<li><a href="http://www.ruby-doc.org/stdlib/">Ruby standard library</a></li> | |||||
</ul> | |||||
</li> | |||||
</ul> | |||||
</div> | |||||
<div id="content"> | |||||
<div id="header"> | |||||
<h1>Welcome aboard</h1> | |||||
<h2>You’re riding Ruby on Rails!</h2> | |||||
</div> | |||||
<div id="about"> | |||||
<h3><a href="rails/info/properties" onclick="about(); return false">About your application’s environment</a></h3> | |||||
<div id="about-content" style="display: none"></div> | |||||
</div> | |||||
<div id="getting-started"> | |||||
<h1>Getting started</h1> | |||||
<h2>Here’s how to get rolling:</h2> | |||||
<ol> | |||||
<li> | |||||
<h2>Use <code>rails generate</code> to create your models and controllers</h2> | |||||
<p>To see all available options, run it without parameters.</p> | |||||
</li> | |||||
<li> | |||||
<h2>Set up a default route and remove <span class="filename">public/index.html</span></h2> | |||||
<p>Routes are set up in <span class="filename">config/routes.rb</span>.</p> | |||||
</li> | |||||
<li> | |||||
<h2>Create your database</h2> | |||||
<p>Run <code>rake db:create</code> to create your database. If you're not using SQLite (the default), edit <span class="filename">config/database.yml</span> with your username and password.</p> | |||||
</li> | |||||
</ol> | |||||
</div> | |||||
</div> | |||||
<div id="footer"> </div> | |||||
</div> | |||||
</body> | |||||
</html> |