Make the importer even more robust and add a delete button

This commit is contained in:
Aaron Mueller 2013-01-10 21:34:08 +01:00
parent 04fa99b1f8
commit c24799fed2
3 changed files with 7 additions and 5 deletions

View file

@ -1,12 +1,12 @@
class FeedsController < ApplicationController class FeedsController < ApplicationController
# Show all feeds # Show all feeds
def index def index
@feeds = Feed.all @feeds = Feed.order("title").all
end end
# Show a single feed # Show a single feed
def show def show
@items = Feed.find(params[:id]).items @feed = Feed.find(params[:id])
render :layout => false render :layout => false
end end
@ -26,7 +26,7 @@ class FeedsController < ApplicationController
end end
def import def import
fh = File.open(Rails.root.join("public", "uploads", params[:importer][:import_file].original_filename)) #fh = File.open(Rails.root.join("public", "uploads", params[:importer][:import_file].original_filename))
# TODO: Hier gehts weiter # TODO: Hier gehts weiter
end end
end end

View file

@ -14,7 +14,7 @@ class Item < ActiveRecord::Base
:title => feed_entry.title, :title => feed_entry.title,
:url => feed_entry.url, :url => feed_entry.url,
:author => feed_entry.author || "Anonymous", :author => feed_entry.author || "Anonymous",
:published_at => feed_entry.published, :published_at => feed_entry.published || Time.now,
:content => feed_entry.content || feed_entry.summary || "No content available" :content => feed_entry.content || feed_entry.summary || "No content available"
) )
end end

View file

@ -1,5 +1,7 @@
<h3><%= link_to(@feed.url, @feed.url) %></h3>
<ul> <ul>
<% @items.each do |item| %> <% @feed.items.each do |item| %>
<li class="item"> <li class="item">
<%= link_to raw(item.title), item_path(item), :remote => true %> <%= link_to raw(item.title), item_path(item), :remote => true %>
<em class="date_published"><%= time_ago_in_words(item.published_at) %></em> <em class="author">by <%= item.author %></em> <em class="date_published"><%= time_ago_in_words(item.published_at) %></em> <em class="author">by <%= item.author %></em>