From 3cda12b8dda4ab6572200bfb1f1f022c31244a27 Mon Sep 17 00:00:00 2001 From: Will Marshall Date: Thu, 5 Dec 2013 16:31:12 +1100 Subject: [PATCH] Refactoring the order cycle partials --- app/views/shop/_last_order_cycle.html.haml | 4 ++++ app/views/shop/_next_order_cycle.html.haml | 3 +++ app/views/shop/_order_cycles.html.haml | 10 ++++++++++ 3 files changed, 17 insertions(+) create mode 100644 app/views/shop/_last_order_cycle.html.haml create mode 100644 app/views/shop/_next_order_cycle.html.haml create mode 100644 app/views/shop/_order_cycles.html.haml diff --git a/app/views/shop/_last_order_cycle.html.haml b/app/views/shop/_last_order_cycle.html.haml new file mode 100644 index 0000000000..353529e60a --- /dev/null +++ b/app/views/shop/_last_order_cycle.html.haml @@ -0,0 +1,4 @@ +- if most_recently_closed = OrderCycle.most_recently_closed_for(@distributor) + The last cycle closed + = distance_of_time_in_words_to_now most_recently_closed.orders_close_at + ago diff --git a/app/views/shop/_next_order_cycle.html.haml b/app/views/shop/_next_order_cycle.html.haml new file mode 100644 index 0000000000..f4b3e5172f --- /dev/null +++ b/app/views/shop/_next_order_cycle.html.haml @@ -0,0 +1,3 @@ +- if next_oc = OrderCycle.first_opening_for(@distributor) + The next cycle opens in + = distance_of_time_in_words_to_now next_oc.orders_open_at diff --git a/app/views/shop/_order_cycles.html.haml b/app/views/shop/_order_cycles.html.haml new file mode 100644 index 0000000000..21c4af6825 --- /dev/null +++ b/app/views/shop/_order_cycles.html.haml @@ -0,0 +1,10 @@ +- if @order_cycles.empty? + Orders are currently closed for this hub + %p Please contact your hub directly to see if they accept late orders, or wait until the next cycle opens. + + = render partial: "shop/next_order_cycle" + = render partial: "shop/last_order_cycle" + +- else + Ready for: + = select_tag :order_cycle_id, options_for_select(order_cycles_name_and_pickup_times(@order_cycles), current_order_cycle.andand.id), :prompt => "Select an Order Cycle!"