journalduhacker/app/views/messages/show.html.erb
joshua stein 9f5e04bbba use _path for most things instead of _url
Instead of hard-coding the scheme and host everywhere, use _path
methods to show relative URLs.

Except that our previous setting of
Rails.application.routes.default_url_options in
config.after_initialize made this moot because Rails inserts that
host into all _path helpers for some reason.  So revert that
setting.

But then anything that wants an absolute URL doesn't know the
hostname and the root_url helper throws an exception.  So make a
Rails.application.root_url shortcut to pass the per-app settings in
Rails.application to root_url.

Now we can just use _path helpers most places but still use _url
ones where we need them, such as in RSS views and e-mail templates.
2015-01-02 17:02:55 -06:00

78 lines
1.9 KiB
Plaintext

<div class="box wide">
<div class="legend" style="float: right;">
<% if @message.author_user_id == @user.id %>
<a href="/messages/sent">Back to Sent Messages</a>
<% else %>
<a href="/messages">Back to Messages</a>
<% end %>
</div>
<div class="legend">
<%= @message.subject %>
<div class="sublegend">
Sent from <a href="/u/<%= @message.author.username %>"><%=
@message.author.username %></a>
<% if @message.author.is_admin? %>
(administrator)
<% elsif @message.author.is_moderator? %>
(moderator)
<% end %>
to
<a href="/u/<%= @message.recipient.username %>"><%=
@message.recipient.username %></a>
<%= raw(time_ago_in_words_label(@message.created_at)) %> ago
</div>
</div>
<div class="boxline comment_text">
<%= raw @message.linkified_body %>
</div>
<br>
<div class="boxline">
<div style="float: left;">
<%= form_tag message_path(@message.short_id), :method => :delete do %>
<%= submit_tag "Delete Message" %>
<% end %>
</div>
<div style="float: left; padding-left: 1em;">
<%= form_tag message_path(@message.short_id) + "/keep_as_new",
:method => :post do %>
<%= submit_tag "Keep As New" %>
<% end %>
</div>
</div>
<div style="clear: both;"></div>
<br>
<div class="legend">
Compose Reply To <%= @new_message.recipient_username %>
</div>
<%= form_for @new_message, :method => :post do |f| %>
<%= f.hidden_field :recipient_username %>
<%= error_messages_for @new_message %>
<div class="boxline">
<%= f.text_field :subject, :style => "width: 500px;",
:autocomplete => "off" %>
</div>
<div class="boxline">
<%= f.text_area :body, :style => "width: 500px;", :rows => 5,
:autocomplete => "off" %>
</div>
<div class="boxline">
<p></p>
<%= submit_tag "Send Message" %>
</div>
<% end %>
</div>