Class: Gitgo::App

Inherits:
Controller show all
Defined in:
lib/gitgo/app.rb

Constant Summary

Constants inherited from Controller

Controller::HEAD, Controller::MOUNT, Controller::ROOT

Instance Method Summary collapse

Methods inherited from Controller

#call, #form, #format, #html, #initialize, #mount_point, #path, #repo, #session_head, #session_head=, #url

Constructor Details

This class inherits a constructor from Gitgo::Controller

Instance Method Details

#build_query(params) ⇒ Object



58
59
60
61
# File 'lib/gitgo/app.rb', line 58

def build_query(params)
  params.delete_if {|key, value| value.nil? }
  super(params)
end

#indexObject



20
21
22
# File 'lib/gitgo/app.rb', line 20

def index
  erb :index
end

#timelineObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/gitgo/app.rb', line 31

def timeline
  Document.update_index
  
  page = (request[:page] || 0).to_i
  per_page = (request[:per_page] || 5).to_i
  
  author = request[:author]
  author = '' if author == 'unknown'
  
  docs = repo.timeline(:n => per_page, :offset => page * per_page) do |sha|
    author.nil? || repo[sha]['author'].include?("<#{author}>")
  end.collect do |sha|
    Document.cast(repo[sha], sha)
  end.sort_by do |doc|
    doc.date
  end
  
  erb :timeline, :locals => {
    :page => page,
    :per_page => per_page,
    :docs => docs,
    :author => author,
    :authors => repo.index.values('email'),
    :active_sha => session_head
  }
end

#welcomeObject



24
25
26
27
28
29
# File 'lib/gitgo/app.rb', line 24

def welcome
  erb :welcome, :locals => {
    :branch => repo.branch,
    :remotes => repo.refs
  }
end