【发布时间】:2013-07-17 02:32:52
【问题描述】:
我们的页面呈现如下内容:
有没有办法更好地格式化这个?例如,可能在一列中有标签,而在另一列中有输入?
这是我们代码的 sn-p:
renderContentOn: html
html horizontalRule.
html horizontalRule.
html heading level: 2; with: 'System Warnings & Errors:'.
html horizontalRule.
(SpendingManager warningsFound = false) ifFalse: [
self renderWarnings.
WarningsReport renderContentOn: html.
SpendingManager clearProblemList.
html horizontalRule.
html horizontalRule.
].
html heading level: 2; with: 'Create A Fund:'.
html form: [
html label: 'Code: '.
html textInput
on: #fName of: FundCreator.
html break.
html label: ' Starting Amount: '.
html textInput
on: #amount of: FundCreator.
html break.
html submitButton
callback: [(FundCreator fName = '') ifFalse: [FundCreator createFromUI.]
ifTrue: [SpendingManager addProblem: 'SP0002'].
self renderReport ];
text: 'Create Fund'.
].
html heading level: 2; with: 'Create A GLAC:'.
html form: [
html label: 'Code: '.
html textInput
on: #gName of: GLACCreator.
html break.
html label: ' Debit Fund: '.
html textInput
on: #dFund of: GLACCreator.
html break.
html label: ' Credit Fund: '.
html textInput
on: #cFund of: GLACCreator.
html break.
html label: ' Description: '.
html textInput
on: #descr of: GLACCreator.
html break.
html submitButton
callback: [GLACCreator createFromUI. self renderReport ];
text: 'Create GLAC'.
].
html heading level: 2; with: 'Create a Transaction:'.
html form: [
html label: 'GLAC: '.
html textInput
on: #aGLAC of: TransactionCreator.
html break.
html label: ' Amount: '.
html textInput
on: #amount of: TransactionCreator.
html break.
html submitButton
callback: [TransactionCreator createFromUI. self renderReport ];
text: 'Create Transaction'.
].
【问题讨论】:
-
只是一个讨论:谁发明了
seaside?听起来比写 HTML 更复杂。 -
@ShivanRaptor Avi Bryant 等等。这取决于你定义的复杂。它有点冗长,但通常您会将内容拆分为多个组件。
-
除了样式(你可能想用 CSS 做)之外,你应该考虑把你的代码分成多个组件。
-
@ShivanRaptor 在构建复杂的应用程序时,它比使用 html 或模板语言要简单得多。
标签: html css smalltalk seaside