Class: Virgo::Admin::ColumnsController
Instance Method Summary
collapse
#authorize_admin_user, #search, #set_is_admin_view
#render_content, #with_format
#action?, #admin?, #admin_access?, #admin_view?, #alerts, #base_errors, #category_timestamp, #column_timestamp, #compact_html, #controller?, #decode_html_entities, #expanded_post_url, #is_admin_view?, #page_url, #post_time_format, #post_timestamp, #production?, #redis_timestamp_key_for, #site, #site_key, #superuser?, #tabbed_param, #word_count
Instance Method Details
#create ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/virgo/admin/columns_controller.rb', line 20
def create
@column = Column.new(column_params)
authorize! :create, @column
if @column.save
flash[:notice] = "Column created"
redirect_to admin_columns_path
else
render :new
end
end
|
#destroy ⇒ Object
45
46
47
48
49
50
51
|
# File 'app/controllers/virgo/admin/columns_controller.rb', line 45
def destroy
@column.destroy
flash[:notice] = "Column removed"
redirect_to admin_columns_path
end
|
#edit ⇒ Object
33
34
|
# File 'app/controllers/virgo/admin/columns_controller.rb', line 33
def edit
end
|
#index ⇒ Object
7
8
9
10
11
12
13
14
|
# File 'app/controllers/virgo/admin/columns_controller.rb', line 7
def index
if params[:sort].nil?
flash.keep
redirect_to admin_columns_path(sort: 'weight') and return
end
@columns = Column.order(sort_order).with_post_count.page(params[:page])
end
|
#new ⇒ Object
16
17
18
|
# File 'app/controllers/virgo/admin/columns_controller.rb', line 16
def new
@column = Column.new
end
|
#update ⇒ Object
36
37
38
39
40
41
42
43
|
# File 'app/controllers/virgo/admin/columns_controller.rb', line 36
def update
if @column.update(column_params)
flash[:notice] = "Column settings updated"
redirect_to admin_columns_path
else
render :edit
end
end
|