Class: Kanboard::JekyllRenderer
- Inherits:
-
Object
- Object
- Kanboard::JekyllRenderer
- Defined in:
- lib/kanboard/jekyll_renderer.rb
Constant Summary collapse
- OUTPUT_DIR =
"kanboard"
Instance Method Summary collapse
-
#initialize(board) ⇒ JekyllRenderer
constructor
A new instance of JekyllRenderer.
- #render ⇒ Object
- #render_assignments ⇒ Object
- #render_board ⇒ Object
Constructor Details
#initialize(board) ⇒ JekyllRenderer
Returns a new instance of JekyllRenderer.
6 7 8 |
# File 'lib/kanboard/jekyll_renderer.rb', line 6 def initialize(board) @board = board end |
Instance Method Details
#render ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/kanboard/jekyll_renderer.rb', line 10 def render Dir.mkdir(OUTPUT_DIR) if not Dir.exists?(OUTPUT_DIR) board_filename = File.join(OUTPUT_DIR, @board.project.gsub(/[\p{Punct}\p{Space}]+/, "_") + ".textile") File.open(board_filename, 'w') do |f| f.puts render_board end board_filename = File.join(OUTPUT_DIR, @board.project.gsub(/[\p{Punct}\p{Space}]+/, "_") + "-assignments.textile") File.open(board_filename, 'w') do |f| f.puts render_assignments end end |
#render_assignments ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/kanboard/jekyll_renderer.rb', line 64 def render_assignments output = "" output << "--- title: Assignments for #{@board.project} layout: default --- h1. Assignments for #{@board.project}\n\n" @board.owners.each do |owner| output << "h2. #{owner}\n" @board.cards_of(owner).each do |card| output << "* #{card}\n" end end output end |
#render_board ⇒ Object
28 29 30 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 57 58 59 60 61 62 |
# File 'lib/kanboard/jekyll_renderer.rb', line 28 def render_board statuses = @board.statuses swimlanes = @board.swimlanes output = "" output << "--- title: Kanban Board for #{@board.project} layout: default --- h1. Board for #{@board.project}\n\n" output << "<table class=\"board\">" output << "<tr>\n" output << " <th></th>\n" statuses.each do |status| output << " <th>#{status}</th>\n" end output << "</tr>\n" swimlanes.each do |swimlane| output << "<tr>\n" output << " <td>#{swimlane}</td>\n" statuses.each do |status| output << " <td>\n" @board.cards(status, swimlane).each do |card| output << " <div class=\"card\">#{card}</div>\n" end output << " </td>\n" end output << "</tr>\n" end output << "</table>\n" output end |