You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/dsl-client/hyper-component.md
+149Lines changed: 149 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1430,6 +1430,155 @@ However it gets a little tricky if you are using the react-rails gem. Each vers
1430
1430
npm install react@15.0.2 react-dom@15.0.2 --save
1431
1431
```
1432
1432
1433
+
## Single Page Application CRUD example
1434
+
1435
+
Rails famously used scaffolding for Model CRUD (Create, Read, Update and Delete). There is no scaffolding in Hyperstack today, so here is an example which demonstrates how those simple Rails pages would work in Hyperstack.
1436
+
1437
+
This examples uses components from the [Material UI](https://material-ui.com/) framework but the principals would be similar for any framework (or just HTML elements).
1438
+
1439
+
In this example, we will have a table of users and the ability to add new users or edit a user from the list.
1440
+
1441
+
Firstly the table of users:
1442
+
1443
+
```ruby
1444
+
classUserIndex < HyperComponent
1445
+
render(DIV, class: 'mo-page') do
1446
+
UserDialog(user:User.new) # this will render as a button to add users
1447
+
Tabledo
1448
+
TableHeaddo
1449
+
TableRowdo
1450
+
TableCell { 'Name' }
1451
+
TableCell { 'Gender' }
1452
+
TableCell { 'Edit' }
1453
+
end
1454
+
end
1455
+
TableBodydo
1456
+
user_rows
1457
+
end
1458
+
end
1459
+
end
1460
+
1461
+
defuser_rows
1462
+
User.each do |user| # note User is a Hyperstack model (see later in the Isomorphic section)
0 commit comments