Qwaiter in the green 💚

This commit is contained in:
2013-12-22 15:20:14 +01:00
parent 76c2d4ddbc
commit 69132b0c07
20 changed files with 150 additions and 935 deletions
+20 -16
View File
@@ -6,46 +6,46 @@ module Admin
# GET /lists.json
def index
@lists = List.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @lists }
end
end
# GET /lists/1
# GET /lists/1.json
def show
@list = List.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @list }
end
end
# GET /lists/new
# GET /lists/new.json
def new
@list = List.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @list }
end
end
# GET /lists/1/edit
def edit
@list = List.find(params[:id])
end
# POST /lists
# POST /lists.json
def create
@list = List.new(params[:list])
@list = List.new(list_params)
@list.supplier_id = params[:list][:supplier_id]
respond_to do |format|
if @list.save
format.html { redirect_to [:admin, @list], notice: t('action.create.successfull', model: List.model_name.human) }
@@ -56,14 +56,14 @@ module Admin
end
end
end
# PUT /lists/1
# PUT /lists/1.json
def update
@list = List.find(params[:id])
respond_to do |format|
if @list.update_attributes(params[:list])
if @list.update_attributes(list_params)
format.html { redirect_to [:admin, @list], notice: t('action.update.successfull', model: List.model_name.human) }
format.json { head :no_content }
else
@@ -72,24 +72,28 @@ module Admin
end
end
end
# DELETE /lists/1
# DELETE /lists/1.json
def destroy
@list = List.find(params[:id])
@list.destroy
respond_to do |format|
format.html { redirect_to admin_lists_path, notice: t('action.destroy.successfull', model: List.model_name.human) }
format.json { head :no_content }
end
end
private
def set_relation_options
@tables = Table.all
@suppliers = Supplier.all
end
def list_params
params.require(:list).permit!
end
end
end