Base progress
This commit is contained in:
@@ -17,7 +17,7 @@ module Suppliers
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
render json: JSONAPI::Serializer.serialize(@sections, serializer: Suppliers::ExtendedSectionSerializer, is_collection: true)
|
||||
render json: @sections
|
||||
end
|
||||
|
||||
# GET /sections/1
|
||||
@@ -25,11 +25,7 @@ module Suppliers
|
||||
def show
|
||||
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
@tables = @section.tables_with_active_list_id
|
||||
|
||||
respond_to do |format|
|
||||
format.html { render action: 'tables_view' }# show.html.erb
|
||||
format.json { render json: @section }
|
||||
end
|
||||
render json: @section
|
||||
end
|
||||
|
||||
# GET /sections/new
|
||||
@@ -37,11 +33,7 @@ module Suppliers
|
||||
def new
|
||||
@section = Section.new
|
||||
@section.supplier = current_supplier
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @section }
|
||||
end
|
||||
render json: @section
|
||||
end
|
||||
|
||||
# GET /sections/1/edit
|
||||
@@ -56,7 +48,7 @@ module Suppliers
|
||||
@section.supplier = current_supplier
|
||||
|
||||
if @section.save
|
||||
render json: @section, serializer: Suppliers::SectionSerializer, status: :created
|
||||
render json: @section
|
||||
else
|
||||
render json: {errors: @section.errors}, status: :unprocessable_entity
|
||||
end
|
||||
@@ -68,7 +60,7 @@ module Suppliers
|
||||
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
|
||||
if @section.update_attributes(section_params)
|
||||
head :ok
|
||||
render json: @section
|
||||
else
|
||||
render json: {errors: @section.errors}, status: :unprocessable_entity
|
||||
end
|
||||
@@ -80,7 +72,7 @@ module Suppliers
|
||||
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
|
||||
@section.destroy
|
||||
|
||||
head :ok
|
||||
head :no_content
|
||||
end
|
||||
|
||||
# GET /sections/1/manage_tables
|
||||
|
||||
Reference in New Issue
Block a user