Skip to content
This repository has been archived by the owner on Dec 22, 2018. It is now read-only.

Commit

Permalink
moved signature to body
Browse files Browse the repository at this point in the history
  • Loading branch information
basschoen committed Aug 8, 2014
1 parent 5fe0086 commit afa20bc
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
8 changes: 2 additions & 6 deletions app/controllers/replies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,8 @@ def create
authorize! :create, @reply

if @reply.save && @reply.notify do |reply|
if current_user.agent?
TicketMailer.reply(reply)
else
TicketMailer.notify_agents(reply.ticket, reply)
end
end
NotificationMailer.new_reply(current_user, reply)
end
redirect_to @reply.ticket, notice: I18n::translate(:reply_added)
else
render action: 'new'
Expand Down
14 changes: 11 additions & 3 deletions app/controllers/tickets_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def allow_cors
def show
@agents = User.agents

@reply = @ticket.replies.new
@reply = @ticket.replies.new content: '<br /><br />' + current_user.signature.to_s
@reply.to = @ticket.user.email

@labeling = Labeling.new(labelable: @ticket)
Expand Down Expand Up @@ -107,8 +107,16 @@ def update
end

def new
unless current_user.blank?
signature = { content: '<br /><br />' + current_user.signature.to_s }
else
signature = {}
end

unless params[:ticket].nil? # prefill params given?
@ticket = Ticket.new(ticket_params)
@ticket = Ticket.new(signature.merge(ticket_params))
else
@ticket = Ticket.new(signature)
end

unless current_user.nil?
Expand All @@ -122,7 +130,7 @@ def create
@ticket = Ticket.new(ticket_params)

if @ticket.save
TicketMailer.notify_agents(@ticket, @ticket).deliver
NotificationMailer.new_ticket(current_user, @ticket).deliver

if current_user.nil?
return render text: I18n::translate(:ticket_added)
Expand Down
2 changes: 0 additions & 2 deletions app/models/reply.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class Reply < ActiveRecord::Base
}

def notify
self.content += '<br /><br />' + self.user.signature.to_s

mail = yield(self)

mail.deliver
Expand Down
1 change: 0 additions & 1 deletion app/views/replies/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<% end %>
<%= r.text_area :content, label: false, class: 'tinymce' %>
<%= current_user.signature.to_s.html_safe %>
<%= label_tag 'attachment[]', t(:attach_files) %>
<%= file_field_tag 'attachment[]', multiple: true, label: false %>
Expand Down
1 change: 0 additions & 1 deletion app/views/tickets/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<%= f.text_field :subject %>
<%= f.text_area :content, class: 'tinymce' %>
<%= current_user.signature.to_s.html_safe unless current_user.nil? %>

</div>
<p>
Expand Down

0 comments on commit afa20bc

Please sign in to comment.