Class: Gitgo::Controllers::Issue
- Inherits:
-
Gitgo::Controller
- Object
- Sinatra::Base
- Gitgo::Controller
- Gitgo::Controllers::Issue
- Includes:
- Rest
- Defined in:
- lib/gitgo/controllers/issue.rb
Constant Summary collapse
Constants inherited from Gitgo::Controller
Gitgo::Controller::HEAD, Gitgo::Controller::MOUNT, Gitgo::Controller::ROOT
Instance Method Summary collapse
Methods included from Rest
#create, #destroy, #edit, #preview, #preview?, #redirect_to_doc, #show, #update
Methods inherited from Gitgo::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
#attrs ⇒ Object
71 72 73 |
# File 'lib/gitgo/controllers/issue.rb', line 71 def attrs request['doc'] || {'tags' => ['open'], 'at' => session_head} end |
#index ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/gitgo/controllers/issue.rb', line 35 def index all = request['all'] any = request['any'] if = request['tags'] = [] unless .kind_of?(Array) ((all ||= {})['tags'] ||= []).concat() end issues = Issue.find(all, any) # sort results sort = request['sort'] || 'date' reverse = request['reverse'] == 'true' issues.sort! {|a, b| a[sort] <=> b[sort] } issues.reverse! if reverse erb :index, :locals => { :docs => issues, :any => any || {}, :all => all || {}, :sort => sort, :reverse => reverse, :active_sha => session_head } end |
#model ⇒ Object
67 68 69 |
# File 'lib/gitgo/controllers/issue.rb', line 67 def model Issue end |
#tags ⇒ Object
63 64 65 |
# File 'lib/gitgo/controllers/issue.rb', line 63 def repo.index.values('tags') end |