@@ -91,15 +91,15 @@ class FeedsController < ApplicationController | |||||
# DELETE /feeds/1 | # DELETE /feeds/1 | ||||
# DELETE /feeds/1.json | # DELETE /feeds/1.json | ||||
def destroy | |||||
@feed = Feed.find(params[:id]) | |||||
@feed.destroy | |||||
respond_to do |format| | |||||
format.html { redirect_to feeds_url, notice: 'Feed deleted OK' } | |||||
format.json { head :no_content } | |||||
end | |||||
end | |||||
# def destroy | |||||
# @feed = Feed.find(params[:id]) | |||||
# @feed.destroy | |||||
# | |||||
# respond_to do |format| | |||||
# format.html { redirect_to feeds_url, notice: 'Feed deleted OK' } | |||||
# format.json { head :no_content } | |||||
# end | |||||
# end | |||||
def fetch | def fetch | ||||
@feed = Feed.find(params[:id]) | @feed = Feed.find(params[:id]) | ||||
@@ -84,4 +84,14 @@ class LayersController < ApplicationController | |||||
format.json { head :no_content } | format.json { head :no_content } | ||||
end | end | ||||
end | end | ||||
# DELETE /layers/1/delete_feed | |||||
# This only deletes the relation between the layer and the feed. The feed (and its posts) are retained. | |||||
# Currently there's no way for the user to actually delete a feed completely. | |||||
def delete_feed | |||||
@layer = Layer.find(params[:id]) | |||||
@feed = Feed.find(params[:feed_id]) | |||||
@layer.feeds.delete(@feed) | |||||
redirect_to @layer, notice: "Deleted feed #{@feed.title} from this layer" | |||||
end | |||||
end | end |
@@ -38,7 +38,7 @@ | |||||
= (time_ago_in_words(f.last_fetched) + " ago").gsub(/ +/, " ").html_safe | = (time_ago_in_words(f.last_fetched) + " ago").gsub(/ +/, " ").html_safe | ||||
%td= link_to "Fetch", fetch_feed_url(f), :class => "button" | %td= link_to "Fetch", fetch_feed_url(f), :class => "button" | ||||
%td= link_to 'Edit', edit_feed_path(f), :class => "button" | %td= link_to 'Edit', edit_feed_path(f), :class => "button" | ||||
%td= link_to 'Delete', f, :confirm => "Delete #{f.title} and all its posts?", :method => :delete, :class => "button" | |||||
%td= link_to 'Delete', delete_feed_layer_path(:feed_id => f.id), :confirm => "Delete #{f.title} from this layer?", :method => :delete, :class => "button" | |||||
%tr | %tr | ||||
%td | %td | ||||
@@ -2,7 +2,12 @@ Apollo::Application.routes.draw do | |||||
get "logout" => "sessions#destroy", :as => "logout" | get "logout" => "sessions#destroy", :as => "logout" | ||||
get "login" => "sessions#new", :as => "login" | get "login" => "sessions#new", :as => "login" | ||||
resources :layers | |||||
resources :layers do | |||||
member do | |||||
delete "delete_feed" | |||||
end | |||||
end | |||||
resources :users | resources :users | ||||
resources :sessions | resources :sessions | ||||
resources :password_resets | resources :password_resets | ||||