diff --git a/app/assets/javascripts/feeds.js.coffee b/app/assets/javascripts/feeds.js.coffee index 5145f02..b1f72c9 100644 --- a/app/assets/javascripts/feeds.js.coffee +++ b/app/assets/javascripts/feeds.js.coffee @@ -5,7 +5,9 @@ $(document).ready -> $("#feed_list > li > a").bind("ajax:success", (event, data, status, xhr) -> $("#feed_content").html(data) - $(".item > a").bind("ajax:success", (event, data, status, xhr) -> - $(this).parent().append(data) + $(".item > a", $("#feed_content")).bind("ajax:success", (event, data, status, xhr) -> + item = $(this).parent() + $("article", item).html(data) + $("a", item).bind() ) - ) \ No newline at end of file + ) diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb index 21cf3d7..558cb9f 100644 --- a/app/controllers/feeds_controller.rb +++ b/app/controllers/feeds_controller.rb @@ -14,4 +14,9 @@ class FeedsController < ApplicationController @feed = Feed.import(params[:feed][:url]) redirect_to :action => :index, :notice => "Add the feed" end + + def import + fh = File.open(Rails.root.join("public", "uploads", params[:importer][:import_file].original_filename)) + # TODO: Hier gehts weiter + end end diff --git a/app/views/feeds/import.html.erb b/app/views/feeds/import.html.erb new file mode 100644 index 0000000..f591032 --- /dev/null +++ b/app/views/feeds/import.html.erb @@ -0,0 +1,11 @@ +<%= form_for(:importer, :url => import_feeds_path, :multipart => true, :remote => true) do |f| %> + <%= file_field_tag :import_file %> + + <%= f.label :regex, "Insert a regular expression:" %> + <%= f.text_field :regex %> + <%= f.submit, "" %> +<% end %> + +

Preview

+ diff --git a/app/views/feeds/index.html.erb b/app/views/feeds/index.html.erb index 2cda446..e50a807 100644 --- a/app/views/feeds/index.html.erb +++ b/app/views/feeds/index.html.erb @@ -1,5 +1,6 @@
<%= render :partial => "add" %> + <%= link_to "Import a list of feeds", import_feeds_path %>