This repository has been archived on 2021-07-13. You can view files and clone it, but cannot push or open issues or pull requests.
feedfu/app/controllers/feeds_controller.rb

33 lines
696 B
Ruby

class FeedsController < ApplicationController
# Show all feeds
def index
@feeds = Feed.all
end
# Show a single feed
def show
@items = Feed.find(params[:id]).items
render :layout => false
end
def create
@feed = Feed.import(params[:feed][:url])
redirect_to :action => :index, :notice => "Add the feed"
end
def destroy
Feed.find(params[:id]).destroy
render :nothing => true, :status => :ok
end
def errors
@errors = Feed.find(params[:id]).errors
render :layout => false
end
def import
fh = File.open(Rails.root.join("public", "uploads", params[:importer][:import_file].original_filename))
# TODO: Hier gehts weiter
end
end