Class: Admin::TagsController
Instance Method Summary
collapse
Methods included from BlogHelper
#blog_base_url, #this_blog
Instance Method Details
#create ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
|
# File 'app/controllers/admin/tags_controller.rb', line 13
def create
@tag = this_blog.tags.new(tag_params)
if @tag.save
flash[:notice] = I18n.t("admin.base.successfully_created",
name: PostType.model_name.human)
redirect_to admin_tags_url
else
fetch_tags
render :index
end
end
|
#destroy ⇒ Object
37
38
39
|
# File 'app/controllers/admin/tags_controller.rb', line 37
def destroy
destroy_a(Tag)
end
|
#edit ⇒ Object
11
|
# File 'app/controllers/admin/tags_controller.rb', line 11
def edit; end
|
#index ⇒ Object
7
8
9
|
# File 'app/controllers/admin/tags_controller.rb', line 7
def index
@tag = Tag.new
end
|
#update ⇒ Object
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/admin/tags_controller.rb', line 26
def update
old_name = @tag.name
if @tag.update(tag_params)
Redirect.create(from_path: "/tag/#{old_name}", to_path: @tag.permalink_url(nil, true))
redirect_to admin_tags_url, notice: I18n.t("admin.tags.edit.success")
else
render :edit
end
end
|