Refactor message creation to use a create action

This makes it more conventional, rather than handling posts to the new action. The posting of the form was also reworked to use a hidden field for the displayname, rather than in the url, again for convention.
This commit is contained in:
Andy Allan 2018-08-29 14:18:20 +08:00
parent 06915a77b5
commit f38e03f0ed
5 changed files with 40 additions and 33 deletions

View file

@ -4,7 +4,8 @@
<%= error_messages_for 'message' %>
<%= form_for :message, :html => { :class => 'standard-form' }, :url => new_message_path(@message.recipient) do |f| %>
<%= form_for @message, :html => { :class => 'standard-form' } do |f| %>
<%= hidden_field_tag :display_name, @message.recipient.display_name %>
<fieldset>
<div class='form-row'>
<label class="standard-label" for="message_title"><%= t '.subject' %></label>