Class: Projects::SnippetsController

Inherits:
Projects::Snippets::ApplicationController
  • Object
show all
Extended by:
Gitlab::Utils::Override
Includes:
SnippetsActions, SpammableActions::AkismetMarkAsSpamAction, ToggleAwardEmoji
Defined in:
app/controllers/projects/snippets_controller.rb

Instance Method Summary collapse

Methods included from Gitlab::Utils::Override

extended, extensions, included, method_added, override, prepended, queue_verification, verify!

Methods included from SpammableActions::AkismetMarkAsSpamAction

#mark_as_spam

Methods included from ToggleAwardEmoji

#toggle_award_emoji

Methods included from SnippetsActions

#edit, #js_request?, #raw, #show

Methods included from Gitlab::Tracking::Helpers

#dnt_enabled?, #trackable_html_request?

Methods included from SnippetsSort

#sort_param

Methods included from Snippets::SendBlob

#send_snippet_blob

Methods included from SendsBlob

#send_blob

Methods included from Gitlab::NoteableMetadata

#noteable_meta_data

Methods included from RendersBlob

#blob_json, #conditionally_expand_blob, #conditionally_expand_blobs, #render_blob_json

Methods included from RendersNotes

#prepare_notes_for_rendering

Instance Method Details

#indexObject


19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/controllers/projects/snippets_controller.rb', line 19

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

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

  return if redirect_out_of_range(@snippets)

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

#newObject


35
36
37
# File 'app/controllers/projects/snippets_controller.rb', line 35

def new
  @snippet = @noteable = @project.snippets.build
end