Compare commits
No commits in common. "f116562a5fd5ea5d707a3fe5f1abb8bda7a92cb7" and "c1bb834a7f9c633d82a1610170fc0e563218fe88" have entirely different histories.
f116562a5f
...
c1bb834a7f
6 changed files with 27 additions and 43 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,3 @@
|
|||
/test/databases/*.db
|
||||
/pelican
|
||||
/*.pelican
|
||||
/hack
|
||||
|
|
2
go.mod
2
go.mod
|
@ -6,7 +6,7 @@ require (
|
|||
github.com/gdamore/tcell/v2 v2.7.0
|
||||
github.com/magefile/mage v1.15.0
|
||||
github.com/rivo/tview v0.0.0-20231206124440-5f078138442e
|
||||
go.etcd.io/bbolt v1.3.8
|
||||
go.etcd.io/bbolt v1.3.7
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
4
go.sum
4
go.sum
|
@ -20,8 +20,8 @@ github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
|
|||
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
|
||||
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
|
||||
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
|
||||
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
|
|
|
@ -47,28 +47,23 @@ func (a *App) initCardForm() {
|
|||
a.cardForm.setDoneFunc(doneFunc)
|
||||
}
|
||||
|
||||
// initDeleteModal initialises the modal for deleting cards or statuses.
|
||||
func (a *App) initDeleteModal() {
|
||||
// initDeleteCardModal initialises the modal for deleting cards.
|
||||
func (a *App) initDeleteCardModal() {
|
||||
doneFunc := func(_ int, buttonLabel string) {
|
||||
if buttonLabel == "Confirm" {
|
||||
switch a.mode {
|
||||
case normal:
|
||||
a.deleteFocusedCard()
|
||||
case boardEdit:
|
||||
a.deleteFocusedStatusColumn()
|
||||
}
|
||||
a.deleteFocusedCard()
|
||||
}
|
||||
|
||||
a.pages.HidePage(deleteModalPage)
|
||||
a.pages.HidePage(deleteCardModalPage)
|
||||
a.setColumnFocus()
|
||||
}
|
||||
|
||||
a.deleteModal.AddButtons([]string{"Cancel", "Confirm"}).SetDoneFunc(doneFunc)
|
||||
a.deleteCardModal.AddButtons([]string{"Confirm", "Cancel"}).SetDoneFunc(doneFunc)
|
||||
|
||||
a.deleteModal.SetBorder(true).SetBorderColor(tcell.ColorOrangeRed)
|
||||
a.deleteModal.SetBackgroundColor(tcell.ColorBlack.TrueColor())
|
||||
a.deleteModal.SetButtonBackgroundColor(tcell.ColorBlueViolet.TrueColor())
|
||||
a.deleteModal.SetTextColor(tcell.ColorWhite.TrueColor())
|
||||
a.deleteCardModal.SetBorder(true).SetBorderColor(tcell.ColorOrangeRed)
|
||||
a.deleteCardModal.SetBackgroundColor(tcell.ColorBlack.TrueColor())
|
||||
a.deleteCardModal.SetButtonBackgroundColor(tcell.ColorBlueViolet.TrueColor())
|
||||
a.deleteCardModal.SetTextColor(tcell.ColorWhite.TrueColor())
|
||||
}
|
||||
|
||||
// initQuitModal initialises the quit modal.
|
||||
|
|
|
@ -87,22 +87,16 @@ func (a *App) edit() {
|
|||
}
|
||||
|
||||
func (a *App) delete() {
|
||||
switch a.mode {
|
||||
case normal:
|
||||
if a.mode == normal {
|
||||
card, ok := a.getFocusedCard()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
text := fmt.Sprintf("Do you want to delete the CARD %q?", card.Title)
|
||||
a.deleteModal.SetText(text)
|
||||
a.pages.ShowPage(deleteModalPage)
|
||||
a.SetFocus(a.deleteModal)
|
||||
case boardEdit:
|
||||
text := fmt.Sprintf("Do you want to delete the STATUS %q?", a.focusedStatusName())
|
||||
a.deleteModal.SetText(text)
|
||||
a.pages.ShowPage(deleteModalPage)
|
||||
a.SetFocus(a.deleteModal)
|
||||
text := fmt.Sprintf("Do you want to delete '%s'?", card.Title)
|
||||
a.deleteCardModal.SetText(text)
|
||||
a.pages.ShowPage(deleteCardModalPage)
|
||||
a.SetFocus(a.deleteCardModal)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ const (
|
|||
)
|
||||
|
||||
const (
|
||||
mainPage string = "main"
|
||||
quitPage string = "quit"
|
||||
cardFormPage string = "card form"
|
||||
deleteModalPage string = "delete modal"
|
||||
viewPage string = "view"
|
||||
statusFormPage string = "status form"
|
||||
mainPage string = "main"
|
||||
quitPage string = "quit"
|
||||
cardFormPage string = "card form"
|
||||
deleteCardModalPage string = "delete card modal"
|
||||
viewPage string = "view"
|
||||
statusFormPage string = "status form"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -51,7 +51,7 @@ type App struct {
|
|||
modeView *modeView
|
||||
quitModal *tview.Modal
|
||||
cardForm *cardForm
|
||||
deleteModal *tview.Modal
|
||||
deleteCardModal *tview.Modal
|
||||
statusSelection statusSelection
|
||||
cardView *cardView
|
||||
statusbar *statusbar
|
||||
|
@ -75,7 +75,7 @@ func NewApp(path string) (App, error) {
|
|||
focusedColumn: 0,
|
||||
columns: nil,
|
||||
board: kanban,
|
||||
deleteModal: tview.NewModal(),
|
||||
deleteCardModal: tview.NewModal(),
|
||||
mode: normal,
|
||||
modeView: newModeView(),
|
||||
statusSelection: statusSelection{0, 0, 0},
|
||||
|
@ -108,8 +108,8 @@ func (a *App) Init() error {
|
|||
a.initCardForm()
|
||||
a.pages.AddPage(cardFormPage, a.cardForm, false, false)
|
||||
|
||||
a.initDeleteModal()
|
||||
a.pages.AddPage(deleteModalPage, a.deleteModal, false, false)
|
||||
a.initDeleteCardModal()
|
||||
a.pages.AddPage(deleteCardModalPage, a.deleteCardModal, false, false)
|
||||
|
||||
a.initCardView()
|
||||
a.pages.AddPage(viewPage, a.cardView, false, false)
|
||||
|
@ -366,7 +366,3 @@ func (a *App) saveNewStatus(name string) {
|
|||
|
||||
a.refresh(refreshArgs{updateFocusedColumnOnly: false, reinitialiseColumns: true})
|
||||
}
|
||||
|
||||
// TODO
|
||||
func (a *App) deleteFocusedStatusColumn() {
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue