summaryrefslogtreecommitdiff
path: root/engines/support/app/views/tickets/_edit_form.html.haml
blob: 889dac281683da890afa7a4700031c94e15d87dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
:ruby
  # created by user link
  if @ticket.is_creator_validated?
    created_by = link_to @ticket.created_by_user.login, @ticket.created_by_user
  else
    created_by = t(:anonymous)
  end

  # regarding user link
  if admin?
    if @ticket.regarding_user_actual_user
      regarding_user_link = link_to @ticket.regarding_user_actual_user.login, @ticket.regarding_user_actual_user
    else
      regarding_user_link =  "(#{t(:unknown)})"
    end
  else
    regarding_user_link = ''
  end

- url = url_for([@ticket.is_open? ? :close : :open, @ticket])
= simple_form_for @ticket, url: url do |f|
  = hidden_ticket_fields
  %p.first
    - if @ticket.is_open?
      %span.label.label-info
        %b{style: 'padding:10px'}= t("tickets.status.open")
        = f.button :loading, t("tickets.action.close"), class: 'btn-mini'
    - else
      %span.label.label-success
        %b{style: 'padding:10px'}= t("tickets.status.closed")
        = f.button :loading, t("tickets.action.open"), class: 'btn-mini'
    %span.label.label-clear
      = t("tickets.created_by_on", user: created_by, time: @ticket.created_at.to_s(:short), cascade: true).html_safe
= simple_form_for @ticket do |f|
  = hidden_ticket_fields
  = f.input :subject, input_html: {:class => 'large full-width'}
  .row-fluid
    .span4
      = f.input :is_open, as: :select, collection: [:true, :false], include_blank: false
    .span4
      = f.input :email
    .span4
      = f.input :regarding_user, label: Ticket.human_attribute_name(:regarding_user) + regarding_user_link
  = f.button :loading
  - if admin?
    = destroy_btn t(".destroy", cascade: true), auto_ticket_path(@ticket)