Class: Webgit::GitController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Webgit::GitController
- Defined in:
- app/controllers/webgit/git_controller.rb
Instance Method Summary collapse
Instance Method Details
#blob ⇒ Object
18 19 20 21 |
# File 'app/controllers/webgit/git_controller.rb', line 18 def blob @blob = find_object render formats: [:html] end |
#index ⇒ Object
5 6 7 |
# File 'app/controllers/webgit/git_controller.rb', line 5 def index end |
#preview ⇒ Object
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_repo ⇒ Object
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 |
#tree ⇒ Object
14 15 16 |
# File 'app/controllers/webgit/git_controller.rb', line 14 def tree @tree = find_object end |