app/controllers/landable/api/templates_controller.rb in landable-1.13.1 vs app/controllers/landable/api/templates_controller.rb in landable-1.13.2
- old
+ new
@@ -1,6 +1,6 @@
-require_dependency "landable/api_controller"
+require_dependency 'landable/api_controller'
module Landable
module Api
class TemplatesController < ApiController
# filters
@@ -8,11 +8,11 @@
# RESTful methods
def create
template = Template.new(template_params)
template.save!
-
+
respond_with template, status: :created, location: template_url(template)
end
def destroy
@template.temp_author = current_author
@@ -29,24 +29,24 @@
respond_with @template
end
def update
@template.update_attributes!(template_params)
-
+
respond_with @template
end
# custom methods
def publish
- @template.publish! author_id: current_author.id, notes: params[:notes], is_minor: !!params[:is_minor]
-
+ @template.publish! author_id: current_author.id, notes: params[:notes], is_minor: !params[:is_minor].nil?
+
respond_with @template
end
def reactivate
@template.try(:reactivate)
-
+
respond_with @template
end
# custom methods
def preview
@@ -67,17 +67,18 @@
end
end
end
private
- def template_params
- params.require(:template).permit(:id, :name, :body, :description, :thumbnail_url,
- :slug, :is_layout, :is_publishable,
- audit_flags: [])
- end
- def load_template
- @template = Template.find(params[:id])
- end
+ def template_params
+ params.require(:template).permit(:id, :name, :body, :description, :thumbnail_url,
+ :slug, :is_layout, :is_publishable,
+ audit_flags: [])
+ end
+
+ def load_template
+ @template = Template.find(params[:id])
+ end
end
end
end