Qwaiter in the green 💚
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -6,45 +6,45 @@ module Admin
|
||||
# GET /orders.json
|
||||
def index
|
||||
@orders = Order.all
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @orders }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /orders/1
|
||||
# GET /orders/1.json
|
||||
def show
|
||||
@order = Order.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @order }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /orders/new
|
||||
# GET /orders/new.json
|
||||
def new
|
||||
@order = Order.new
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @order }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /orders/1/edit
|
||||
def edit
|
||||
@order = Order.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
# POST /orders
|
||||
# POST /orders.json
|
||||
def create
|
||||
@order = Order.new(params[:order])
|
||||
|
||||
@order = Order.new(order_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @order.save
|
||||
format.html { redirect_to [:admin, @order], notice: t('action.create.successfull', model: Order.model_name.human) }
|
||||
@@ -55,14 +55,14 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# PUT /orders/1
|
||||
# PUT /orders/1.json
|
||||
def update
|
||||
@order = Order.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @order.update_attributes(params[:order])
|
||||
if @order.update_attributes(order_params)
|
||||
format.html { redirect_to [:admin, @order], notice: t('action.update.successfull', model: Order.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@@ -71,24 +71,28 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# DELETE /orders/1
|
||||
# DELETE /orders/1.json
|
||||
def destroy
|
||||
@order = Order.find(params[:id])
|
||||
@order.destroy
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to admin_orders_url, notice: t('action.destroy.successfull', model: Order.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def set_relation_options
|
||||
@lists = List.all
|
||||
@suppliers = Supplier.all
|
||||
end
|
||||
|
||||
def order_params
|
||||
params.require(:order).permit!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,46 +6,46 @@ module Admin
|
||||
# GET /product_categories.json
|
||||
def index
|
||||
@product_categories = ProductCategory.all
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @product_categories }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /product_categories/1
|
||||
# GET /product_categories/1.json
|
||||
def show
|
||||
@product_category = ProductCategory.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @product_category }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /product_categories/new
|
||||
# GET /product_categories/new.json
|
||||
def new
|
||||
@product_category = ProductCategory.new
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @product_category }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /product_categories/1/edit
|
||||
def edit
|
||||
@product_category = ProductCategory.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
# POST /product_categories
|
||||
# POST /product_categories.json
|
||||
def create
|
||||
@product_category = ProductCategory.new(params[:product_category])
|
||||
@product_category = ProductCategory.new(product_category_params)
|
||||
@product_category.supplier_id = params[:product_category][:supplier_id]
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @product_category.save
|
||||
format.html { redirect_to [:admin, @product_category], notice: t('action.create.successfull', model: ProductCategory.model_name.human) }
|
||||
@@ -56,14 +56,14 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# PUT /product_categories/1
|
||||
# PUT /product_categories/1.json
|
||||
def update
|
||||
@product_category = ProductCategory.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @product_category.update_attributes(params[:product_category])
|
||||
if @product_category.update_attributes(product_category_params)
|
||||
format.html { redirect_to [:admin, @product_category], notice: t('action.update.successfull', model: ProductCategory.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@@ -72,19 +72,19 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# DELETE /product_categories/1
|
||||
# DELETE /product_categories/1.json
|
||||
def destroy
|
||||
@product_category = ProductCategory.find(params[:id])
|
||||
@product_category.destroy
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to admin_product_categories_path, notice: t('action.destroy.successfull', model: ProductCategory.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /product_categories/qrcode
|
||||
# GET /product_categories/qrcode.png
|
||||
# GET /product_categories/qrcode.svg
|
||||
@@ -95,12 +95,16 @@ module Admin
|
||||
format.png { render qrcode: request.url }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def set_relation_options
|
||||
@suppliers = Supplier.all
|
||||
@lists = List.all
|
||||
end
|
||||
|
||||
def product_category_params
|
||||
params.require(:product_category).permit!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,46 +6,46 @@ module Admin
|
||||
# GET /products.json
|
||||
def index
|
||||
@products = Product.all
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @products }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /products/1
|
||||
# GET /products/1.json
|
||||
def show
|
||||
@product = Product.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @product }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /products/new
|
||||
# GET /products/new.json
|
||||
def new
|
||||
@product = Product.new
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @product }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /products/1/edit
|
||||
def edit
|
||||
@product = Product.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
# POST /products
|
||||
# POST /products.json
|
||||
def create
|
||||
@product = Product.new(params[:product])
|
||||
@product = Product.new(product_params)
|
||||
@product.supplier_id = params[:product][:supplier_id]
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @product.save
|
||||
format.html { redirect_to [:admin, @product], notice: t('action.create.successfull', model: Product.model_name.human) }
|
||||
@@ -56,14 +56,14 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# PUT /products/1
|
||||
# PUT /products/1.json
|
||||
def update
|
||||
@product = Product.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @product.update_attributes(params[:product])
|
||||
if @product.update_attributes(product_params)
|
||||
format.html { redirect_to [:admin, @product], notice: t('action.update.successfull', model: Product.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@@ -72,24 +72,28 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# DELETE /products/1
|
||||
# DELETE /products/1.json
|
||||
def destroy
|
||||
@product = Product.find(params[:id])
|
||||
@product.destroy
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to admin_products_path, notice: t('action.destroy.successfull', model: Product.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def set_relation_options
|
||||
@suppliers = Supplier.all
|
||||
@product_categories = ProductCategory.all
|
||||
end
|
||||
|
||||
def product_params
|
||||
params.require(:product).permit!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,46 +6,46 @@ module Admin
|
||||
# GET /sections.json
|
||||
def index
|
||||
@sections = Section.all
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @sections }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /sections/1
|
||||
# GET /sections/1.json
|
||||
def show
|
||||
@section = Section.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @section }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /sections/new
|
||||
# GET /sections/new.json
|
||||
def new
|
||||
@section = Section.new
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @section }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /sections/1/edit
|
||||
def edit
|
||||
@section = Section.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
# POST /sections
|
||||
# POST /sections.json
|
||||
def create
|
||||
@section = Section.new(params[:section])
|
||||
@section = Section.new(section_params)
|
||||
@section.supplier_id = params[:section][:supplier_id]
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @section.save
|
||||
format.html { redirect_to [:admin, @section], notice: t('action.create.successfull', model: Section.model_name.human) }
|
||||
@@ -56,14 +56,14 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# PUT /sections/1
|
||||
# PUT /sections/1.json
|
||||
def update
|
||||
@section = Section.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @section.update_attributes(params[:section])
|
||||
if @section.update_attributes(section_params)
|
||||
format.html { redirect_to [:admin, @section], notice: t('action.update.successfull', model: Section.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@@ -72,23 +72,27 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# DELETE /sections/1
|
||||
# DELETE /sections/1.json
|
||||
def destroy
|
||||
@section = Section.find(params[:id])
|
||||
@section.destroy
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to admin_sections_path, notice: t('action.destroy.successfull', model: Section.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def set_relation_options
|
||||
@suppliers = Supplier.all
|
||||
end
|
||||
|
||||
def section_params
|
||||
params.require(:section).permit!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,7 +42,7 @@ module Admin
|
||||
# POST /suppliers
|
||||
# POST /suppliers.json
|
||||
def create
|
||||
@supplier = Supplier.new(params[:supplier])
|
||||
@supplier = Supplier.new(supplier_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @supplier.save
|
||||
@@ -61,7 +61,7 @@ module Admin
|
||||
@supplier = Supplier.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @supplier.update_attributes(params[:supplier])
|
||||
if @supplier.update_attributes(supplier_params)
|
||||
format.html { redirect_to [:admin, @supplier], notice: t('action.update.successfull', model: Supplier.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@@ -89,5 +89,9 @@ module Admin
|
||||
@suppliers = Supplier.all
|
||||
@lists = List.all
|
||||
end
|
||||
|
||||
def supplier_params
|
||||
params.require(:supplier).permit!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -6,46 +6,46 @@ module Admin
|
||||
# GET /tables.json
|
||||
def index
|
||||
@tables = Table.all
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @tables }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /tables/1
|
||||
# GET /tables/1.json
|
||||
def show
|
||||
@table = Table.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json { render json: @table }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /tables/new
|
||||
# GET /tables/new.json
|
||||
def new
|
||||
@table = Table.new
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # new.html.erb
|
||||
format.json { render json: @table }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# GET /tables/1/edit
|
||||
def edit
|
||||
@table = Table.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
# POST /tables
|
||||
# POST /tables.json
|
||||
def create
|
||||
@table = Table.new(params[:table])
|
||||
@table = Table.new(table_params)
|
||||
@table.supplier_id = params[:table][:supplier_id]
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @table.save
|
||||
format.html { redirect_to [:admin, @table], notice: t('action.create.successfull', model: Table.model_name.human) }
|
||||
@@ -56,14 +56,14 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# PUT /tables/1
|
||||
# PUT /tables/1.json
|
||||
def update
|
||||
@table = Table.find(params[:id])
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
if @table.update_attributes(params[:table])
|
||||
if @table.update_attributes(table_params)
|
||||
format.html { redirect_to [:admin, @table], notice: t('action.update.successfull', model: Table.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@@ -72,24 +72,28 @@ module Admin
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# DELETE /tables/1
|
||||
# DELETE /tables/1.json
|
||||
def destroy
|
||||
@table = Table.find(params[:id])
|
||||
@table.destroy
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html { redirect_to admin_tables_url, notice: t('action.destroy.successfull', model: Table.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
|
||||
def set_relation_options
|
||||
@suppliers = Supplier.all
|
||||
@lists = List.all
|
||||
end
|
||||
|
||||
def table_params
|
||||
params.require(:table).permit!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,7 +53,7 @@ module Admin
|
||||
# POST /users
|
||||
# POST /users.json
|
||||
def create
|
||||
@user = User.new(params[:user])
|
||||
@user = User.new(user_params)
|
||||
|
||||
respond_to do |format|
|
||||
if @user.save
|
||||
@@ -72,7 +72,7 @@ module Admin
|
||||
@user = User.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @user.update_attributes(params[:user])
|
||||
if @user.update_attributes(user_params)
|
||||
format.html { redirect_to [:admin, @user], notice: t('action.update.successfull', model: User.model_name.human) }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
@@ -93,5 +93,11 @@ module Admin
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,6 +16,7 @@ module Suppliers
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
respond_to do |format|
|
||||
format.html # index.html.erb
|
||||
format.json { render json: @sections }
|
||||
|
||||
Reference in New Issue
Block a user