Mustache templates with dot notation, as indicated by Norbert (see [1]). User template
is separated in subtemplates for better modularity and testability and without any significant performance penalty.
This commit is contained in:
parent
618de553a8
commit
a083e150a8
@ -28,6 +28,16 @@ BreaMember >> country: anObject [
|
||||
country := anObject
|
||||
]
|
||||
|
||||
{ #category : #public }
|
||||
BreaMember >> countryTemplate [
|
||||
^ '{{#country}}
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Country</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">{{.}}</td>
|
||||
</tr>
|
||||
{{/country}}' asMustacheTemplate value: self
|
||||
]
|
||||
|
||||
{ #category : #helpers }
|
||||
BreaMember >> createTestUser [
|
||||
^ self class new
|
||||
@ -37,8 +47,8 @@ BreaMember >> createTestUser [
|
||||
memberOf: 'HackBo' withWebsite: 'http://hackbo.co/';
|
||||
memberOf: 'mutabiT' withWebsite: 'http://mutabit.com/';
|
||||
website: 'http://test.user';
|
||||
email: 'iam@test.user';
|
||||
twitter: '@offrayLC';
|
||||
email: 'iam@test.user';
|
||||
tags: 'just, a lot, of words, separated, by commas'.
|
||||
]
|
||||
|
||||
@ -62,6 +72,19 @@ BreaMember >> facebook: aProfileName [
|
||||
self webPresence facebook: aProfileName
|
||||
]
|
||||
|
||||
{ #category : #public }
|
||||
BreaMember >> facebookTemplate [
|
||||
^ '{{#facebook}}
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">
|
||||
<b>Facebook</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">
|
||||
<a href="https://facebook.com/{{.}}">
|
||||
{{.}}</a></td>
|
||||
</tr>
|
||||
{{/facebook}}' asMustacheTemplate value: self
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaMember >> familyName [
|
||||
^ familyName
|
||||
@ -131,7 +154,6 @@ BreaMember >> htmlOutput [
|
||||
{ #category : #public }
|
||||
BreaMember >> htmlOutputTemplate [
|
||||
"I show the member profile as HTML"
|
||||
|
||||
^ '<div class="mdl-cell mdl-card mdl-shadow--4dp portfolio-card">
|
||||
<div class="mdl-card__title">
|
||||
<h2 class="mdl-card__title-text">{{givenName}} {{familyName}}</h2>
|
||||
@ -147,34 +169,14 @@ BreaMember >> htmlOutputTemplate [
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Name</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">{{givenName}} {{familyName}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Country</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">{{country}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Organization(s)</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">HackBo, mutabiT</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Website</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">
|
||||
<a href="{{website}}">{{website}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{#twitter}}
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Twitter</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">
|
||||
<a href="https://twitter.com/{{twitter}}">{{twitter}}</a></td>
|
||||
</tr>
|
||||
{{/twitter}}
|
||||
<tr>
|
||||
<td colspan="2"; style="text-align:left">
|
||||
<b>Tags</b><br>
|
||||
{{ tags }}
|
||||
</td>
|
||||
</tr>
|
||||
</tr>',
|
||||
self countryTemplate,
|
||||
self organizationsTemplate,
|
||||
self websiteTemplate,
|
||||
self twitterTemplate,
|
||||
self facebookTemplate,
|
||||
self tagsTemplate,
|
||||
'
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
@ -215,6 +217,19 @@ BreaMember >> organizations: anObject [
|
||||
organizations := anObject
|
||||
]
|
||||
|
||||
{ #category : #public }
|
||||
BreaMember >> organizationsTemplate [
|
||||
^ '
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Organization(s)</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">
|
||||
{{#organizations}}
|
||||
<a href="{{website}}">{{name}}</a>
|
||||
{{/organizations}}
|
||||
</td>
|
||||
</tr>' asMustacheTemplate value: self
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaMember >> password [
|
||||
^ password
|
||||
@ -250,6 +265,18 @@ BreaMember >> tags: anObject [
|
||||
tags := anObject
|
||||
]
|
||||
|
||||
{ #category : #public }
|
||||
BreaMember >> tagsTemplate [
|
||||
^ '{{#tags}}
|
||||
<tr>
|
||||
<td colspan="2"; style="text-align:left">
|
||||
<b>Tags</b><br>
|
||||
{{.}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/tags}}' asMustacheTemplate value: self
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
BreaMember >> twitter [
|
||||
^ self webPresence twitter.
|
||||
@ -262,11 +289,15 @@ BreaMember >> twitter: aProfileName [
|
||||
|
||||
{ #category : #public }
|
||||
BreaMember >> twitterTemplate [
|
||||
^ '<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Twitter</b></td>
|
||||
^ '{{#twitter}}
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric">
|
||||
<a href="https://twitter.com/{{twitter}}">{{twitter}}</a></td>
|
||||
</tr>' asMustacheTemplate value: self
|
||||
<b>Twitter</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">
|
||||
<a href="https://twitter.com/{{.}}">
|
||||
{{.}}</a></td>
|
||||
</tr>
|
||||
{{/twitter}}' asMustacheTemplate value: self
|
||||
]
|
||||
|
||||
{ #category : #accessing }
|
||||
@ -288,3 +319,14 @@ BreaMember >> website [
|
||||
BreaMember >> website: anUrl [
|
||||
self webPresence website: anUrl
|
||||
]
|
||||
|
||||
{ #category : #public }
|
||||
BreaMember >> websiteTemplate [
|
||||
^ '{{#website}}
|
||||
<tr>
|
||||
<td class="mdl-data-table__cell--non-numeric"><b>Website</b></td>
|
||||
<td class="mdl-data-table__cell--non-numeric">
|
||||
<a href="{{.}}">{{.}}</a>
|
||||
</td>
|
||||
{{/website}}' asMustacheTemplate value: self
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user