diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin_outgoing_message_controller.rb | 19 | ||||
-rw-r--r-- | app/views/admin_outgoing_message/edit.html.erb | 24 |
2 files changed, 36 insertions, 7 deletions
diff --git a/app/controllers/admin_outgoing_message_controller.rb b/app/controllers/admin_outgoing_message_controller.rb index 3f53838d6..ec0981677 100644 --- a/app/controllers/admin_outgoing_message_controller.rb +++ b/app/controllers/admin_outgoing_message_controller.rb @@ -21,12 +21,23 @@ class AdminOutgoingMessageController < AdminController @outgoing_message = OutgoingMessage.find(params[:id]) old_body = @outgoing_message.body - - if @outgoing_message.update_attributes(params[:outgoing_message]) + old_prominence = @outgoing_message.prominence + old_prominence_reason = @outgoing_message.prominence_reason + @outgoing_message.prominence = params[:outgoing_message][:prominence] + @outgoing_message.prominence_reason = params[:outgoing_message][:prominence_reason] + @outgoing_message.body = params[:outgoing_message][:body] + if @outgoing_message.save @outgoing_message.info_request.log_event("edit_outgoing", - { :outgoing_message_id => @outgoing_message.id, :editor => admin_current_user(), - :old_body => old_body, :body => @outgoing_message.body }) + { :outgoing_message_id => @outgoing_message.id, + :editor => admin_current_user(), + :old_body => old_body, + :body => @outgoing_message.body, + :old_prominence => old_prominence, + :old_prominence_reason => old_prominence_reason, + :prominence => @outgoing_message.prominence, + :prominence_reason => @outgoing_message.prominence_reason }) flash[:notice] = 'Outgoing message successfully updated.' + expire_for_request(@outgoing_message.info_request) redirect_to admin_request_show_url(@outgoing_message.info_request) else render :action => 'edit' diff --git a/app/views/admin_outgoing_message/edit.html.erb b/app/views/admin_outgoing_message/edit.html.erb index b52884bae..d40ea03ef 100644 --- a/app/views/admin_outgoing_message/edit.html.erb +++ b/app/views/admin_outgoing_message/edit.html.erb @@ -3,9 +3,25 @@ <%= error_messages_for 'outgoing_message' %> <%= form_tag admin_outgoing_update_path(@outgoing_message) do %> + <div class="control-group"> + <label class="control-label" for="outgoing_message_prominence"> Prominence</label> + <div class="controls"> + <%= select('outgoing_message', "prominence", OutgoingMessage.prominence_states) %> + </div> + </div> + + <div class="control-group"> + <label class="control-label" for="outgoing_message_prominence_reason">Reason for prominence</label> + <div class="controls"> + <%= text_area "outgoing_message", "prominence_reason", :rows => 5, :class => "span6" %> + </div> + </div> - <p><label for="outgoing_message_body">Body of message</label><br/> - <%= text_area 'outgoing_message', 'body', :rows => 10, :cols => 60 %></p> + <div class="control-group"> + <label class="control-label" for="outgoing_message_body">Body of message</label> + <div class="controls"> + <%= text_area 'outgoing_message', 'body', :rows => 10, :cols => 60 %> + </div> <p><strong>Note:</strong> This is mainly to be used to excise information that users inadvertently put in their messages, not realising it would be @@ -14,7 +30,9 @@ this site. You could also use this to edit a message before resending it, but only the edited version will be shown on the public page if you do that.</p> - <p><%= submit_tag 'Save', :accesskey => 's' %></p> +<div class="form-actions" > +<%= submit_tag 'Save', :accesskey => 's', :class => 'btn' %> +</div> <% end %> <p> |