Class: Workarea::Admin::CreateCatalogCategoriesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/admin/create_catalog_categories_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model

Methods included from Publishing

#allow_publishing!, #allow_publishing?, #set_publishing_options

Methods included from Visiting

#most_visited

Instance Method Details

#contentObject



52
53
54
55
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 52

def content
  model = Content.for(@category.model)
  @content = ContentViewModel.new(model, view_model_options)
end

#createObject



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 18

def create
  @category.attributes = params[:category]

  if @category.save
    flash[:success] = t('workarea.admin.create_catalog_categories.flash_messages.saved')
    redirect_to products_create_catalog_category_path(@category)
  else
    render :setup, status: :unprocessable_entity
  end
end

#editObject



29
30
31
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 29

def edit
  render :setup
end

#edit_ruleObject



48
49
50
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 48

def edit_rule
  render :rules
end


36
37
38
39
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 36

def featured_products
  search = Search::AdminProducts.new(view_model_options)
  @search = SearchViewModel.new(search, view_model_options)
end

#indexObject



14
15
16
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 14

def index
  render :setup
end


72
73
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 72

def navigation
end

#new_ruleObject



44
45
46
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 44

def new_rule
  render :rules
end

#productsObject



33
34
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 33

def products
end

#publishObject



84
85
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 84

def publish
end

#rulesObject



41
42
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 41

def rules
end

#save_navigationObject



75
76
77
78
79
80
81
82
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 75

def save_navigation
  if params[:create_menu].to_s =~ /true/
    Navigation::Menu.create!(taxon: @category.taxon)
    flash[:success] = t('workarea.admin.create_catalog_categories.flash_messages.saved')
  end

  redirect_to publish_create_catalog_category_path(@category)
end

#save_publishObject



87
88
89
90
91
92
93
94
95
96
97
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 87

def save_publish
  publish = SavePublishing.new(@category, params)

  if publish.perform
    flash[:success] = t('workarea.admin.create_catalog_categories.flash_messages.created')
    redirect_to catalog_category_path(@category)
  else
    flash[:error] = publish.errors.full_messages
    render :publish
  end
end

#save_taxonomyObject



60
61
62
63
64
65
66
67
68
69
70
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 60

def save_taxonomy
  save = SaveTaxonomy.new(@taxon, params)
  save.perform
  flash[:success] = t('workarea.admin.create_catalog_categories.flash_messages.saved')

  if save.top_level?
    redirect_to navigation_create_catalog_category_path(@category)
  else
    redirect_to publish_create_catalog_category_path(@category)
  end
end

#taxonomyObject



57
58
# File 'app/controllers/workarea/admin/create_catalog_categories_controller.rb', line 57

def taxonomy
end