Class: Account::TicketsController

Inherits:
BaseController show all
Defined in:
app/controllers/account/tickets_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

caches_page_with_cache_marker, #raise_not_found!

Instance Method Details

#createObject



30
31
32
33
34
35
# File 'app/controllers/account/tickets_controller.rb', line 30

def create
  @form ||= Account::TicketForm.new(params[:ticket])

  @form.submit if @form.valid?
  respond_with(@form, location: )
end

#create_noteObject



37
38
39
40
41
42
# File 'app/controllers/account/tickets_controller.rb', line 37

def create_note
  @form ||= Account::TicketNoteForm.new(params[:note])
  @form.submit if @form.valid?

  respond_with @form
end

#dataObject



44
45
46
47
# File 'app/controllers/account/tickets_controller.rb', line 44

def data
  @queries = TranslationCms::Api::Customers::SubjectQuery.all!
  @departments = TranslationCms::Api::Customers::Department.all!
end

#indexObject



13
14
15
# File 'app/controllers/account/tickets_controller.rb', line 13

def index
  respond_with @tickets
end

#newObject



26
27
28
# File 'app/controllers/account/tickets_controller.rb', line 26

def new
  @form ||= Account::TicketForm.new(fileupload_guid: SecureRandom.base64(15).tr('+/=', 'xyz'))
end

#showObject



17
18
19
20
21
22
23
24
# File 'app/controllers/account/tickets_controller.rb', line 17

def show
  @ticket = TranslationCms::Api::Customers::Ticket.find(params[:id])
  @ticket = @ticket.first if @ticket.is_a?(Array)
  group_by_ticket
  @notes = TranslationCms::Api::Customers::TicketNote.where(ticket_id: @ticket.id).all
  @form = Account::TicketNoteForm.build(ticket_id: @ticket.id)
  respond_with @ticket
end