Basic adding of information tested.
This commit is contained in:
parent
89591a7c7f
commit
17d32b32ba
@ -18,6 +18,13 @@ Class {
|
||||
#category : #Brea
|
||||
}
|
||||
|
||||
{ #category : #converting }
|
||||
BreaMember >> asStonModified [
|
||||
"asSton is generated a core dumped now. This renaming is trying to solve that. Maybe
|
||||
in the offical release it will be solved"
|
||||
^ STON toStringPretty: self
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaMember >> country [
|
||||
^ country
|
||||
@ -191,51 +198,51 @@ BreaMember >> htmlInput [
|
||||
Fill out the form.
|
||||
The fields preceded by [*] are obligatory.
|
||||
</p>
|
||||
<form action="#summit" method="POST" class="">
|
||||
<form enctype="application/x-www-form-urlencoded" action="summit" method="POST" class="">
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" pattern="[A-Z,a-z, ]*" type="text" id="givenName">
|
||||
<input class="mdl-textfield__input" pattern="[A-Z,a-z, ]*" type="text" name="givenName">
|
||||
<label class="mdl-textfield__label" for="givenName">[*]Given Name...</label>
|
||||
<span class="mdl-textfield__error">Letters and spaces only</span>
|
||||
</div>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" pattern="[A-Z,a-z, ]*" type="text" id="familyName">
|
||||
<input class="mdl-textfield__input" pattern="[A-Z,a-z, ]*" type="text" name="familyName">
|
||||
<label class="mdl-textfield__label" for="familyName">[*]Family Name...</label>
|
||||
<span class="mdl-textfield__error">Letters and spaces only</span>
|
||||
</div><br>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="email">
|
||||
<input class="mdl-textfield__input" type="text" name="email">
|
||||
<label class="mdl-textfield__label" for="email">[*]Email...</label>
|
||||
</div>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" pattern="[A-Z,a-z, ]*" type="text" id="country">
|
||||
<input class="mdl-textfield__input" pattern="[A-Z,a-z, ]*" type="text" name="country">
|
||||
<label class="mdl-textfield__label" for="country">[*]Country...</label>
|
||||
<span class="mdl-textfield__error">Letters and spaces only</span>
|
||||
</div><br>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" pattern="[A-Z,a-z, ]*" type="text" id="organizations">
|
||||
<input class="mdl-textfield__input" pattern="[A-Z,a-z, ]*" type="text" name="organizations">
|
||||
<label class="mdl-textfield__label" for="organizations">
|
||||
[*]Organization(s)</label>
|
||||
<span class="mdl-textfield__error">Letters and spaces only</span>
|
||||
</div><br>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="website">
|
||||
<input class="mdl-textfield__input" type="text" name="website">
|
||||
<label class="mdl-textfield__label" for="website">Personal website...</label>
|
||||
</div><br>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="twitter">
|
||||
<input class="mdl-textfield__input" type="text" name="twitter">
|
||||
<label class="mdl-textfield__label" for="twitter">Twitter...</label>
|
||||
</div>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<input class="mdl-textfield__input" type="text" id="facebook">
|
||||
<input class="mdl-textfield__input" type="text" name="facebook">
|
||||
<label class="mdl-textfield__label" for="facebook">Facebook...</label>
|
||||
</div><br>
|
||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
||||
<textarea class="mdl-textfield__input" type="text" rows="5" id="tags"></textarea>
|
||||
<textarea class="mdl-textfield__input" type="text" rows="5" name="tags"></textarea>
|
||||
<label class="mdl-textfield__label" for="tags">Tags (separated with commas)...</label>
|
||||
</div>
|
||||
<p>
|
||||
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect
|
||||
mdl-button--accent" type="submit">
|
||||
mdl-button--accent" type="submit" value="Submit">
|
||||
Submit
|
||||
</button>
|
||||
</p>
|
||||
|
@ -22,18 +22,37 @@ BreaWebsite >> fossilRepo: anObject [
|
||||
fossilRepo := anObject
|
||||
]
|
||||
|
||||
{ #category : #'input processing' }
|
||||
BreaWebsite >> processNewMember: request [
|
||||
| member badRequest |
|
||||
badRequest := [ ^ ZnResponse badRequest: request ].
|
||||
(request hasEntity
|
||||
and: [ request contentType matches: ZnMimeType applicationFormUrlEncoded ])
|
||||
ifFalse: [ badRequest ].
|
||||
member := BreaMember new
|
||||
givenName: (request at: #givenName);
|
||||
familyName: (request at: #familyName);
|
||||
email: (request at: #email);
|
||||
country: (request at: #country);
|
||||
twitter: (request at: #twitter);
|
||||
facebook: (request at: #facebook);
|
||||
tags: (request at: #tags).
|
||||
^ member asStonModified
|
||||
]
|
||||
|
||||
{ #category : #'server handling' }
|
||||
BreaWebsite >> routes [
|
||||
"Maybe the first part should be in a separate method."
|
||||
"I define how the website behaves accordingly to particular routes."
|
||||
self server
|
||||
serveStatic: '/gig/demo' from: '/opt/gig/';
|
||||
GET: '/gig/members/test' -> [ :req | BreaMember new renderTestUserAsHtml ];
|
||||
GET: '/gig/members/add' -> [ :req | BreaMember new htmlInput ]
|
||||
GET: '/gig/members/add' -> [ :req | BreaMember new htmlInput ];
|
||||
POST: '/gig/members/summit' -> [ :req | self processNewMember: req ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaWebsite >> server [
|
||||
^ server ifNil: [ server := Teapot configure: { #port ->8080 } ]
|
||||
^ server ifNil: [ server := Teapot configure: { #port ->8080 . #debugMode -> true } ]
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
@ -43,7 +62,7 @@ BreaWebsite >> server: anObject [
|
||||
|
||||
{ #category : #'server handling' }
|
||||
BreaWebsite >> start [
|
||||
"I define the routes and start the server"
|
||||
"I define the config and start the server"
|
||||
self routes.
|
||||
self server start
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user