Class: Backend::ArticlesController
Instance Method Summary
collapse
#page_number, #paginate, #per_page
#update_translation
#breadcrumb, #current_admin, #default_app_locale, #translate_notice
#crypt
Instance Method Details
#create ⇒ Object
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/backend/articles_controller.rb', line 16
def create
@model = Article.new(allowed_params)
if @model.save
redirect_to edit_translation_backend_article_path(@model, translation_locale: default_app_locale),
notice: translate_notice(:added, :article)
else
render :new
end
end
|
#destroy ⇒ Object
35
36
37
38
|
# File 'app/controllers/backend/articles_controller.rb', line 35
def destroy
@model.destroy
redirect_to backend_articles_path, notice: translate_notice(:deleted, :article)
end
|
#index ⇒ Object
8
9
10
|
# File 'app/controllers/backend/articles_controller.rb', line 8
def index
@articles = paginate Article.order('published_at DESC')
end
|
#new ⇒ Object
12
13
14
|
# File 'app/controllers/backend/articles_controller.rb', line 12
def new
@model = Article.new
end
|
#update ⇒ Object
27
28
29
30
31
32
33
|
# File 'app/controllers/backend/articles_controller.rb', line 27
def update
if @model.update_attributes allowed_params
redirect_to backend_articles_path, notice: translate_notice(:edited, :article)
else
render :edit
end
end
|