Class: Spree::Admin::GiftCardsController
- Inherits:
-
BaseController
- Object
- BaseController
- Spree::Admin::GiftCardsController
- Defined in:
- app/controllers/spree/admin/gift_cards_controller.rb
Instance Method Summary collapse
- #edit ⇒ Object
- #index ⇒ Object
- #lookup ⇒ Object
- #redeem ⇒ Object
- #send_email ⇒ Object
- #update ⇒ Object
Instance Method Details
#edit ⇒ Object
12 13 |
# File 'app/controllers/spree/admin/gift_cards_controller.rb', line 12 def edit end |
#index ⇒ Object
7 8 9 10 |
# File 'app/controllers/spree/admin/gift_cards_controller.rb', line 7 def index @search = Spree::VirtualGiftCard.purchased.search(params[:q]) @gift_cards = @search.result.page(params[:page]).per(params[:per_page]) end |
#lookup ⇒ Object
15 16 |
# File 'app/controllers/spree/admin/gift_cards_controller.rb', line 15 def lookup end |
#redeem ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/spree/admin/gift_cards_controller.rb', line 28 def redeem if @gift_card.redeem(@user) flash[:success] = Spree.t("admin.gift_cards.redeemed_gift_card") redirect_to admin_user_store_credits_path(@user) else flash[:error] = Spree.t("admin.gift_cards.errors.unable_to_redeem_gift_card") render :lookup end end |
#send_email ⇒ Object
38 39 40 41 |
# File 'app/controllers/spree/admin/gift_cards_controller.rb', line 38 def send_email @gift_card.send_email redirect_to :back end |
#update ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/controllers/spree/admin/gift_cards_controller.rb', line 18 def update if @gift_card.update_attributes(gift_card_params) flash[:success] = Spree.t("admin.gift_cards.gift_card_updated") redirect_to edit_admin_order_path(@order) else flash[:error] = @gift_card.errors..join(", ") redirect_to :back end end |