Class: Webgit::GitController

Inherits:
ApplicationController show all
Defined in:
app/controllers/webgit/git_controller.rb

Instance Method Summary collapse

Instance Method Details

#blobObject



18
19
20
21
# File 'app/controllers/webgit/git_controller.rb', line 18

def blob
  @blob = find_object
  render formats: [:html]
end

#indexObject



5
6
7
# File 'app/controllers/webgit/git_controller.rb', line 5

def index

end

#previewObject



23
24
25
26
27
28
29
30
# File 'app/controllers/webgit/git_controller.rb', line 23

def preview  
  @blob = find_object  
  content_type = Mime.fetch(params[:format]){|fallback| "text/html"}.to_s
  response.headers['Cache-Control'] = "public, max-age=#{12.hours.to_i}"
  response.headers['Content-Type'] = content_type
  response.headers['Content-Disposition'] = 'inline'
  render text: @blob.content, content_type: content_type
end

#set_current_repoObject



9
10
11
12
# File 'app/controllers/webgit/git_controller.rb', line 9

def set_current_repo
  session[:current_repo] = params[:repo_name]
  redirect_to webgit_tree_path(:master)
end

#treeObject



14
15
16
# File 'app/controllers/webgit/git_controller.rb', line 14

def tree
  @tree = find_object
end