Class: Wiki::SpacesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/wiki/spaces_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
11
12
13
14
15
16
# File 'app/controllers/wiki/spaces_controller.rb', line 8

def create
  @space = Space.new space_params.merge(creator: current_user)

  if @space.save
    redirect_to wiki_page_path(@space)
  else
    render :new
  end
end

#load_till_spaceObject



28
29
30
# File 'app/controllers/wiki/spaces_controller.rb', line 28

def load_till_space
  @page = Page.find params[:page_id]
end

#newObject



4
5
6
# File 'app/controllers/wiki/spaces_controller.rb', line 4

def new
  @space = Space.new creator: current_user
end

#space_listObject



18
19
20
21
22
23
24
25
26
# File 'app/controllers/wiki/spaces_controller.rb', line 18

def space_list
  @page = Page.find params[:id]
  @load_list = []
  if params[:page_id].present?
    @until_page = Page.find params[:page_id] 
    @load_list = @until_page.ancestor_ids
  end
  render layout: false
end