journalduhacker/app/views/stories/edit.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

50 lines
1.4 KiB
Plaintext

<div class="box" id="story_box">
<div class="legend">
Edit Story
</div>
<%= form_for @story, :url => story_path(@story.short_id),
:method => :put, :html => { :id => "edit_story" } do |f| %>
<%= render :partial => "stories/form", :locals => { :story => @story,
:f => f } %>
<% if @user.is_moderator? %>
<div class="box">
<div class="boxline">
<%= f.label :merge_story_short_id, "Merge Into:",
:class => "required" %>
<%= f.text_field :merge_story_short_id, :autocomplete => "off",
:placeholder => "Short id of story into which this story " <<
"be merged" %>
</div>
<% if @story.user_id != @user.id %>
<div class="boxline">
<%= f.label :moderation_reason, "Mod Reason:",
:class => "required" %>
<%= f.text_field :moderation_reason, :autocomplete => "off" %>
</div>
<% end %>
</div>
<% end %>
<p></p>
<div class="box">
<div class="boxline markdown_help_toggler">
<div class="markdown_help_label">
Markdown formatting available
</div>
<%= submit_tag "Save" %>
&nbsp;or <a href="<%= story_path(@story.short_id) %>">cancel
editing</a>
<div style="clear: both;"></div>
<%= render :partial => "global/markdownhelp",
:locals => { :allow_images => true } %>
</div>
</div>
<% end %>
</div>