Show diary entry after creation
This allows users to review their post and use the social share buttons more easily. Refs #1391
This commit is contained in:
parent
c20160d313
commit
55e3f90dd4
2 changed files with 4 additions and 4 deletions
|
@ -123,7 +123,7 @@ class DiaryEntriesController < ApplicationController
|
||||||
# Subscribe user to diary comments
|
# Subscribe user to diary comments
|
||||||
@diary_entry.subscriptions.create(:user => current_user)
|
@diary_entry.subscriptions.create(:user => current_user)
|
||||||
|
|
||||||
redirect_to :action => "index", :display_name => current_user.display_name
|
redirect_to diary_entry_path(@diary_entry.user, @diary_entry)
|
||||||
else
|
else
|
||||||
render :action => "new"
|
render :action => "new"
|
||||||
end
|
end
|
||||||
|
|
|
@ -159,8 +159,8 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
|
||||||
post diary_entries_path(:diary_entry => { :title => "New Title", :body => "This is a new body for the diary entry", :latitude => "1.1",
|
post diary_entries_path(:diary_entry => { :title => "New Title", :body => "This is a new body for the diary entry", :latitude => "1.1",
|
||||||
:longitude => "2.2", :language_code => "en" })
|
:longitude => "2.2", :language_code => "en" })
|
||||||
end
|
end
|
||||||
assert_redirected_to :action => :index, :display_name => user.display_name
|
|
||||||
entry = DiaryEntry.last
|
entry = DiaryEntry.last
|
||||||
|
assert_redirected_to diary_entry_path(user, entry)
|
||||||
assert_equal user.id, entry.user_id
|
assert_equal user.id, entry.user_id
|
||||||
assert_equal "New Title", entry.title
|
assert_equal "New Title", entry.title
|
||||||
assert_equal "This is a new body for the diary entry", entry.body
|
assert_equal "This is a new body for the diary entry", entry.body
|
||||||
|
@ -184,8 +184,8 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
|
||||||
post diary_entries_path(:diary_entry => { :title => "New Title", :body => "This is a new body for the diary entry", :latitude => "1.1",
|
post diary_entries_path(:diary_entry => { :title => "New Title", :body => "This is a new body for the diary entry", :latitude => "1.1",
|
||||||
:longitude => "2.2", :language_code => "de" })
|
:longitude => "2.2", :language_code => "de" })
|
||||||
end
|
end
|
||||||
assert_redirected_to :action => :index, :display_name => user.display_name
|
|
||||||
entry = DiaryEntry.last
|
entry = DiaryEntry.last
|
||||||
|
assert_redirected_to diary_entry_path(user, entry)
|
||||||
assert_equal user.id, entry.user_id
|
assert_equal user.id, entry.user_id
|
||||||
assert_equal "New Title", entry.title
|
assert_equal "New Title", entry.title
|
||||||
assert_equal "This is a new body for the diary entry", entry.body
|
assert_equal "This is a new body for the diary entry", entry.body
|
||||||
|
@ -211,8 +211,8 @@ class DiaryEntriesControllerTest < ActionDispatch::IntegrationTest
|
||||||
assert_difference "DiaryEntry.count", 1 do
|
assert_difference "DiaryEntry.count", 1 do
|
||||||
post diary_entries_path(:diary_entry => { :title => spammy_title, :body => spammy_body, :language_code => "en" })
|
post diary_entries_path(:diary_entry => { :title => spammy_title, :body => spammy_body, :language_code => "en" })
|
||||||
end
|
end
|
||||||
assert_redirected_to :action => :index, :display_name => user.display_name
|
|
||||||
entry = DiaryEntry.last
|
entry = DiaryEntry.last
|
||||||
|
assert_redirected_to diary_entry_path(user, entry)
|
||||||
assert_equal user.id, entry.user_id
|
assert_equal user.id, entry.user_id
|
||||||
assert_equal spammy_title, entry.title
|
assert_equal spammy_title, entry.title
|
||||||
assert_equal spammy_body, entry.body
|
assert_equal spammy_body, entry.body
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue