Class: Dashboard::SnippetsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Gitlab::NoteableMetadata, PaginatedCollection, SnippetsSort
Defined in:
app/controllers/dashboard/snippets_controller.rb

Instance Method Summary collapse

Methods included from SnippetsSort

#sort_param

Methods included from Gitlab::NoteableMetadata

#noteable_meta_data

Instance Method Details

#indexObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/dashboard/snippets_controller.rb', line 12

def index
  @snippet_counts = Snippets::CountService
    .new(current_user, author: current_user)
    .execute

  @snippets = SnippetsFinder.new(current_user, author: current_user, scope: params[:scope], sort: sort_param)
    .execute
    .page(params[:page])
    .inc_author
    .inc_projects_namespace_route
    .inc_statistics

  return if redirect_out_of_range(@snippets)

  @noteable_meta_data = (@snippets, 'Snippet')
end