可棄

Seaside 元件(WAComponent 的子類)需要覆蓋 #renderContentOn:。它是一個 smalltalk 類,可以使用構建應用程式的所有常規方法。在這裡,它委託三種不同的方法。

JQDroppableFunctionalTest>>renderContentOn: html
   self renderInstructionsOn: html.
   self renderInventoryOn: html.
   self renderSelectedOn: html

作為引數,它獲取一個 html 畫布物件,該物件理解與構建 html 和 javascript 相關的訊息。它使用流暢的介面,其中 #with:是傳送到當前畫布上下文的最後一條訊息。

JQDroppableFunctionalTest>>renderInventoryOn: html
   html div class: 'inventory ui-corner-all'; with: [ 
      self colors do: [ :each |
         html div
            class: each;
            passenger: each;
            script: (html jQuery new draggable
               revert: true) ] ]

JQDroppableFunctionalTest>>renderSelectedOn: html
   html div
      class: 'selected ui-corner-all'; 
      script: (html jQuery new droppable
         onDrop: (html jQuery this load
            callbackDroppable: [ :event | 
                self selected add: (event at: #draggable) ];
            html: [ :r | self renderSelectedItemsOn: r ]));
      with: [ self renderSelectedItemsOn: html ]

JQDroppableFunctionalTest>>renderSelectedItemsOn: html
   self selected do: [ :each |
      html div 
         class: each; 
         passenger: each;
         script: (html jQuery new draggable
            onStop: (html jQuery this effect 
               percent: 1; puff; 
               onComplete: (html jQuery this parent load html: [ :r | 
                  self selected remove: each ifAbsent: [ ].
                  self renderSelectedItemsOn: r ]))) ]