Class: Backend::TagsController
Instance Method Summary
collapse
#page_number, #paginate, #per_page
#breadcrumb, #current_admin, #default_app_locale, #translate_notice
#crypt
Instance Method Details
#create ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/backend/tags_controller.rb', line 20
def create
@tag = Tag.new(allowed_params)
if @tag.save
redirect_to backend_tags_path, notice: translate_notice(:added, :tag)
else
render :new
end
end
|
#destroy ⇒ Object
30
31
32
33
|
# File 'app/controllers/backend/tags_controller.rb', line 30
def destroy
@tag.destroy
redirect_to backend_tags_path, notice: translate_notice(:deleted, :tag)
end
|
#index ⇒ Object
7
8
9
10
|
# File 'app/controllers/backend/tags_controller.rb', line 7
def index
@search = Tag.ransack params[:q]
@tags = @search.result(distinct: true).order(:name).page(page_number).per_page(15)
end
|
#new ⇒ Object
16
17
18
|
# File 'app/controllers/backend/tags_controller.rb', line 16
def new
@tag = Tag.new
end
|
#show ⇒ Object
12
13
14
|
# File 'app/controllers/backend/tags_controller.rb', line 12
def show
redirect_to edit_backend_tag_path(@tag)
end
|
#update ⇒ Object
35
36
37
38
39
40
41
|
# File 'app/controllers/backend/tags_controller.rb', line 35
def update
if @tag.update_attributes allowed_params
redirect_to backend_tags_path, notice: translate_notice(:edited, :tag)
else
render :edit
end
end
|