From: Neil Smith Date: Wed, 22 Jul 2009 14:35:20 +0000 (+0000) Subject: Merged changes into stable branch X-Git-Url: https://git.njae.me.uk/?p=feedcatcher.git;a=commitdiff_plain;h=f93204b41a8378389eb75b9215305fcc57145ac2 Merged changes into stable branch --- diff --git a/app/controllers/feed_controller.rb b/app/controllers/feed_controller.rb index 2d6fee9..30ddb0c 100644 --- a/app/controllers/feed_controller.rb +++ b/app/controllers/feed_controller.rb @@ -36,8 +36,8 @@ class FeedController < ApplicationController def update - if valid_feed_name?(params[:new_feed_name]) - item = FeedItem.find_by_feed_name_and_title(params[:new_feed_name], params[:title]) + if valid_feed_name?(params[:feed_name]) + item = FeedItem.find_by_feed_name_and_title(params[:feed_name], params[:title]) if item if params[:description] == '' destroy_item(item) @@ -70,19 +70,19 @@ class FeedController < ApplicationController def create_item - item = FeedItem.new(:feed_name => params[:new_feed_name], + item = FeedItem.new(:feed_name => params[:feed_name], :title => params[:title], :description => params[:description]) item.save! flash[:notice] = "Element #{params[:title]} created" respond_to do |format| - format.html { redirect_to feed_url(params[:new_feed_name]) } + format.html { redirect_to feed_url(params[:feed_name]) } format.rss { head :ok } end rescue ActiveRecord::RecordInvalid => error flash[:notice] = "Element #{params[:title]} could not be created" respond_to do |format| - format.html { redirect_to feed_url(params[:new_feed_name]) } + format.html { redirect_to feed_url(params[:feed_name]) } format.rss { head :unprocessable_entity } end end @@ -92,13 +92,13 @@ class FeedController < ApplicationController if item.update_attribute(:description, params[:description]) flash[:notice] = "Element #{params[:title]} updated" respond_to do |format| - format.html { redirect_to feed_url(params[:new_feed_name]) } + format.html { redirect_to feed_url(params[:feed_name]) } format.rss { head :ok } end else flash[:notice] = "Element #{params[:title]} could not be updated" respond_to do |format| - format.html { redirect_to feed_url(params[:new_feed_name]) } + format.html { redirect_to feed_url(params[:feed_name]) } format.rss { head :unprocessable_entity } end end @@ -109,13 +109,13 @@ class FeedController < ApplicationController if item.destroy flash[:notice] = "Element #{params[:title]} destroyed" respond_to do |format| - format.html { redirect_to feed_url(params[:new_feed_name]) } + format.html { redirect_to feed_url(params[:feed_name]) } format.rss { head :ok } end else flash[:notice] = "Element #{params[:title]} could not be destroyed" respond_to do |format| - format.html { redirect_to feed_url(params[:new_feed_name]) } + format.html { redirect_to feed_url(params[:feed_name]) } format.rss { head :unprocessable_entity } end end diff --git a/app/views/feed/index.html.erb b/app/views/feed/index.html.erb index 1a6534b..8b2e8c1 100644 --- a/app/views/feed/index.html.erb +++ b/app/views/feed/index.html.erb @@ -1,7 +1,7 @@

Feeds available

<% form_tag :action => 'update' do %> -

Set feed <%= text_field_tag :new_feed_name, '', :size => 20 %> +

Set feed <%= text_field_tag :feed_name, '', :size => 20 %> to include <%= text_field_tag :title, '', :size => 30 %> containing <%= text_field_tag :description, '', :size => 50 %> <%= submit_tag 'Update' %>

diff --git a/app/views/feed/index.rss.builder b/app/views/feed/index.rss.builder index 93ce050..a122ec0 100644 --- a/app/views/feed/index.rss.builder +++ b/app/views/feed/index.rss.builder @@ -3,8 +3,8 @@ xml.instruct! :xml, :version => "1.0" xml.rss :version => "2.0" do xml.channel do xml.title "Feedcatcher" - xml.description "Feeds available" xml.link index_url(:rss) + xml.description "Feeds available" for feed in @feeds xml.item do diff --git a/app/views/feed/show.html.erb b/app/views/feed/show.html.erb index 739584c..2a2b9b1 100644 --- a/app/views/feed/show.html.erb +++ b/app/views/feed/show.html.erb @@ -2,7 +2,7 @@

<%= link_to("List of all feeds", index_url) %>

<% form_tag :action => 'update' do %> -

Set feed <%= text_field_tag :new_feed_name, h(params[:feed_name]), :size => 20 %> +

Set feed <%= text_field_tag :feed_name, h(params[:feed_name]), :size => 20 %> to include <%= text_field_tag :title, '', :size => 30 %> containing <%= text_field_tag :description, '', :size => 50 %> <%= submit_tag 'Update' %>

diff --git a/app/views/feed/show.rss.builder b/app/views/feed/show.rss.builder index 7fdfe20..dd8f41d 100644 --- a/app/views/feed/show.rss.builder +++ b/app/views/feed/show.rss.builder @@ -1,9 +1,10 @@ -# index.rss.builder +# show.rss.builder xml.instruct! :xml, :version => "1.0" xml.rss :version => "2.0" do xml.channel do xml.title @feed_name xml.link feed_url(@feed_name, :rss) + xml.description "The #{h @feed_name} feed" for item in @feed_items xml.item do diff --git a/config/routes.rb b/config/routes.rb index 7754dd1..1240ec4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -38,9 +38,9 @@ ActionController::Routing::Routes.draw do |map| :conditions => { :method => :get }, :controller => 'feed', :action => 'show' - map.update ':feed_name', + map.update ':ignored', :conditions => { :method => :post }, - :defaults => { :feed_name => nil }, + :defaults => { :ignored => nil }, :controller => 'feed', :action => 'update'