<ul class='secondary-actions clearfix'>
<% if params[:action] == 'list' %>
<li><%= link_to t('diary_entry.diary_entry.comment_link'), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %></li>
- <li><%= link_to t('diary_entry.diary_entry.reply_link'), :controller => 'message', :action => 'new', :display_name => diary_entry.user.display_name, :title => "Re: #{diary_entry.title}" %></li>
+ <li><%= link_to t('diary_entry.diary_entry.reply_link'), :controller => 'message', :action => 'new', :display_name => diary_entry.user.display_name, :message => { :title => "Re: #{diary_entry.title}" } %></li>
<li><%= link_to t('diary_entry.diary_entry.comment_count', :count => diary_entry.visible_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %></li>
<% end %>
<%= form_for :message, :html => { :class => 'standard-form' }, :url => { :action => "new", :display_name => @message.recipient.display_name } do |f| %>
<fieldset>
<div class='form-row'>
- <label class="standard-label"><%= t'message.new.subject' %></label>
+ <label class="standard-label" for="message_title"><%= t'message.new.subject' %></label>
<%= f.text_field :title, :size => 60, :class => "richtext_title" %>
</div>
<div class='form-row'>
- <label class="standard-label"><%= t'message.new.body' %></label>
+ <label class="standard-label" for="message_body"><%= t'message.new.body' %></label>
<%= richtext_area :message, :body, :cols => 80, :rows => 20 %>
</div>
<div class='buttons'>
get "/user/:display_name/diary" => "diary_entry#list"
get "/diary/:language" => "diary_entry#list"
get "/diary" => "diary_entry#list"
- get "/user/:display_name/diary/:id" => "diary_entry#view", :id => /\d+/
+ get "/user/:display_name/diary/:id" => "diary_entry#view", :id => /\d+/, :as => :diary_entry
post "/user/:display_name/diary/:id/newcomment" => "diary_entry#comment", :id => /\d+/
match "/user/:display_name/diary/:id/edit" => "diary_entry#edit", :via => [:get, :post], :id => /\d+/
post "/user/:display_name/diary/:id/hide" => "diary_entry#hide", :id => /\d+/, :as => :hide_diary_entry
--- /dev/null
+require "application_system_test_case"
+
+class DiaryEntryTest < ApplicationSystemTestCase
+ def setup
+ create(:language, :code => "en")
+ @diary_entry = create(:diary_entry)
+ end
+
+ test "reply to diary entry should prefill the message subject" do
+ sign_in_as(create(:user))
+ visit diary_path
+
+ click_on "Reply to this entry"
+
+ assert page.has_content? "Send a new message"
+ assert_equal "Re: #{@diary_entry.title}", page.find_field("Subject").value
+ end
+end
end
end
end
+
+ def sign_in_as(user)
+ stub_hostip_requests
+ visit login_path
+ fill_in "username", :with => user.email
+ fill_in "password", :with => "test"
+ click_on "Login", :match => :first
+ end
end
end