This repository has been archived by the owner on Mar 25, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Guests can now see the koseki page too
- Loading branch information
Showing
7 changed files
with
168 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import Component from 'flarum/Component'; | ||
import avatar from 'flarum/helpers/avatar'; | ||
import username from 'flarum/helpers/username'; | ||
import humanTime from 'flarum/helpers/humanTime'; | ||
import stringToColor from 'flarum/utils/stringToColor'; | ||
import computed from 'flarum/utils/computed'; | ||
export default class LastDiscussionView extends Component { | ||
|
||
init() { | ||
super.init(); | ||
} | ||
|
||
view() { | ||
let tag = this.props.tag; | ||
let discussion = tag.lastDiscussion(); | ||
|
||
if (tag.lastUser() != null) { | ||
let user = { | ||
username: m.prop(tag.lastUser().username), | ||
avatarUrl: tag.lastUser().avatar_path != null ? m.prop('assets/avatars/' + tag.lastUser().avatar_path) : m.prop(), | ||
color: computed('username', 'avatarUrl', 'avatarColor', function(username, avatarUrl, avatarColor) { | ||
if (avatarColor) { | ||
return 'rgb(' + avatarColor.join(', ') + ')'; | ||
} else if (avatarUrl) { | ||
this.calculateAvatarColor(); | ||
return ''; | ||
} | ||
|
||
return '#' + stringToColor(username); | ||
}), | ||
}; | ||
|
||
return ( | ||
<div className="TagChild-last"> | ||
<div className="TagChild-avatar">{ avatar(user) } {' '}</div> | ||
<div className="TagChild-post"> | ||
<a href={ app.route.discussion(discussion, discussion.lastPostNumber()) } className="TagChild-discussion">{ discussion.title() }</a> | ||
|
||
{ app.translator.trans('reflar-koseki.forum.by') } | ||
<a href={ app.route.user(user) } config={ m.route }> | ||
{ username(user) } <i class="fa fa-icon fa-arrow-circle-right"></i> | ||
</a><br/> | ||
<small>{ humanTime(discussion.lastTime()) }</small> | ||
</div> | ||
</div> | ||
); | ||
} else { | ||
return (<div></div>); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters