class DitzStr::BrickView
Public Class Methods
new(project, config, dir)
click to toggle source
Calls superclass method
# File lib/ditzstr/brick.rb, line 9 def initialize project, config, dir super project, config, dir end
Public Instance Methods
comment_on_issue(issuename, comment)
click to toggle source
# File lib/ditzstr/brick.rb, line 27 def comment_on_issue issuename, comment issue_res = get_issue_by_name issuename if issue_res[0] iss = issue_res[1] iss.log "commented", @config.user, comment return "<html><head><meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=/issue-#{issuename}.html\"></head><body>Redirecting...</body></html>" else return issue_res[1] end end
edit_issue(issuename, changes)
click to toggle source
# File lib/ditzstr/brick.rb, line 18 def edit_issue issuename, changes if changes[:description] != nil end if changes[:reporter] != nil end if changes[:title] != nil end end
generate_close_issue(issue_id, disposition)
click to toggle source
# File lib/ditzstr/brick.rb, line 43 def generate_close_issue issue_id, disposition issue_res = get_issue_by_name issue_id if issue_res[0] issue = issue_res[1] erb = ERB.new IO.read(File.join(@template_dir, "close.rhtml")) return erb.result binding() else return issue_res[1] end end
generate_component(comp_name)
click to toggle source
# File lib/ditzstr/brick.rb, line 87 def generate_component comp_name #TODO Actions issue_link = "/new_issue.html?component=#{comp_name}" links = generate_links c = @project.component_for comp_name generate_component_html_str links, c, {:brick=>true} end
generate_edit_issue(issue_id)
click to toggle source
# File lib/ditzstr/brick.rb, line 40 def generate_edit_issue issue_id end
generate_index()
click to toggle source
# File lib/ditzstr/brick.rb, line 72 def generate_index links = generate_links generate_index_html_str links, {:brick=>true} end
generate_issue(issuename)
click to toggle source
# File lib/ditzstr/brick.rb, line 97 def generate_issue issuename links = generate_links issue_res = get_issue_by_name issuename if issue_res[0] return generate_issue_html_str links, issue_res[1], {:brick=>true} else return issue_res[1] end end
generate_new_component()
click to toggle source
# File lib/ditzstr/brick.rb, line 62 def generate_new_component erb = ERB.new IO.read(File.join(@template_dir, "new_component.rhtml")) return erb.result binding() end
generate_new_issue(options)
click to toggle source
# File lib/ditzstr/brick.rb, line 56 def generate_new_issue options past_rels, upcoming_rels = @project.releases.partition { |r| r.released? } erb = ERB.new IO.read(File.join(@template_dir, "new_issue.rhtml")) return erb.result binding() end
generate_new_release()
click to toggle source
# File lib/ditzstr/brick.rb, line 67 def generate_new_release erb = ERB.new IO.read(File.join(@template_dir,"new_release.rhtml")) return erb.result binding() end
generate_release(relname)
click to toggle source
# File lib/ditzstr/brick.rb, line 77 def generate_release relname issue_link = "/new_issue.html?release=#{relname}" #TODO Actions links = generate_links r = @project.release_for relname generate_release_html_str links, r, {:brick=>true} end
get_issue_by_name(issuename)
click to toggle source
# File lib/ditzstr/brick.rb, line 110 def get_issue_by_name issuename issues_vec = @project.issues_for issuename case issues_vec.size when 0; return [false,"<html><body>No such issue found...</body></html>"]; when 1; return [true,issues_vec.first] else return [false,"<html><body>Multiple issues found...</body></html>"]; end end
link_to(name, text)
click to toggle source
# File lib/ditzstr/brick.rb, line 13 def link_to name, text links = generate_links return "<a href=\"#{links[name]}\">#{text}</a>" end