Skip to content

Commit

Permalink
Fix large update:with: methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke committed Aug 3, 2022
1 parent ed2da14 commit f7f9277
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 37 deletions.
7 changes: 1 addition & 6 deletions Squello-Core.package/SPBBoard.class/instance/addColumn.st
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,4 @@ addColumn
on: Error
do: [:error | ^ self errorCannotAddColumn: error messageText].

column
board: self;
boardProvider: self boardProvider;
changeProvider: self changeProvider.
self columns add: column.
self updateColumns.
self addColumnLocal: column.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
updating
addColumnLocal: anSPBColumn

anSPBColumn
board: self;
boardProvider: self boardProvider;
changeProvider: self changeProvider.
self columns add: anSPBColumn.
self updateColumns.
5 changes: 5 additions & 0 deletions Squello-Core.package/SPBBoard.class/instance/columnFromId..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
columnFromId: aNumber

^ self columns detect:
[:column | column id = aNumber].
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
indexOfColumn: aNumber

^ self columns indexOf:
(self columnFromId: aNumber).
7 changes: 1 addition & 6 deletions Squello-Core.package/SPBBoard.class/instance/update.with..st
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,4 @@ update: aSymbol with: aDictionary

((aDictionary at: 'action') = #create)
ifTrue: [column := SPBColumn newFrom: aDictionary.
column
board: self;
boardProvider: self boardProvider;
changeProvider: self changeProvider.
self columns add: column.
self updateColumns].
self addColumnLocal: column].
7 changes: 5 additions & 2 deletions Squello-Core.package/SPBBoard.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"registerInAppsMenu" : "lo 6/4/2022 23:19" },
"instance" : {
"activeCard" : "mcr 8/1/2022 02:31",
"addColumn" : "tk 8/2/2022 23:31",
"addColumn" : "lo 8/3/2022 12:34",
"addColumnLocal:" : "lo 8/3/2022 12:34",
"boardProvider" : "jh 7/29/2022 11:34",
"boardProvider:" : "lo 7/31/2022 16:32",
"buildAddColumnButtonPanelSpecWith:" : "lo 8/1/2022 13:41",
Expand Down Expand Up @@ -40,13 +41,15 @@
"changeActiveCardTo:" : "mcr 8/1/2022 00:54",
"changeProvider" : "lo 7/8/2022 14:00",
"changeProvider:" : "lo 7/8/2022 15:29",
"columnFromId:" : "lo 8/3/2022 12:57",
"columns" : "tk 7/30/2022 21:38",
"columns:" : "tk 7/30/2022 21:38",
"createColumns" : "lo 8/1/2022 11:11",
"createSidebar" : "lo 8/1/2022 11:11",
"errorCannotAddColumn:" : "jh 7/31/2022 14:28",
"errorInvalidUrl" : "mcr 8/2/2022 22:17",
"errorNoProjects" : "mcr 8/2/2022 22:15",
"indexOfColumn:" : "lo 8/3/2022 12:57",
"initialize" : "jh 7/29/2022 11:36",
"loadProject:" : "mcr 8/2/2022 23:34",
"parseRepoFromUrl:" : "mcr 8/2/2022 21:15",
Expand All @@ -56,7 +59,7 @@
"setupColumns" : "jh 8/3/2022 00:48",
"sidebar" : "mcr 8/1/2022 00:44",
"sidebar:" : "mcr 8/1/2022 00:44",
"update:with:" : "mcr 8/1/2022 01:27",
"update:with:" : "lo 8/3/2022 12:35",
"updateColumns" : "mcr 8/1/2022 01:27",
"updateColumnsAndSidebar" : "mcr 8/1/2022 00:48",
"usedBuilder" : "lo 5/26/2022 15:02",
Expand Down
10 changes: 10 additions & 0 deletions Squello-Core.package/SPBCard.class/instance/moveCardWith..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
updating-local
moveCardWith: aDictionary

| newColumn |
newColumn := self column board columnFromId: (aDictionary at: 'columnId').
newColumn removeFromOldColumn: self.
(aDictionary at: 'after')
ifNil: [newColumn cards addFirst: self]
ifNotNil: [newColumn cards add: self after: (newColumn cardFromId: (aDictionary at: 'after'))].
newColumn addCardLocal: self.
16 changes: 2 additions & 14 deletions Squello-Core.package/SPBCard.class/instance/update.with..st
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
updating
update: aSymbol with: aDictionary

| board newColumn label assignee |
| label assignee |
aSymbol = #card
ifFalse: [^ self].
(self id = (aDictionary at: 'id') or: [self issueId = (aDictionary at: 'id')])
ifFalse: [^ self].

((aDictionary at: 'action') = #move)
ifTrue: [board := self column board.
newColumn := board columns
detect: [:lane | lane id = (aDictionary at: 'columnId')].
self openInWorld.
newColumn removeFromOldColumn: self.
newColumn pasteup addMorph: self.
(aDictionary at: 'after')
ifNil: [newColumn cards addFirst: self]
ifNotNil: [newColumn cards add: self after: (newColumn cards detect: [:card | card id = (aDictionary at: 'after')])].
newColumn resizeToFitCards.
self column alignCards.
newColumn alignCards.
self column: newColumn].
ifTrue: [self moveCardWith: aDictionary].

((aDictionary at: 'action') = #delete)
ifTrue: [self column deleteCard: self].
Expand Down
3 changes: 2 additions & 1 deletion Squello-Core.package/SPBCard.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"labels:" : "lo 7/31/2022 16:29",
"lowerHalfIndicator" : "tk 8/2/2022 23:22",
"lowerHalfIndicator:" : "tk 8/2/2022 23:22",
"moveCardWith:" : "lo 8/3/2022 13:14",
"removeAssignee:" : "lo 7/31/2022 16:38",
"removeAssigneeLocal:" : "lo 7/31/2022 16:39",
"removeLabel:" : "lo 7/31/2022 16:41",
Expand All @@ -66,7 +67,7 @@
"title:" : "mcr 5/21/2022 20:52",
"titleModel" : "tk 8/2/2022 23:24",
"titleModel:" : "tk 8/2/2022 23:24",
"update:with:" : "lo 8/1/2022 11:55",
"update:with:" : "lo 8/3/2022 13:13",
"updateAssigneeCount" : "tk 8/2/2022 23:27",
"updateBalloonText" : "tk 8/2/2022 23:15",
"updateDescription:" : "jh 7/29/2022 11:38",
Expand Down
3 changes: 1 addition & 2 deletions Squello-Core.package/SPBColumn.class/instance/addCard.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ addCard
ifTrue: [^ self].
content := Dictionary newFrom: {'title' -> cardTitle . 'body' -> ''}.
SPBCard buildNew: content into: self.
self alignCards.

self alignCards.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
creation
addCardLocal: anSPBCard

self pasteup addMorph: anSPBCard.
self
resizeToFitCards;
alignCards.
anSPBCard column: self.
5 changes: 5 additions & 0 deletions Squello-Core.package/SPBColumn.class/instance/cardFromId..st
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
accessing
cardFromId: aNumber

^ self cards detect:
[:card | card id = aNumber].
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ removeFromOldColumn: anSPBCard
remove: anSPBCard
ifAbsent: [].
anSPBCard column resizeToFitCards.
anSPBCard column alignCards.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ update: aSymbol with: aDictionary
ifTrue: [((aDictionary at: 'after') isNil)
ifTrue: [self changeIndexOfColumn: 1]
ifFalse: [self changeIndexOfColumn:
(self board columns
indexOf: (self board columns
detect: [:column | column id = (aDictionary at: 'after')])) + 1]].
(self board indexOfColumn: (aDictionary at: 'after')) + 1]].

((aDictionary at: 'action') = #delete)
ifTrue: [self board removeColumn: self].
Expand Down
8 changes: 5 additions & 3 deletions Squello-Core.package/SPBColumn.class/methodProperties.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"instance" : {
"=" : "jh 7/31/2022 13:04",
"activeCard" : "mcr 8/1/2022 02:30",
"addCard" : "jh 8/3/2022 00:46",
"addCard" : "lo 8/3/2022 12:47",
"addCard:" : "jh 7/29/2022 12:56",
"addCardLocal:" : "lo 8/3/2022 12:50",
"addCardToTop:" : "jh 7/29/2022 12:56",
"addIndicatorAt:" : "lo 8/1/2022 12:20",
"addIndicatorAtBottom" : "NTK 8/3/2022 11:49",
Expand All @@ -21,6 +22,7 @@
"bottomDetection:" : "jh 7/29/2022 12:57",
"buildSingleCard:" : "jh 8/3/2022 00:48",
"cardDropped:Event:" : "jh 7/29/2022 12:57",
"cardFromId:" : "lo 8/3/2022 12:56",
"cardPositions" : "mcr 7/19/2022 19:44",
"cardPositions:" : "mcr 7/19/2022 19:36",
"cards" : "mcr 7/14/2022 13:34",
Expand Down Expand Up @@ -54,12 +56,12 @@
"moveIn:with:" : "tk 7/30/2022 22:16",
"pasteup" : "mcr 7/19/2022 12:22",
"pasteup:" : "jh 7/29/2022 12:58",
"removeFromOldColumn:" : "tk 7/30/2022 21:58",
"removeFromOldColumn:" : "lo 8/3/2022 12:46",
"reorderCards:with:" : "NTK 8/3/2022 11:47",
"rerenderCards" : "tk 7/30/2022 22:16",
"resizeBottomDetection" : "NTK 8/3/2022 12:17",
"resizeToFitCards" : "lo 8/1/2022 13:47",
"title" : "mcr 5/20/2022 14:00",
"title:" : "mcr 5/22/2022 00:09",
"update:with:" : "lo 8/1/2022 14:08",
"update:with:" : "lo 8/3/2022 12:40",
"updateTitle:" : "jh 7/29/2022 11:39" } }

0 comments on commit f7f9277

Please sign in to comment.