Class: Pulitzer::StylesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pulitzer/styles_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



14
15
16
17
18
19
20
21
# File 'app/controllers/pulitzer/styles_controller.rb', line 14

def create
  @style = Pulitzer::Style.create(style_params)
  if @style.errors.empty?
    render partial: 'show_wrapper', locals: { style: @style }
  else
    render partial: 'new', locals: { style: @style }
  end
end

#destroyObject



27
28
29
30
# File 'app/controllers/pulitzer/styles_controller.rb', line 27

def destroy
  @style.destroy
  head :ok and return
end

#indexObject



4
5
6
7
# File 'app/controllers/pulitzer/styles_controller.rb', line 4

def index
  @ptcet = Pulitzer::PostTypeContentElementType.find(params[:post_type_content_element_type_id])
  render partial: 'index', locals: { ptcet: @ptcet }
end

#newObject



9
10
11
12
# File 'app/controllers/pulitzer/styles_controller.rb', line 9

def new
  @style = Pulitzer::Style.new(style_params)
  render partial: 'new', locals: { ptcet: @ptcet, style: @style }
end

#showObject



23
24
25
# File 'app/controllers/pulitzer/styles_controller.rb', line 23

def show
  render partial: 'show', locals: { style: @style }
end