<% if @ticket.nil? %>
<% @ticket = Ticket.find_by_id(@ticket_responce.ticket_id) %>
<% end %>
<% if @ticket.contact.id == current_user.contact_id || current_user.admin_id < 3 %>
<%=h @ticket.title %>
Ticket Holder:
<%=h @ticket.contact.firstname %> <%=h @ticket.contact.lastname %>
Number:
<%=h @ticket.number %>
Issue:
<%= @ticket.issue -%>
<% @ticket.ticket_responces.each do |ticketresponce| %>
<%= ticketresponce.body.html_safe %>
<%= ticketresponce.contact.firstname %> <%= ticketresponce.contact.lastname %>
<% unless current_user.admin_id == 3 %>
<%= link_to 'Edit', edit_ticket_responce_path(ticketresponce) %>
<%= button_to 'Destroy', ticketresponce, :confirm => 'Are you sure?', :method => :delete %>
<% end %>
<% end %>
<%= semantic_form_for [@ticket, TicketResponce.new] do |f| %>
<%= error_messages_for :ticket_responce %>
<%= f.inputs do %>
<%= f.inline_errors_for 'ticket_responce.body' -%>
<%= f.input :ticket_id, :as => :hidden, :value => @ticket.id %>
<%= f.errors_on :body -%>
<%= f.input :body, :label => 'Your responce', :input_html => { :class => :mceEditor } %>
<%= f.input :contact_id, :as => :hidden, :value => current_user.contact_id %>
<% end %>
<%= f.buttons %>
<% end %>
<% end %>
<% unless current_user.admin_id == 3 %>
<%= link_to 'Edit', edit_ticket_path(@ticket) %> |
<%= link_to 'Back', tickets_path %>
<% end %>