Class: Tenon::PagesController
Instance Method Summary
collapse
#destroy, #edit, #initialize
Instance Method Details
#create ⇒ Object
29
30
31
32
33
|
# File 'app/controllers/tenon/pages_controller.rb', line 29
def create
params[:page][:creator_id] = current_user.id
params[:page][:updater_id] = current_user.id
super
end
|
#index ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/tenon/pages_controller.rb', line 5
def index
respond_to do |format|
format.html
format.json do
if params[:q].blank?
@pages = Tenon::Page.order(:lft)
else
pages = Tenon::Page.where(search_args).map { |p| [p.ancestors, p] }
@pages = pages.flatten.uniq.sort_by(&:lft)
end
end
end
end
|
#new ⇒ Object
19
20
21
22
|
# File 'app/controllers/tenon/pages_controller.rb', line 19
def new
resource.parent_id = params[:parent_id]
super
end
|
#reorder ⇒ Object
35
36
37
38
|
# File 'app/controllers/tenon/pages_controller.rb', line 35
def reorder
@pages = Tenon::Page.reorder!(params[:item_list], params[:parent_id])
render nothing: true
end
|
#update ⇒ Object
24
25
26
27
|
# File 'app/controllers/tenon/pages_controller.rb', line 24
def update
resource.updater_id = current_user.id
super
end
|