Sha256: 3a792abb5170b638f8d6f6d39d74b3215bf4a23220017d3c13555b4b05592b30
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module Workarea module Admin class CatalogSwatchesController < Admin::ApplicationController required_permissions :catalog before_action :find_swatches def index end def create @swatch = Catalog::Swatch.new(params[:swatch]) if @swatch.save flash[:success] = t('workarea.admin.catalog_swatches.flash_messages.saved') redirect_to catalog_swatches_path else flash[:error] = @swatch.errors.full_messages render :index end end def update @swatch = Catalog::Swatch.find(params[:id]) if @swatch.update_attributes(params[:swatch]) flash[:success] = t('workarea.admin.catalog_swatches.flash_messages.saved') redirect_to catalog_swatches_path else flash[:error] = t('workarea.admin.catalog_swatches.flash_messages.error') render :index end end def destroy Catalog::Swatch.find(params[:id]).destroy flash[:success] = t('workarea.admin.catalog_swatches.flash_messages.removed') redirect_to catalog_swatches_path end private def find_swatches @swatches = Catalog::Swatch.all @search_settings = Search::Settings.current end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
workarea-swatches-1.0.6 | app/controllers/workarea/admin/catalog_swatches_controller.rb |
workarea-swatches-1.0.5 | app/controllers/workarea/admin/catalog_swatches_controller.rb |