Sha256: 422beff15fe000334817ecc269b7785777544eaee28b76f1fdb2c0e69a07b400
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 KB
Contents
class TbCommerce::Admin::OrdersController < Admin::ApplicationController belongs_to_spud_app :orders add_breadcrumb 'Orders', :tb_commerce_admin_orders_path before_action :find_order, :only => [:show, :edit, :update, :ship, :mark_shipped] def index @orders = TbCommerce::Order.order(:created_at => :desc).paginate(:page => params[:page]) if params[:search] @orders = @orders.search(params[:search]) end if params[:tab] @orders = @orders.where(:status => params[:tab]) end render 'index' end def show render 'show' end def edit render 'edit' end def update @order.update_attributes(order_params) respond_with @order end def ship @page_name = 'Ship Order' end def mark_shipped @order.assign_attributes(order_params) @order.status = 'shipped' if @order.save() && params[:send_email] TbCommerce::OrderMailer.order_shipped(@order).deliver_later end respond_with @order end private def find_order @order = TbCommerce::Order.find_by!(:id => params[:id]) add_breadcrumb "##{@order.invoice_number}", tb_commerce_admin_order_path(@order) end def order_params params.require(:tb_commerce_order).permit(:name, :email, :phone, :address, :city, :state, :postal, :country, :tracking_number) end end
Version data entries
3 entries across 3 versions & 1 rubygems