From d4f528bba8926927a032b83cfdf29c3b131b9b33 Mon Sep 17 00:00:00 2001 From: ilya Date: Fri, 25 Jun 2010 23:23:37 -0400 Subject: [PATCH] Removed bookmark new page, moved form to index --- app/controllers/bookmarks_controller.rb | 1 + app/views/bookmarks/_form.html.haml | 12 ------------ app/views/bookmarks/_new_bookmark.haml | 6 ++++++ app/views/bookmarks/index.html.haml | 4 ++-- public/javascripts/view.js | 14 ++++++++++---- 5 files changed, 19 insertions(+), 18 deletions(-) delete mode 100644 app/views/bookmarks/_form.html.haml create mode 100644 app/views/bookmarks/_new_bookmark.haml diff --git a/app/controllers/bookmarks_controller.rb b/app/controllers/bookmarks_controller.rb index 51f9fb6bb..5d62eace7 100644 --- a/app/controllers/bookmarks_controller.rb +++ b/app/controllers/bookmarks_controller.rb @@ -2,6 +2,7 @@ class BookmarksController < ApplicationController before_filter :authenticate_user! def index + @bookmark = Bookmark.new @bookmarks = Bookmark.sort(:created_at.desc).all end diff --git a/app/views/bookmarks/_form.html.haml b/app/views/bookmarks/_form.html.haml deleted file mode 100644 index 0e02f4082..000000000 --- a/app/views/bookmarks/_form.html.haml +++ /dev/null @@ -1,12 +0,0 @@ -= form_for @bookmark do |f| - = f.error_messages - %p - = f.label :title - %br - = f.text_field :title - %p - = f.label :link - %br - = f.text_field :link - %p - = f.submit diff --git a/app/views/bookmarks/_new_bookmark.haml b/app/views/bookmarks/_new_bookmark.haml new file mode 100644 index 000000000..bea9ba7cc --- /dev/null +++ b/app/views/bookmarks/_new_bookmark.haml @@ -0,0 +1,6 @@ += form_for @bookmark, :remote => true do |f| + = f.error_messages + = f.text_field :title, :value => "Title" + = f.text_field :link, :value => "URL" + %p + = f.submit diff --git a/app/views/bookmarks/index.html.haml b/app/views/bookmarks/index.html.haml index f518a2635..48bfedc50 100644 --- a/app/views/bookmarks/index.html.haml +++ b/app/views/bookmarks/index.html.haml @@ -1,5 +1,5 @@ -%h1= link_to "new bookmark", new_bookmark_path - +%h1.big_text bookmarks += render "bookmarks/new_bookmark", :bookmark => @bookmark %ul#stream - for bookmark in @bookmarks = render "bookmark", :post => bookmark diff --git a/public/javascripts/view.js b/public/javascripts/view.js index 53fdc03a0..3593fa4c6 100644 --- a/public/javascripts/view.js +++ b/public/javascripts/view.js @@ -25,10 +25,16 @@ $(document).ready(function(){ $(this).fadeTo(80, 1); }); - $('#status_message_message').click(function() { - $(this).val("") - }); + $('#status_message_message').click(clearForm); + $('#bookmark_title').click(clearForm); + + $('#bookmark_link').click(clearForm); + + function clearForm(){ + $(this).val(""); + } + $('#debug_info').click(function() { $('#debug_more').toggle('fast', function() { @@ -39,4 +45,4 @@ $(document).ready(function(){ $('#flash_notice, #flash_error, #flash_alert').delay(1500).slideUp(130); -});//end document ready \ No newline at end of file +});//end document ready