Basic adding of information tested.
This commit is contained in:
parent
89591a7c7f
commit
17d32b32ba
@ -18,6 +18,13 @@ Class {
|
|||||||
#category : #Brea
|
#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 }
|
{ #category : #accessing }
|
||||||
BreaMember >> country [
|
BreaMember >> country [
|
||||||
^ country
|
^ country
|
||||||
@ -191,51 +198,51 @@ BreaMember >> htmlInput [
|
|||||||
Fill out the form.
|
Fill out the form.
|
||||||
The fields preceded by [*] are obligatory.
|
The fields preceded by [*] are obligatory.
|
||||||
</p>
|
</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">
|
<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>
|
<label class="mdl-textfield__label" for="givenName">[*]Given Name...</label>
|
||||||
<span class="mdl-textfield__error">Letters and spaces only</span>
|
<span class="mdl-textfield__error">Letters and spaces only</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<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>
|
<label class="mdl-textfield__label" for="familyName">[*]Family Name...</label>
|
||||||
<span class="mdl-textfield__error">Letters and spaces only</span>
|
<span class="mdl-textfield__error">Letters and spaces only</span>
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<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>
|
<label class="mdl-textfield__label" for="email">[*]Email...</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<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>
|
<label class="mdl-textfield__label" for="country">[*]Country...</label>
|
||||||
<span class="mdl-textfield__error">Letters and spaces only</span>
|
<span class="mdl-textfield__error">Letters and spaces only</span>
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<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">
|
<label class="mdl-textfield__label" for="organizations">
|
||||||
[*]Organization(s)</label>
|
[*]Organization(s)</label>
|
||||||
<span class="mdl-textfield__error">Letters and spaces only</span>
|
<span class="mdl-textfield__error">Letters and spaces only</span>
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<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>
|
<label class="mdl-textfield__label" for="website">Personal website...</label>
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<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>
|
<label class="mdl-textfield__label" for="twitter">Twitter...</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<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>
|
<label class="mdl-textfield__label" for="facebook">Facebook...</label>
|
||||||
</div><br>
|
</div><br>
|
||||||
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
|
<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>
|
<label class="mdl-textfield__label" for="tags">Tags (separated with commas)...</label>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
<button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect
|
<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
|
Submit
|
||||||
</button>
|
</button>
|
||||||
</p>
|
</p>
|
||||||
|
@ -22,18 +22,37 @@ BreaWebsite >> fossilRepo: anObject [
|
|||||||
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' }
|
{ #category : #'server handling' }
|
||||||
BreaWebsite >> routes [
|
BreaWebsite >> routes [
|
||||||
"Maybe the first part should be in a separate method."
|
"I define how the website behaves accordingly to particular routes."
|
||||||
self server
|
self server
|
||||||
serveStatic: '/gig/demo' from: '/opt/gig/';
|
serveStatic: '/gig/demo' from: '/opt/gig/';
|
||||||
GET: '/gig/members/test' -> [ :req | BreaMember new renderTestUserAsHtml ];
|
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 }
|
{ #category : #accessing }
|
||||||
BreaWebsite >> server [
|
BreaWebsite >> server [
|
||||||
^ server ifNil: [ server := Teapot configure: { #port ->8080 } ]
|
^ server ifNil: [ server := Teapot configure: { #port ->8080 . #debugMode -> true } ]
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -43,7 +62,7 @@ BreaWebsite >> server: anObject [
|
|||||||
|
|
||||||
{ #category : #'server handling' }
|
{ #category : #'server handling' }
|
||||||
BreaWebsite >> start [
|
BreaWebsite >> start [
|
||||||
"I define the routes and start the server"
|
"I define the config and start the server"
|
||||||
self routes.
|
self routes.
|
||||||
self server start
|
self server start
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user