Skip to content

Commit

Permalink
Merge pull request #37 from colorbox/add_frame
Browse files Browse the repository at this point in the history
骨組み作成
  • Loading branch information
colorbox authored Mar 7, 2017
2 parents 6ea8f0c + 087a877 commit 0b9cfd1
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 18 deletions.
3 changes: 3 additions & 0 deletions app/controllers/admin/application_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Admin::ApplicationController < ApplicationController

end
5 changes: 5 additions & 0 deletions app/controllers/admin/order_items_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Admin::OrderItemsController < Admin::ApplicationController
def index
# 注文状況が見れる画面
end
end
5 changes: 5 additions & 0 deletions app/controllers/admin/orders_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class Admin::OrdersController < Admin::ApplicationController
def close
# 発注確定
end
end
38 changes: 24 additions & 14 deletions app/controllers/order_items_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
class OrderItemsController < ApplicationController
before_action :set_order_item, only: %i(show)

def show
# hogehoge
def index
# 予約確認・受取確認
end

def new
Expand All @@ -22,17 +20,29 @@ def create
end
end

private
def edit
# 弁当注文編集画面
end

def set_order_item
@order_item = OrderItem.find(params[:id])
end
def update
# 弁当注文編集
end

def order_item_params
params.require(:order_item).permit(:customer_name)
end
def destroy
# 弁当注文削除
end

def lunchbox_params
params.require(:lunchbox).permit(:id)
end
def receive
# 注文を受け取る
end

private

def order_item_params
params.require(:order_item).permit(:customer_name)
end

def lunchbox_params
params.require(:lunchbox).permit(:id)
end
end
7 changes: 7 additions & 0 deletions app/controllers/orders_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class OrdersController < ApplicationController
def index
# 注文日の一覧(トップページ)
# TODO ここはほんとは all じゃなくて現時点から 2 週間後
@orders = Order.all
end
end
1 change: 1 addition & 0 deletions app/views/admin/order_items/index.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1 注文確認
5 changes: 5 additions & 0 deletions app/views/order_items/edit.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
h1
| Edit Order Item
-# TODO パーシャルで直接インスタンス変数みたくない
= render 'form'
= link_to 'Back', orders_path
1 change: 1 addition & 0 deletions app/views/order_items/index.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
h1 予約確認・注文確認
3 changes: 0 additions & 3 deletions app/views/order_items/show.html.slim

This file was deleted.

5 changes: 5 additions & 0 deletions app/views/orders/index.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
h1
| Orders
- @orders.each do |order|
ul
li= link_to order.date, new_order_order_item_path(order)
13 changes: 12 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
Rails.application.routes.draw do
namespace :admin do
resources :orders, only: %i() do
patch :close
resources :order_items, only: %i(index)
end
end

resources :orders, only: %i(index) do
resources :order_items, only: %i(new create show)
resources :order_items, except: %i(show) do
patch :receive
end
end

root 'orders#index'
end

0 comments on commit 0b9cfd1

Please sign in to comment.