Welcome to mirror list, hosted at ThFree Co, Russian Federation.

wikis_controller.rb « projects « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d531d2567217d4ed96360e1d38bc481ec543890b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# frozen_string_literal: true

class Projects::WikisController < Projects::ApplicationController
  include ProjectWikiActions
  include WikiHelper

  def self.local_prefixes
    [controller_path, 'shared/wiki']
  end

  def pages
    @nesting = show_children_param
    @show_children = @nesting != ProjectWiki::NESTING_CLOSED
    @wiki_pages = Kaminari.paginate_array(
      project_wiki.list_pages(**sort_params)
    ).page(params[:page])

    @wiki_entries = case @nesting
                    when ProjectWiki::NESTING_FLAT
                      @wiki_pages
                    else
                      WikiDirectory.group_by_directory(@wiki_pages)
                    end

    render 'show'
  end

  def git_access
  end

  private

  def sort_params
    process_params(sort_params_config)
  end

  def show_children_param
    config = nesting_params_config(params[:sort])

    process_params(config)
  end
end