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
|
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 }
|
{ #category : #helpers }
|
||||||
BreaMember >> createTestUser [
|
BreaMember >> createTestUser [
|
||||||
^ self class new
|
^ self class new
|
||||||
@ -37,8 +47,8 @@ BreaMember >> createTestUser [
|
|||||||
memberOf: 'HackBo' withWebsite: 'http://hackbo.co/';
|
memberOf: 'HackBo' withWebsite: 'http://hackbo.co/';
|
||||||
memberOf: 'mutabiT' withWebsite: 'http://mutabit.com/';
|
memberOf: 'mutabiT' withWebsite: 'http://mutabit.com/';
|
||||||
website: 'http://test.user';
|
website: 'http://test.user';
|
||||||
email: 'iam@test.user';
|
|
||||||
twitter: '@offrayLC';
|
twitter: '@offrayLC';
|
||||||
|
email: 'iam@test.user';
|
||||||
tags: 'just, a lot, of words, separated, by commas'.
|
tags: 'just, a lot, of words, separated, by commas'.
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -62,6 +72,19 @@ BreaMember >> facebook: aProfileName [
|
|||||||
self webPresence 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 }
|
{ #category : #accessing }
|
||||||
BreaMember >> familyName [
|
BreaMember >> familyName [
|
||||||
^ familyName
|
^ familyName
|
||||||
@ -131,7 +154,6 @@ BreaMember >> htmlOutput [
|
|||||||
{ #category : #public }
|
{ #category : #public }
|
||||||
BreaMember >> htmlOutputTemplate [
|
BreaMember >> htmlOutputTemplate [
|
||||||
"I show the member profile as HTML"
|
"I show the member profile as HTML"
|
||||||
|
|
||||||
^ '<div class="mdl-cell mdl-card mdl-shadow--4dp portfolio-card">
|
^ '<div class="mdl-cell mdl-card mdl-shadow--4dp portfolio-card">
|
||||||
<div class="mdl-card__title">
|
<div class="mdl-card__title">
|
||||||
<h2 class="mdl-card__title-text">{{givenName}} {{familyName}}</h2>
|
<h2 class="mdl-card__title-text">{{givenName}} {{familyName}}</h2>
|
||||||
@ -147,34 +169,14 @@ BreaMember >> htmlOutputTemplate [
|
|||||||
<tr>
|
<tr>
|
||||||
<td class="mdl-data-table__cell--non-numeric"><b>Name</b></td>
|
<td class="mdl-data-table__cell--non-numeric"><b>Name</b></td>
|
||||||
<td class="mdl-data-table__cell--non-numeric">{{givenName}} {{familyName}}</td>
|
<td class="mdl-data-table__cell--non-numeric">{{givenName}} {{familyName}}</td>
|
||||||
</tr>
|
</tr>',
|
||||||
<tr>
|
self countryTemplate,
|
||||||
<td class="mdl-data-table__cell--non-numeric"><b>Country</b></td>
|
self organizationsTemplate,
|
||||||
<td class="mdl-data-table__cell--non-numeric">{{country}}</td>
|
self websiteTemplate,
|
||||||
</tr>
|
self twitterTemplate,
|
||||||
<tr>
|
self facebookTemplate,
|
||||||
<td class="mdl-data-table__cell--non-numeric"><b>Organization(s)</b></td>
|
self tagsTemplate,
|
||||||
<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>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -215,6 +217,19 @@ BreaMember >> organizations: anObject [
|
|||||||
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 }
|
{ #category : #accessing }
|
||||||
BreaMember >> password [
|
BreaMember >> password [
|
||||||
^ password
|
^ password
|
||||||
@ -250,6 +265,18 @@ BreaMember >> tags: anObject [
|
|||||||
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 }
|
{ #category : #accessing }
|
||||||
BreaMember >> twitter [
|
BreaMember >> twitter [
|
||||||
^ self webPresence twitter.
|
^ self webPresence twitter.
|
||||||
@ -262,11 +289,15 @@ BreaMember >> twitter: aProfileName [
|
|||||||
|
|
||||||
{ #category : #public }
|
{ #category : #public }
|
||||||
BreaMember >> twitterTemplate [
|
BreaMember >> twitterTemplate [
|
||||||
^ '<tr>
|
^ '{{#twitter}}
|
||||||
<td class="mdl-data-table__cell--non-numeric"><b>Twitter</b></td>
|
<tr>
|
||||||
<td class="mdl-data-table__cell--non-numeric">
|
<td class="mdl-data-table__cell--non-numeric">
|
||||||
<a href="https://twitter.com/{{twitter}}">{{twitter}}</a></td>
|
<b>Twitter</b></td>
|
||||||
</tr>' asMustacheTemplate value: self
|
<td class="mdl-data-table__cell--non-numeric">
|
||||||
|
<a href="https://twitter.com/{{.}}">
|
||||||
|
{{.}}</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/twitter}}' asMustacheTemplate value: self
|
||||||
]
|
]
|
||||||
|
|
||||||
{ #category : #accessing }
|
{ #category : #accessing }
|
||||||
@ -288,3 +319,14 @@ BreaMember >> website [
|
|||||||
BreaMember >> website: anUrl [
|
BreaMember >> website: anUrl [
|
||||||
self webPresence 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