Class: RiddlerAdmin::PreviewContextsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/riddler_admin/preview_contexts_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#riddler_current_user, #riddler_user_can_approve?, #riddler_user_can_deploy?

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/riddler_admin/preview_contexts_controller.rb', line 18

def create
  @preview_context = PreviewContext.new preview_context_params

  if @preview_context.save
    @preview_context.refresh_data input_headers: request.headers.to_h

    redirect_to @preview_context, notice: "Preview context was successfully created."
  else
    render :new
  end
end

#destroyObject



43
44
45
46
# File 'app/controllers/riddler_admin/preview_contexts_controller.rb', line 43

def destroy
  @preview_context.destroy
  redirect_to preview_contexts_url, notice: "Preview context was successfully destroyed."
end

#editObject



30
31
# File 'app/controllers/riddler_admin/preview_contexts_controller.rb', line 30

def edit
end

#indexObject



7
8
9
# File 'app/controllers/riddler_admin/preview_contexts_controller.rb', line 7

def index
  @preview_contexts = PreviewContext.all
end

#newObject



14
15
16
# File 'app/controllers/riddler_admin/preview_contexts_controller.rb', line 14

def new
  @preview_context = PreviewContext.new
end

#showObject



11
12
# File 'app/controllers/riddler_admin/preview_contexts_controller.rb', line 11

def show
end

#updateObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/riddler_admin/preview_contexts_controller.rb', line 33

def update
  if @preview_context.update preview_context_params
    @preview_context.refresh_data input_headers: request.headers.to_h

    redirect_to @preview_context, notice: "Preview context was successfully updated."
  else
    render :edit
  end
end