diff --git a/app/assets/javascripts/feeds.js.coffee b/app/assets/javascripts/feeds.js.coffee index 3975d34..5145f02 100644 --- a/app/assets/javascripts/feeds.js.coffee +++ b/app/assets/javascripts/feeds.js.coffee @@ -5,9 +5,7 @@ $(document).ready -> $("#feed_list > li > a").bind("ajax:success", (event, data, status, xhr) -> $("#feed_content").html(data) - ) - - add_event_lister -> - $("#item > a").bind("ajax:success", (event, data, status, xhr) -> - $(this).append(data) - ) \ No newline at end of file + $(".item > a").bind("ajax:success", (event, data, status, xhr) -> + $(this).parent().append(data) + ) + ) \ No newline at end of file diff --git a/app/assets/javascripts/items.js.coffee b/app/assets/javascripts/items.js.coffee new file mode 100644 index 0000000..7615679 --- /dev/null +++ b/app/assets/javascripts/items.js.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ diff --git a/app/assets/stylesheets/items.css.scss b/app/assets/stylesheets/items.css.scss new file mode 100644 index 0000000..49e8648 --- /dev/null +++ b/app/assets/stylesheets/items.css.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the items controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb index bb95761..21cf3d7 100644 --- a/app/controllers/feeds_controller.rb +++ b/app/controllers/feeds_controller.rb @@ -7,10 +7,7 @@ class FeedsController < ApplicationController # Show a single feed def show @items = Feed.find(params[:id]).items - end - - def load_item - @item = Item.find(params[:id]) + render :layout => false end def create diff --git a/app/controllers/items_controller.rb b/app/controllers/items_controller.rb new file mode 100644 index 0000000..eee7cb6 --- /dev/null +++ b/app/controllers/items_controller.rb @@ -0,0 +1,6 @@ +class ItemsController < ApplicationController + def show + @item = Item.find(params[:id]) + render :layout => false + end +end diff --git a/app/helpers/items_helper.rb b/app/helpers/items_helper.rb new file mode 100644 index 0000000..cff0c9f --- /dev/null +++ b/app/helpers/items_helper.rb @@ -0,0 +1,2 @@ +module ItemsHelper +end diff --git a/app/views/feeds/show.html.erb b/app/views/feeds/show.html.erb index 96d9982..8ab8c95 100644 --- a/app/views/feeds/show.html.erb +++ b/app/views/feeds/show.html.erb @@ -1,8 +1,8 @@ \ No newline at end of file diff --git a/app/views/items/show.html.erb b/app/views/items/show.html.erb new file mode 100644 index 0000000..dda24dc --- /dev/null +++ b/app/views/items/show.html.erb @@ -0,0 +1,3 @@ +

+ <%= raw @item.content %> +

\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 2917d26..85ae314 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,11 +12,7 @@ FeedFu::Application.routes.draw do # Sample resource route (maps HTTP verbs to controller actions automatically): # resources :products - resources :feeds do - member do - get "load_item" - end - end + resources :feeds, :items # Sample resource route with options: # resources :products do @@ -53,7 +49,7 @@ FeedFu::Application.routes.draw do # You can have the root of your site routed with "root" # 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" diff --git a/test/functional/items_controller_test.rb b/test/functional/items_controller_test.rb new file mode 100644 index 0000000..5f54afb --- /dev/null +++ b/test/functional/items_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ItemsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/items_helper_test.rb b/test/unit/helpers/items_helper_test.rb new file mode 100644 index 0000000..b2f7c49 --- /dev/null +++ b/test/unit/helpers/items_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ItemsHelperTest < ActionView::TestCase +end