Moving between pages.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2021-07-16 18:43:48 -05:00
parent ce54a9ac28
commit 2f4898f3f7
3 changed files with 25 additions and 11 deletions

View File

@ -1,5 +0,0 @@
Class {
#name : #GfLeSnippet,
#superclass : #Object,
#category : #LepiterPlugins
}

View File

@ -4,5 +4,29 @@ Extension { #name : #LeSnippet }
LeSnippet >> index [
| uuids |
uuids := self parent children collect: [:each | each uidString ].
^ uuids
uuids doWithIndex: [ :unId :i |
unId = self uidString ifTrue: [ ^ i ]
]
]
{ #category : #'*LepiterPlugins' }
LeSnippet >> moveFrom: originPage to: destinationPage [
| db origin thisSnippet destination |
db := self page database.
destination := db pageNamed: destinationPage.
origin := db pageNamed: originPage.
thisSnippet := origin children at: self index.
origin removeSnippet: thisSnippet.
destination addSnippet: thisSnippet.
]
{ #category : #'*LepiterPlugins' }
LeSnippet >> moveTo: pageName [
| db origin destination thisSnippet |
thisSnippet := self snippetModel.
db := self page database.
destination := db pageNamed: pageName.
origin := db pageNamed: thisSnippet page title.
origin removeSnippet: thisSnippet.
destination addSnippet: thisSnippet.
]

View File

@ -1,5 +0,0 @@
Class {
#name : #LepiterPlugin,
#superclass : #Object,
#category : #LepiterPlugins
}