seandenigris / Resources-Live

GNU General Public License v3.0
4 stars 0 forks source link

Library - New Item Spotter #33

Open seandenigris opened 2 years ago

seandenigris commented 2 years ago

Then adapt:

gtSpotterNewFor: aStep
    <gtSearch>
    aStep listProcessor
        title: 'New Resource';
        priority: 50;
        itemName: [ :input | '+ ', input ];
        previewObject: [ :input | LlAuthoredWork new title: input; yourself ];
        wantsToDisplayOnEmptyQuery: false;
        filter: GtNullFilter
            item: [ :filter :context | 
                | isExisting |
                isExisting := self works anySatisfy: [ :e | 
                    e title = context textTrimmed ].
                isExisting ifFalse: [ 
                    filter value: context textTrimmed ] ];
        send: [ :newName :spotterStep | 
            | work |
            work := LlAuthoredWork new title: newName; yourself.
            self beAwareOf: work.
            work ]