Skip to content

Commit

Permalink
tui, revise showing success of buchen
Browse files Browse the repository at this point in the history
  • Loading branch information
BuJo committed Mar 31, 2020
1 parent db87ee1 commit 055d25c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/buchungsstreber/cli/tui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,30 @@ def detailpage(x, y)

def buchen(date = nil)
redmines = @buchungsstreber.redmines
entries = @entries[:entries].select { |e| date.nil? || Date.parse(date) == e[:date] }
entries = @entries[:entries].select { |e| date.nil? || date == e[:date] }

w = Curses::Window.new(@win.maxy-4, (@win.maxx * 0.80).ceil, 2, (@win.maxx * 0.10).ceil)
w.setpos(2, 2)
w.attron(Curses::A_BOLD) { w.addstr("Buche\n\n") }
w.attron(Curses::A_BOLD) { w.addstr("Buche\n") }
w.box("|", "-")
w.refresh

entries.each do |entry|
w.setpos(w.cury, 4)
w.addstr style("Buche #{entry[:time]}h auf \##{entry[:issue]}: #{entry[:text]}", 60)
w.setpos(w.cury+1, 5)
w.addstr style("Buche #{entry[:time]}h auf \##{entry[:issue]}: #{entry[:text]}", w.maxx - 15)
w.refresh
success = redmines.get(entry[:redmine]).add_time entry
color = success ? color_pair(:green) : (color_pair(:red) | Curses::A_BOLD)
w.attron(color) do
w.addstr success ? "→ OK\n" : "→ FEHLER\n"
end
Kernel.sleep(1)
w.attron(color) { w.addstr(success ? "→ OK" : "→ FEHLER") }
w.setpos(w.cury, 3)
w.attron(color) { w.addstr(success ? '✓' : 'X') }
w.refresh
end

w.setpos(w.cury, 2)
w.addstr "\nBuchungen abgearbeitet\n"
w.setpos(w.cury+2, 2)
w.addstr "Buchungen abgearbeitet\n"

w.box("|", "-")
w.refresh
w.getch
w.close
Expand Down

0 comments on commit 055d25c

Please sign in to comment.