Skip to content

Commit

Permalink
Merge pull request #1365 from SeasideSt/turbo
Browse files Browse the repository at this point in the history
Turbo hotwired
  • Loading branch information
Johan Brichau authored Sep 17, 2023
2 parents c928889 + b9587b4 commit b2d5425
Show file tree
Hide file tree
Showing 286 changed files with 9,448 additions and 340 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ baselinecommon: spec
package: 'Seaside-Tools-Core' with: [
spec requires: #('Seaside-Core' 'Seaside-Component' 'Seaside-RenderLoop' 'Seaside-Session' ). ];
package: 'Seaside-Tools-Web' with: [
spec requires: #('Seaside-Tools-Core' 'Seaside-RenderLoop' 'Seaside-Widgets' ). ];
spec requires: #('Seaside-Tools-Core' 'Seaside-RenderLoop' 'Seaside-Widgets' ) ];
package: 'Seaside-Widgets' with: [
spec requires: #('Seaside-Component' 'Seaside-Canvas' ). ];
spec requires: #('Seaside-Component' 'Seaside-Canvas' ) ];
package: 'Seaside-HotwireTurbo' with: [
spec requires: #('Seaside-Core' 'Seaside-Component' 'Seaside-Canvas') ];
package: 'Seaside-HotwireTurbo-Examples' with: [
spec requires: #('Seaside-HotwireTurbo') ];
package: 'Seaside-Tests-Canvas' with: [
spec requires: #('Seaside-Tests-Core' 'Seaside-Canvas' ). ];
package: 'Seaside-Tests-Component' with: [
Expand Down Expand Up @@ -96,11 +100,12 @@ baselinecommon: spec
spec
group: 'default' with: #('Core' 'JSON' 'Email' 'Javascript' 'JQuery' 'JQueryUI' 'Seaside-Examples' 'Seaside-Welcome');
group: 'OneClick' with: #('Tests' 'Development' 'Zinc');
group: 'CI' with: #('Tests' 'Development Tests');
group: 'CI' with: #('Tests' 'Development Tests' 'Seaside-HotwireTurbo');
group: 'Core' with: #('Seaside-Core' 'Seaside-Continuation' 'Seaside-Canvas' 'Seaside-Session' 'Seaside-Component' 'Seaside-RenderLoop' 'Seaside-Tools-Core' 'Seaside-Flow' 'Seaside-Environment' 'Seaside-Widgets' );
group: 'Tests' with: #('Core' 'Seaside-Tests-Core' 'Seaside-Tests-Canvas' 'Seaside-Tests-Session' 'Seaside-Tests-Component' 'Seaside-Tests-RenderLoop' 'Seaside-Tests-Environment' 'Seaside-Tests-Flow' 'Seaside-Tests-UTF8' 'Seaside-Tests-InternetExplorer' 'Seaside-Tests-Email' 'Seaside-Tests-Examples' 'RSS Tests' 'Welcome Tests' 'REST Tests' 'Swagger Tests' 'Seaside-Tests-Parasol');
group: 'Development' with: #('Core' 'Seaside-Development' );
group: 'Development Tests' with: #('Development' 'Core' 'Seaside-Tests-Development' );
group: 'Hotwired' with: #('Seaside-HotwireTurbo');
group: 'Development' with: #('Core' 'Seaside-Development');
group: 'Development Tests' with: #('Development' 'Core' 'Seaside-Tests-Development');
group: 'Email' with: #('Seaside-Email');
group: 'Examples' with: #('Core' 'Seaside-Examples' 'Seaside-REST-Examples');
group: 'Examples' with: #('Core' 'Seaside-Examples' 'Seaside-REST-Examples' 'Seaside-HotwireTurbo-Examples');
group: 'Base' with: #('Core') ].
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ baselinejquery: spec
spec requires: #('Javascript-Core' ) ];
package: 'JQuery-Tests-Core' with: [
spec requires: #('JQuery-Core' 'Javascript-Tests-Core' 'Seaside-Development' 'Seaside-Tests-Functional' 'Seaside-Ajaxifier-Core') ];
package: 'JQuery-Examples' with: [
spec requires: #('JQuery-Core') ];
package: 'JQuery-JSON' with: [
spec requires: #('JQuery-Core' 'Seaside-JSON-Core') ];
package: 'JQuery-Tests-JSON' with: [
Expand All @@ -16,4 +18,5 @@ baselinejquery: spec
spec
group: 'JQuery' with: #('JQuery-Core' 'JQuery-JSON');
group: 'JQuery Tests' with: #('JQuery-Tests-Core' 'JQuery-Tests-JSON');
group: 'Examples' with: #('JQuery-Examples');
group: 'Tests' with: #( 'JQuery Tests' ) ]
5 changes: 5 additions & 0 deletions repository/JQuery-Examples.package/.filetree
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"separateMethodMetaAndSource" : false,
"noMethodMetaData" : true,
"useCypressPropertiesFile" : true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
initialization
initialize
(WAAdmin register: self asApplicationAt: '/examples/todo-jquery')
exceptionHandler: WADebugErrorHandler;
addLibrary: WAExamplesLibrary
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
actions
addTodo: aString
| newTodo |
newTodo := WATodoWithJQueryItem newWithDescription: aString in: todos.
todos add: newTodo.
^ newTodo
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
children
^ self todos
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialization
initialize
super initialize.
todos := OrderedCollection new.
1 to: 5000 do: [ :index |
self addTodo: 'Task ', index greaseString ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
rendering
renderAddNewTodoOn: html
| newTodo |
html header
id: #header;
with: [
html heading
level: 1;
with: 'todos'.
html textInput
id: #'new-todo';
autofocus;
attributeAt: 'autocomplete' put: 'off';
callback: [ :value | newTodo := self addTodo: value ];
onChange: (html jQuery ajax
serializeThis;
script: [ :s | s << ((s jQuery id: 'todo-list') append: newTodo) ];
onComplete: ((html jQuery id: #'new-todo') value: ''));
placeholder: 'What needs to be done?' ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rendering
renderContentOn: html
html section
id: #todoapp;
with: [
self renderAddNewTodoOn: html.
self renderTodosOn: html ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
rendering
renderTodosOn: html

html section
id: 'main';
with: [
html checkbox
id: 'toggle-all'.
html label
for: 'toggle-all';
with: 'Mark all as complete'.
html unorderedList
id: 'todo-list';
script: (self scriptToTriggerCheckboxToggleOn: html);
script: (self scriptToTriggerRenameOn: html);
script: (self scriptToTriggerEditOn: html);
script: (self scriptToSerializeEditOn: html);
with: [
self todos do: [ :todoItem | todoItem renderOn: html ] ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rendering
scriptToSerializeEditOn: html

| currentItem itemId |
^ html jQuery this
on: 'change'
selector:'.edit'
do: ((
html jQuery ajax
serialize: (html jQuery expression: (JSStream on:'event.target'));
callback: [ :passengers | currentItem := passengers first ]
passengers: ((html jQuery expression: (JSStream on:'event.target')) closest:'li');
callback: [ :id | itemId := id ]
value: (JSStream on:'$(event.target).closest("li").get(0).id');
script: [ :s | s << (((s jQuery id: itemId) find: 'label') html: currentItem description) ];
onComplete: ((((html jQuery expression: (JSStream on: 'event.target')) closest:'li') find: '.edit') hide, (((html jQuery expression: (JSStream on: 'event.target')) closest:'li') find: 'label') show))
asFunction: #(event))
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rendering
scriptToTriggerCheckboxToggleOn: html

^ html jQuery this
on: 'click'
selector: '.toggle'
do: ((html jQuery ajax serializeWithHidden: (html jQuery expression: (JSStream on: 'event.target'))) asFunction: #(event))
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rendering
scriptToTriggerEditOn: html

^ html jQuery this
on: 'click'
selector: '.view>label'
do: (((((html jQuery expression: (JSStream on: 'event.target')) hide closest:'li') find: '.edit') show) asFunction:#(event))
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rendering
scriptToTriggerRenameOn: html

^ html jQuery this
on: 'click'
selector: '.destroy'
do: ((html jQuery ajax
callback: [ :passengers | passengers first remove ]
passengers: (((html jQuery expression: (JSStream on:'event.target')) closest: 'li'));
onComplete: (((html jQuery expression: (JSStream on:'event.target')) closest: 'li') remove)) asFunction: #(event))
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
todos
^ todos
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rendering
updateRoot: aRoot

super updateRoot: aRoot.
aRoot title: 'Seaside-JQuery Todo Demo'.
aRoot stylesheet url: WAExamplesLibrary / #todoCss.
aRoot javascript url: JQDeploymentLibrary / #jQueryJs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"commentStamp" : "",
"super" : "WAExampleComponent",
"category" : "JQuery-Examples",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"todos"
],
"name" : "WATodoWithJQuery",
"type" : "normal"
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
instance creation
newWithDescription: aString in: aCollection
^ self new initializeWithDescription: aString in: aCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
description: anObject
description := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
description
^ description
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
done: anObject
done := anObject
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
done
^ done
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
initialization
initializeWithDescription: aString in: aCollection
self initialize.
self done: false.
self description: aString.
todos := aCollection
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
private
remove
todos remove: self
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
rendering
renderContentOn: html
html listItem
passenger: self;
with: [
html div
class: 'view';
with:[
html checkbox
class: 'toggle';
callback: [ :value | self done: value ];
value: done.
html label: description.
html button
class: 'destroy' ].
html textInput
class: 'edit';
style: 'display:none';
callback: [ :value | self description: value ];
value: description ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"commentStamp" : "",
"super" : "WAComponent",
"category" : "JQuery-Examples",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"todos",
"description",
"done"
],
"name" : "WATodoWithJQueryItem",
"type" : "normal"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SystemOrganization addCategory: #'JQuery-Examples'!
Empty file.
1 change: 1 addition & 0 deletions repository/JQuery-Examples.package/monticello.meta/package
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(name 'JQuery-Examples')
1 change: 1 addition & 0 deletions repository/JQuery-Examples.package/properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*javascript-core
javascript: aString

^ JSStream on: aString
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
attributes
defer
"When set, this boolean attribute provides a hint to the user agent that the script is not going to generate any document content (e.g., no 'document.write' in javascript) and thus, the user agent can continue parsing and rendering."

self attributes at: 'defer' put: true
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
attributes
resourceUrl: aString

self url: (canvas absoluteUrlForResource: aString)
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessing
tag

^ 'script'
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
attributes
type: aString

self attributeAt: 'type' put: aString
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
attributes
url: aString

self attributes at: 'src' put: aString
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
public
with: aString
self attributes
with: aString

self attributes
at: 'type'
ifAbsentPut: [ 'text/javascript' ].
super with: [
aString isNil ifFalse: [
aString ifNotNil: [
self document nextPutAll: aString greaseString ] ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
attributes
dataAttributeAt: aString put: aValue

self attributeAt: 'data-',aString put: aValue
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
attributes
dataAttributeAt: aString put: aValue if: aBoolean

aBoolean ifTrue:[ self dataAttributeAt: aString put: aValue ]
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
accessing
block: aBlock
block := aBlock
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rendering
renderContentOn: html
block value: html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"commentStamp" : "",
"super" : "WAComponent",
"category" : "Seaside-Component-Base",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
"instvars" : [
"block"
],
"name" : "WAPluggablePresenter",
"type" : "normal"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ handle: aRequestContext
callbacks at: key ifPresent: [ :callback |
(callback isEnabledFor: aRequestContext)
ifTrue: [ set add: callback ] ] ].
"Process the callbacks in order of priority"
set sorted do: [ :callback |
callback evaluateWithFieldValues:
(fields allAt: callback key) ]
Loading

0 comments on commit b2d5425

Please sign in to comment.