Class: Landable::Api::TemplatesController
Constant Summary
Landable::ApiController::API_MEDIA_REGEX
Instance Method Summary
collapse
#api_media
Instance Method Details
#create ⇒ Object
10
11
12
13
14
15
|
# File 'app/controllers/landable/api/templates_controller.rb', line 10
def create
template = Template.new(template_params)
template.save!
respond_with template, status: :created, location: template_url(template)
end
|
#destroy ⇒ Object
17
18
19
20
21
22
|
# File 'app/controllers/landable/api/templates_controller.rb', line 17
def destroy
@template.temp_author = current_author
@template.try(:deactivate)
respond_with @template
end
|
#index ⇒ Object
24
25
26
|
# File 'app/controllers/landable/api/templates_controller.rb', line 24
def index
respond_with Template.all
end
|
#publish ⇒ Object
39
40
41
42
43
|
# File 'app/controllers/landable/api/templates_controller.rb', line 39
def publish
@template.publish! author_id: current_author.id, notes: params[:notes], is_minor: !!params[:is_minor]
respond_with @template
end
|
#reactivate ⇒ Object
45
46
47
48
49
|
# File 'app/controllers/landable/api/templates_controller.rb', line 45
def reactivate
@template.try(:reactivate)
respond_with @template
end
|
#show ⇒ Object
28
29
30
|
# File 'app/controllers/landable/api/templates_controller.rb', line 28
def show
respond_with @template
end
|
#update ⇒ Object
32
33
34
35
36
|
# File 'app/controllers/landable/api/templates_controller.rb', line 32
def update
@template.update_attributes!(template_params)
respond_with @template
end
|