Sha256: 149e2657e6e0061527d1be39261712a356907b8b0d250c50527c16944fe6718c

Contents?: true

Size: 1.3 KB

Versions: 62

Compression:

Stored size: 1.3 KB

Contents

module Workarea
  module Admin
    class TaxCategoriesController < Admin::ApplicationController
      required_permissions :settings
      before_action :find_category, except: :index

      def index
        @categories = Tax::Category.all
      end

      def show
      end

      def new; end

      def edit; end

      def create
        if @category.save
          flash[:success] = t('workarea.admin.tax_categories.flash_messages.created')
          redirect_to tax_category_path(@category)
        else
          render :new
        end
      end

      def update
        if @category.update_attributes(params[:category])
          flash[:success] = t('workarea.admin.tax_categories.flash_messages.saved')
          redirect_to tax_category_path(@category)
        else
          render :edit
        end
      end

      def destroy
        @category.destroy
        flash[:success] = t('workarea.admin.tax_categories.flash_messages.removed')
        redirect_to tax_categories_path
      end

      private

      def find_category
        model = if params[:id].present?
                  Tax::Category.find(params[:id])
                else
                  Tax::Category.new(params[:category])
                end

        @category = TaxCategoryViewModel.wrap(model, view_model_options)
      end
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.27 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.5.4 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.26 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.5.3 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.25 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.5.2 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.24 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.5.1 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.23 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.22 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.5.0 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.21 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.5.0.beta.1 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.20 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.19 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.18 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.17 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.16 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.15 app/controllers/workarea/admin/tax_categories_controller.rb
workarea-admin-3.4.14 app/controllers/workarea/admin/tax_categories_controller.rb