Class: Helpdesk::Admin::TicketTypesController

Inherits:
BaseController show all
Defined in:
app/controllers/helpdesk/admin/ticket_types_controller.rb

Instance Method Summary collapse

Methods inherited from Helpdesk::ApplicationController

#default_url_options, #ensure_user

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
# File 'app/controllers/helpdesk/admin/ticket_types_controller.rb', line 19

def create
  @ticket_type = Helpdesk::TicketType.new(ticket_type_params)
  if @ticket_type.save
    redirect_to admin_ticket_types_url, notice: 'Ticket type was successfully created.'
  else
    render action: "new"
  end
end

#destroyObject



37
38
39
40
41
42
43
44
45
# File 'app/controllers/helpdesk/admin/ticket_types_controller.rb', line 37

def destroy
  @ticket_type = Helpdesk::TicketType.find(params[:id])
  @ticket_type.destroy

  respond_to do |format|
    format.html { redirect_to admin_ticket_types_url }
    format.json { head :no_content }
  end
end

#editObject



15
16
17
# File 'app/controllers/helpdesk/admin/ticket_types_controller.rb', line 15

def edit
  @ticket_type = Helpdesk::TicketType.find(params[:id])
end

#indexObject



3
4
5
# File 'app/controllers/helpdesk/admin/ticket_types_controller.rb', line 3

def index
  @ticket_types = Helpdesk::TicketType.all
end

#newObject



11
12
13
# File 'app/controllers/helpdesk/admin/ticket_types_controller.rb', line 11

def new
  @ticket_type = Helpdesk::TicketType.new
end

#showObject



7
8
9
# File 'app/controllers/helpdesk/admin/ticket_types_controller.rb', line 7

def show
  @ticket_type = Helpdesk::TicketType.find(params[:id])
end

#updateObject



28
29
30
31
32
33
34
35
# File 'app/controllers/helpdesk/admin/ticket_types_controller.rb', line 28

def update
  @ticket_type = Helpdesk::TicketType.find(params[:id])
  if @ticket_type.update_attributes(ticket_type_params)
    redirect_to admin_ticket_types_url, notice: 'Ticket type was successfully updated.'
  else
    render action: "edit"
  end
end