# Class WikisController < ProjectResourceController

- app/controllers/wikis_controller.rb

Methods

C
  - create
D
  - destroy
E
  - edit
H
  - history
P
  - pages
S
  - show

Instance Public methods
create() Link

Source: show

    # File app/controllers/wikis_controller.rb, line 36
    def create
      @wiki = @project.wikis.new(params[:wiki])
      @wiki.user = current_user

      respond_to do |format|
        if @wiki.save
          format.html { redirect_to [@project, @wiki], notice: 'Wiki was successfully updated.' }
        else
          format.html { render action: "edit" }
        end
      end
    end

destroy() Link

Source: show

    # File app/controllers/wikis_controller.rb, line 53
    def destroy
      @wikis = @project.wikis.where(slug: params[:id]).delete_all

      respond_to do |format|
        format.html { redirect_to project_wiki_path(@project, :index), notice: "Page was successfully deleted" }
      end
    end

edit() Link

Source: show

    # File app/controllers/wikis_controller.rb, line 31
    def edit
      @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
      @wiki = Wiki.regenerate_from @wiki
    end

history() Link

Source: show

    # File app/controllers/wikis_controller.rb, line 49
    def history
      @wikis = @project.wikis.where(slug: params[:id]).order("created_at")
    end

pages() Link

Source: show

    # File app/controllers/wikis_controller.rb, line 6
    def pages
      @wikis = @project.wikis.group(:slug).order("created_at")
    end

show() Link

Source: show

    # File app/controllers/wikis_controller.rb, line 10
    def show
      if params[:old_page_id]
        @wiki = @project.wikis.find(params[:old_page_id])
      else
        @wiki = @project.wikis.where(slug: params[:id]).order("created_at").last
      end

      @note = @project.notes.new(noteable: @wiki)

      if @wiki
        render 'show'
      else
        if can?(current_user, :write_wiki, @project)
          @wiki = @project.wikis.new(slug: params[:id])
          render 'edit'
        else
          render 'empty'
        end
      end
    end