Class: Adminpanel::CategoriesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/adminpanel/categories_controller.rb

Instance Method Summary collapse

Methods included from TwitterActions

#twitter_publish

Methods included from FacebookActions

#fb_choose_page, #fb_publish, #fb_save_token

Methods included from GalleryzableActions

#move_better, #move_worst

Methods included from RestActions

#show

Methods included from SessionsHelper

#current_user, #current_user=, #sign_in, #sign_out, #signed_in?

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/adminpanel/categories_controller.rb', line 19

def create
  merge_params
  create! do |success, failure|
    success.html do
      flash[:success] = I18n.t("action.save_success")
      redirect_to categories_path
    end
    failure.html do
      set_collections
      render 'shared/new'
    end
    success.js do
      if params[:currentcontroller].to_s == 'adminpanel/categories'
        render 'create', :locals => {:category => resource}
      elsif params[:belongs_request].present?
        render 'shared/create_belongs_to'
      else
        render 'shared/create_has_many'
      end
    end
    failure.js do
      set_collections
      render "new"

    end
  end
end

#destroyObject



70
71
72
73
74
75
76
# File 'app/controllers/adminpanel/categories_controller.rb', line 70

def destroy
  destroy! do |format|
    format.html do
      redirect_to categories_path
    end
  end
end

#editObject



47
48
49
50
51
52
53
54
# File 'app/controllers/adminpanel/categories_controller.rb', line 47

def edit
  edit! do |format|
    format.html do
      set_collections
      render "shared/edit"
    end
  end
end

#indexObject



4
5
6
# File 'app/controllers/adminpanel/categories_controller.rb', line 4

def index
  @categories = Category.all
end

#newObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/adminpanel/categories_controller.rb', line 8

def new
  set_collections
  new! do |format|
    format.html { render "shared/new" }
    format.js do
      render
    end
  end
end

#updateObject



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'app/controllers/adminpanel/categories_controller.rb', line 56

def update
  update! do |success, failure|
    success.html do
      flash[:success] = I18n.t("action.save_success")
      # render "shared/index"
      redirect_to categories_path
    end
    failure.html do
      set_collections
      render "shared/edit"
    end
  end
end