Sha256: 49ee0c6f5116ded20e16cc230240b394407d7f04108e92c881db9a8bc181885e
Contents?: true
Size: 1.91 KB
Versions: 2
Compression:
Stored size: 1.91 KB
Contents
module Spree module Admin class AccountsController < ResourceController def index end def show @bling_account = SolidusBling::Account.find(params[:id]) end def new @bling_account = SolidusBling::Account.new @payment_methods = ::Spree::PaymentMethod.all.pluck(:name, :id) @shipping_methods = ::Spree::ShippingMethod.all.pluck(:name, :id) @bling_account.payment_methods.build @bling_account.shipping_methods.build @bling_account.sellers.build end def create bling_account = SolidusBling::Account.create account_params.merge(name: "Bling") redirect_to admin_accounts_path end def edit @bling_account = SolidusBling::Account.find(params[:id]) @payment_methods = ::Spree::PaymentMethod.all.pluck(:name, :id) @shipping_methods = ::Spree::ShippingMethod.all.pluck(:name, :id) @products_count = @bling_account.products.count @last_update = SolidusBling::Event.where(method: "products_updated").max.created_at.strftime("%d/%m/%Y %H:%M") end def update bling_account = SolidusBling::Account.find(params[:id]) bling_account.update account_params redirect_to edit_admin_account_path(bling_account.id) end def delete bling_account = SolidusBling::Account.find(params[:id]) bling_account.delete redirect_to admin_accounts_path end private def model_class SolidusBling::Account end def account_params params.require(:account).permit(:app_name, :client_id, :client_secret, :refresh_token, :api_base_url, :external_store_id, :incoming_category_id, payment_methods_attributes: [:id, :spree_payment_method_id, :external_id], shipping_methods_attributes: [:id, :spree_shipping_method_id, :alias], sellers_attributes: [:id, :name, :external_id]) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
solidus_bling-2.0.4 | app/controllers/spree/admin/accounts_controller.rb |
solidus_bling-2.0.3 | app/controllers/spree/admin/accounts_controller.rb |