summaryrefslogtreecommitdiff
path: root/src/web/app/mobile
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-20 16:09:46 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-20 16:09:46 +0900
commitc05abf4da75fce296e5d744ae99e004fe1294642 (patch)
tree4176368740c3465718e3fc87ffbea1a8386ebfe3 /src/web/app/mobile
parentwip (diff)
downloadsharkey-c05abf4da75fce296e5d744ae99e004fe1294642.tar.gz
sharkey-c05abf4da75fce296e5d744ae99e004fe1294642.tar.bz2
sharkey-c05abf4da75fce296e5d744ae99e004fe1294642.zip
wip
Diffstat (limited to 'src/web/app/mobile')
-rw-r--r--src/web/app/mobile/tags/drive.tag16
-rw-r--r--src/web/app/mobile/tags/drive/file-viewer.tag2
-rw-r--r--src/web/app/mobile/tags/follow-button.tag6
-rw-r--r--src/web/app/mobile/tags/home-timeline.tag4
-rw-r--r--src/web/app/mobile/tags/notifications.tag2
-rw-r--r--src/web/app/mobile/tags/page/messaging-room.tag4
-rw-r--r--src/web/app/mobile/tags/page/user-followers.tag4
-rw-r--r--src/web/app/mobile/tags/page/user-following.tag4
-rw-r--r--src/web/app/mobile/tags/post-detail.tag40
-rw-r--r--src/web/app/mobile/tags/post-form.tag8
-rw-r--r--src/web/app/mobile/tags/search-posts.tag6
-rw-r--r--src/web/app/mobile/tags/timeline-post.tag89
-rw-r--r--src/web/app/mobile/tags/timeline.tag4
-rw-r--r--src/web/app/mobile/tags/ui-header.tag4
-rw-r--r--src/web/app/mobile/tags/ui.tag4
-rw-r--r--src/web/app/mobile/tags/user-followers.tag2
-rw-r--r--src/web/app/mobile/tags/user-following.tag2
-rw-r--r--src/web/app/mobile/tags/user-timeline.tag6
-rw-r--r--src/web/app/mobile/tags/user.tag75
19 files changed, 157 insertions, 125 deletions
diff --git a/src/web/app/mobile/tags/drive.tag b/src/web/app/mobile/tags/drive.tag
index d0c9b87b99..8d4383f6ef 100644
--- a/src/web/app/mobile/tags/drive.tag
+++ b/src/web/app/mobile/tags/drive.tag
@@ -206,9 +206,9 @@
this.loading = true
this.update();
- this.api 'drive/folders/show' do
+ this.api('drive/folders/show', {
folder_id: target-folder
- .then (folder) =>
+ }).then((folder) => {
this.folder = folder
this.hierarchyFolders = []
@@ -297,10 +297,10 @@
files-max = 20
// フォルダ一覧取得
- this.api 'drive/folders' do
+ this.api('drive/folders', {
folder_id: if this.folder? then this.folder.id else null
limit: folders-max + 1
- .then (folders) =>
+ }).then((folders) => {
if folders.length == folders-max + 1
this.more-folders = true
folders.pop!
@@ -310,10 +310,10 @@
console.error err
// ファイル一覧取得
- this.api 'drive/files' do
+ this.api('drive/files', {
folder_id: if this.folder? then this.folder.id else null
limit: files-max + 1
- .then (files) =>
+ }).then((files) => {
if files.length == files-max + 1
this.more-files = true
files.pop!
@@ -356,9 +356,9 @@
this.loading = true
this.update();
- this.api 'drive/files/show' do
+ this.api('drive/files/show', {
file_id: file
- .then (file) =>
+ }).then((file) => {
this.file = file
this.folder = null
this.hierarchyFolders = []
diff --git a/src/web/app/mobile/tags/drive/file-viewer.tag b/src/web/app/mobile/tags/drive/file-viewer.tag
index 5f1380ae80..5f2c5f61fb 100644
--- a/src/web/app/mobile/tags/drive/file-viewer.tag
+++ b/src/web/app/mobile/tags/drive/file-viewer.tag
@@ -191,7 +191,7 @@
this.rename = () => {
name = window.prompt '名前を変更' this.file.name
if name? and name != '' and name != this.file.name
- this.api 'drive/files/update' do
+ this.api('drive/files/update', {
file_id: this.file.id
name: name
.then =>
diff --git a/src/web/app/mobile/tags/follow-button.tag b/src/web/app/mobile/tags/follow-button.tag
index ff4c6586d0..ecd0dc594d 100644
--- a/src/web/app/mobile/tags/follow-button.tag
+++ b/src/web/app/mobile/tags/follow-button.tag
@@ -58,7 +58,7 @@
this.wait = false
this.on('mount', () => {
- this.user-promise.then (user) =>
+ this.user-promise}).then((user) => {
this.user = user
this.init = false
this.update();
@@ -82,7 +82,7 @@
this.onclick = () => {
this.wait = true
if this.user.is_following
- this.api 'following/delete' do
+ this.api('following/delete', {
user_id: this.user.id
.then =>
this.user.is_following = false
@@ -92,7 +92,7 @@
this.wait = false
this.update();
else
- this.api 'following/create' do
+ this.api('following/create', {
user_id: this.user.id
.then =>
this.user.is_following = true
diff --git a/src/web/app/mobile/tags/home-timeline.tag b/src/web/app/mobile/tags/home-timeline.tag
index b308c4168c..0d617c841b 100644
--- a/src/web/app/mobile/tags/home-timeline.tag
+++ b/src/web/app/mobile/tags/home-timeline.tag
@@ -11,7 +11,7 @@
this.init = new Promise (res, rej) =>
this.api 'posts/timeline'
- .then (posts) =>
+ }).then((posts) => {
res posts
this.trigger('loaded');
@@ -26,7 +26,7 @@
this.stream.off 'unfollow' this.on-stream-unfollow
this.more = () => {
- this.api 'posts/timeline' do
+ this.api('posts/timeline', {
max_id: this.refs.timeline.tail!.id
this.on-stream-post = (post) => {
diff --git a/src/web/app/mobile/tags/notifications.tag b/src/web/app/mobile/tags/notifications.tag
index ef53c025e3..9fb695a434 100644
--- a/src/web/app/mobile/tags/notifications.tag
+++ b/src/web/app/mobile/tags/notifications.tag
@@ -66,7 +66,7 @@
this.on('mount', () => {
this.api 'i/notifications'
- .then (notifications) =>
+ }).then((notifications) => {
this.notifications = notifications
this.loading = false
this.update();
diff --git a/src/web/app/mobile/tags/page/messaging-room.tag b/src/web/app/mobile/tags/page/messaging-room.tag
index 6b699143ce..934a7f8771 100644
--- a/src/web/app/mobile/tags/page/messaging-room.tag
+++ b/src/web/app/mobile/tags/page/messaging-room.tag
@@ -13,9 +13,9 @@
this.fetching = true
this.on('mount', () => {
- this.api 'users/show' do
+ this.api('users/show', {
username: this.opts.username
- .then (user) =>
+ }).then(user => {
this.fetching = false
this.user = user
this.update();
diff --git a/src/web/app/mobile/tags/page/user-followers.tag b/src/web/app/mobile/tags/page/user-followers.tag
index 12338e7967..75a2c5d279 100644
--- a/src/web/app/mobile/tags/page/user-followers.tag
+++ b/src/web/app/mobile/tags/page/user-followers.tag
@@ -18,9 +18,9 @@
this.on('mount', () => {
this.Progress.start();
- this.api 'users/show' do
+ this.api('users/show', {
username: this.opts.user
- .then (user) =>
+ }).then(user => {
this.user = user
this.fetching = false
diff --git a/src/web/app/mobile/tags/page/user-following.tag b/src/web/app/mobile/tags/page/user-following.tag
index 088c458328..44a054e822 100644
--- a/src/web/app/mobile/tags/page/user-following.tag
+++ b/src/web/app/mobile/tags/page/user-following.tag
@@ -18,9 +18,9 @@
this.on('mount', () => {
this.Progress.start();
- this.api 'users/show' do
+ this.api('users/show', {
username: this.opts.user
- .then (user) =>
+ }).then(user => {
this.user = user
this.fetching = false
diff --git a/src/web/app/mobile/tags/post-detail.tag b/src/web/app/mobile/tags/post-detail.tag
index fee132d7df..61983a1592 100644
--- a/src/web/app/mobile/tags/post-detail.tag
+++ b/src/web/app/mobile/tags/post-detail.tag
@@ -334,15 +334,15 @@
this.mixin('get-post-summary');
this.mixin('open-post-form');
- this.fetching = true
- this.loading-context = false
- this.content = null
- this.post = null
+ this.fetching = true;
+ this.loadingContext = false;
+ this.content = null;
+ this.post = null;
this.on('mount', () => {
- this.api 'posts/show' do
+ this.api('posts/show', {
post_id: this.opts.post
- .then (post) =>
+ }).then((post) => {
this.post = post
this.is-repost = this.post.repost?
this.p = if @is-repost then this.post.repost else this.post
@@ -363,54 +363,54 @@
tokens
.filter (t) -> t.type == 'link'
.map (t) =>
- this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
- riot.mount this.preview, do
+ this.preview = this.refs.text.appendChild(document.createElement('mk-url-preview'));
+ riot.mount this.preview, do
url: t.content
// Get likes
- this.api 'posts/likes' do
+ this.api('posts/likes', {
post_id: this.p.id
limit: 8
- .then (likes) =>
+ }).then((likes) => {
this.likes = likes
this.update();
// Get reposts
- this.api 'posts/reposts' do
+ this.api('posts/reposts', {
post_id: this.p.id
limit: 8
- .then (reposts) =>
+ }).then((reposts) => {
this.reposts = reposts
this.update();
// Get replies
- this.api 'posts/replies' do
+ this.api('posts/replies', {
post_id: this.p.id
limit: 8
- .then (replies) =>
+ }).then((replies) => {
this.replies = replies
this.update();
this.reply = () => {
- @open-post-form do
+ this.openPostForm do
reply: this.p
this.repost = () => {
text = window.prompt '「' + @summary + '」をRepost'
if text?
- this.api 'posts/create' do
+ this.api('posts/create', {
repost_id: this.p.id
text: if text == '' then undefined else text
this.like = () => {
if this.p.is_liked
- this.api 'posts/likes/delete' do
+ this.api('posts/likes/delete', {
post_id: this.p.id
.then =>
this.p.is_liked = false
this.update();
else
- this.api 'posts/likes/create' do
+ this.api('posts/likes/create', {
post_id: this.p.id
.then =>
this.p.is_liked = true
@@ -420,9 +420,9 @@
this.loading-context = true
// Get context
- this.api 'posts/context' do
+ this.api('posts/context', {
post_id: this.p.reply_to_id
- .then (context) =>
+ }).then((context) => {
this.context = context.reverse!
this.loading-context = false
this.update();
diff --git a/src/web/app/mobile/tags/post-form.tag b/src/web/app/mobile/tags/post-form.tag
index 05cb1c5657..43643f88c6 100644
--- a/src/web/app/mobile/tags/post-form.tag
+++ b/src/web/app/mobile/tags/post-form.tag
@@ -220,8 +220,8 @@
this.refs.file.click();
this.select-file-from-drive = () => {
- browser = document.body.appendChild document.createElement 'mk-drive-selector'
- browser = riot.mount browser, do
+ browser = document.body.appendChild(document.createElement('mk-drive-selector'));
+ browser = riot.mount browser, do
multiple: true
.0
browser.on('selected', (files) => {
@@ -260,12 +260,12 @@
then this.files.map (f) -> f.id
else undefined
- this.api 'posts/create' do
+ this.api('posts/create', {
text: this.refs.text.value
media_ids: files
reply_to_id: if this.opts.reply? then this.opts.reply.id else undefined
poll: if this.poll then this.refs.poll.get! else undefined
- .then (data) =>
+ }).then((data) => {
this.trigger('post');
this.unmount();
.catch (err) =>
diff --git a/src/web/app/mobile/tags/search-posts.tag b/src/web/app/mobile/tags/search-posts.tag
index caa0af4be3..83c4b9cfb4 100644
--- a/src/web/app/mobile/tags/search-posts.tag
+++ b/src/web/app/mobile/tags/search-posts.tag
@@ -16,15 +16,15 @@
this.with-media = this.opts.with-media
this.init = new Promise (res, rej) =>
- this.api 'posts/search' do
+ this.api('posts/search', {
query: @query
- .then (posts) =>
+ }).then((posts) => {
res posts
this.trigger('loaded');
this.more = () => {
@offset += @max
- this.api 'posts/search' do
+ this.api('posts/search', {
query: @query
max: @max
offset: @offset
diff --git a/src/web/app/mobile/tags/timeline-post.tag b/src/web/app/mobile/tags/timeline-post.tag
index 2d6a6a1fa4..a19fca7fcd 100644
--- a/src/web/app/mobile/tags/timeline-post.tag
+++ b/src/web/app/mobile/tags/timeline-post.tag
@@ -3,10 +3,19 @@
<mk-timeline-post-sub post={ p.reply_to }></mk-timeline-post-sub>
</div>
<div class="repost" if={ isRepost }>
- <p><a class="avatar-anchor" href={ CONFIG.url + '/' + post.user.username }><img class="avatar" src={ post.user.avatar_url + '?thumbnail&size=64' } alt="avatar"/></a><i class="fa fa-retweet"></i><a class="name" href={ CONFIG.url + '/' + post.user.username }>{ post.user.name }</a>がRepost</p>
+ <p>
+ <a class="avatar-anchor" href={ CONFIG.url + '/' + post.user.username }>
+ <img class="avatar" src={ post.user.avatar_url + '?thumbnail&size=64' } alt="avatar"/>
+ </a>
+ <i class="fa fa-retweet"></i>
+ <a class="name" href={ CONFIG.url + '/' + post.user.username }>{ post.user.name }</a>がRepost
+ </p>
<mk-time time={ post.created_at }></mk-time>
</div>
- <article><a class="avatar-anchor" href={ CONFIG.url + '/' + p.user.username }><img class="avatar" src={ p.user.avatar_url + '?thumbnail&size=96' } alt="avatar"/></a>
+ <article>
+ <a class="avatar-anchor" href={ CONFIG.url + '/' + p.user.username }>
+ <img class="avatar" src={ p.user.avatar_url + '?thumbnail&size=96' } alt="avatar"/>
+ </a>
<div class="main">
<header>
<a class="name" href={ CONFIG.url + '/' + p.user.username }>{ p.user.name }</a>
@@ -289,59 +298,67 @@
this.mixin('api');
this.mixin('text');
this.mixin('get-post-summary');
- this.mixin('open-post-form');
+ this.mixin('openPostForm');
- this.post = this.opts.post
- this.is-repost = this.post.repost? and !this.post.text?
- this.p = if @is-repost then this.post.repost else this.post
- this.summary = @get-post-summary this.p
+ this.post = this.opts.post;
+ this.isRepost = this.post.repost != null && this.post.text == null;
+ this.p = this.isRepost ? this.post.repost : this.post;
+ this.summary = this.getPostSummary(this.p);
this.url = CONFIG.url + '/' + this.p.user.username + '/' + this.p.id
this.on('mount', () => {
- if this.p.text?
- tokens = if this.p._highlight?
- then @analyze this.p._highlight
- else @analyze this.p.text
+ if (this.p.text) {
+ const tokens = this.analyze(this.p.text);
- this.refs.text.innerHTML = this.refs.text.innerHTML.replace '<p class="dummy"></p>' if this.p._highlight?
- then @compile tokens, true, false
- else @compile tokens
+ this.refs.text.innerHTML = this.refs.text.innerHTML.replace('<p class="dummy"></p>', this.compile(tokens));
- this.refs.text.children.forEach (e) =>
- if e.tag-name == 'MK-URL'
- riot.mount e
+ this.refs.text.children.forEach(e => {
+ if (e.tagName == 'MK-URL') riot.mount(e);
+ });
// URLをプレビュー
tokens
- .filter (t) -> t.type == 'link'
- .map (t) =>
- this.preview = this.refs.text.appendChild document.createElement 'mk-url-preview'
- riot.mount this.preview, do
- url: t.content
+ .filter(t => t.type == 'link')
+ .map(t => {
+ riot.mount(this.refs.text.appendChild(document.createElement('mk-url-preview')), {
+ url: t.content
+ });
+ });
+ }
+ });
this.reply = () => {
- @open-post-form do
+ this.openPostForm({
reply: this.p
+ });
+ };
this.repost = () => {
- text = window.prompt '「' + @summary + '」をRepost'
- if text?
- this.api 'posts/create' do
- repost_id: this.p.id
- text: if text == '' then undefined else text
+ const text = window.prompt(`「${this.summary}」をRepost`);
+ if (text) {
+ this.api('posts/create', {
+ repost_id: this.p.id,
+ text: text == '' ? undefined : text
+ });
+ }
+ };
this.like = () => {
- if this.p.is_liked
- this.api 'posts/likes/delete' do
+ if (this.p.is_liked)
+ this.api('posts/likes/delete', {
post_id: this.p.id
- .then =>
- this.p.is_liked = false
+ }).then(() => {
+ this.p.is_liked = false;
this.update();
- else
- this.api 'posts/likes/create' do
+ });
+ } else {
+ this.api('posts/likes/create', {
post_id: this.p.id
- .then =>
- this.p.is_liked = true
+ }).then(() => {
+ this.p.is_liked = true;
this.update();
+ });
+ }
+ };
</script>
</mk-timeline-post>
diff --git a/src/web/app/mobile/tags/timeline.tag b/src/web/app/mobile/tags/timeline.tag
index 3887045e84..06571e40e5 100644
--- a/src/web/app/mobile/tags/timeline.tag
+++ b/src/web/app/mobile/tags/timeline.tag
@@ -80,7 +80,7 @@
this.can-fetch-more = true
this.on('mount', () => {
- this.opts.init.then (posts) =>
+ this.opts.init}).then((posts) => {
this.init = false
@set-posts posts
@@ -95,7 +95,7 @@
if @init or @fetching or this.posts.length == 0 then return
this.fetching = true
this.update();
- this.opts.more!.then (posts) =>
+ this.opts.more!}).then((posts) => {
this.fetching = false
this.prepend-posts posts
diff --git a/src/web/app/mobile/tags/ui-header.tag b/src/web/app/mobile/tags/ui-header.tag
index 6a7ec8ec54..5cf2560d54 100644
--- a/src/web/app/mobile/tags/ui-header.tag
+++ b/src/web/app/mobile/tags/ui-header.tag
@@ -89,7 +89,7 @@
</style>
<script>
this.mixin('ui');
- this.mixin('open-post-form');
+ this.mixin('openPostForm');
this.on('mount', () => {
this.opts.ready!
@@ -99,6 +99,6 @@
this.refs.title.innerHTML = title
this.post = () => {
- @open-post-form!
+ this.openPostForm!
</script>
</mk-ui-header>
diff --git a/src/web/app/mobile/tags/ui.tag b/src/web/app/mobile/tags/ui.tag
index 348c88b77a..ca6ac3f55c 100644
--- a/src/web/app/mobile/tags/ui.tag
+++ b/src/web/app/mobile/tags/ui.tag
@@ -44,8 +44,8 @@
this.refs.nav.root.style.display = if @is-drawer-opening then 'block' else 'none'
this.on-stream-notification = (notification) => {
- el = document.body.appendChild document.createElement 'mk-notify'
- riot.mount el, do
+ el = document.body.appendChild(document.createElement('mk-notify'));
+ riot.mount el, do
notification: notification
</script>
</mk-ui>
diff --git a/src/web/app/mobile/tags/user-followers.tag b/src/web/app/mobile/tags/user-followers.tag
index cdde081dc7..eecf09cab8 100644
--- a/src/web/app/mobile/tags/user-followers.tag
+++ b/src/web/app/mobile/tags/user-followers.tag
@@ -11,7 +11,7 @@
this.user = this.opts.user
this.fetch = (iknow, limit, cursor, cb) => {
- this.api 'users/followers' do
+ this.api('users/followers', {
user_id: this.user.id
iknow: iknow
limit: limit
diff --git a/src/web/app/mobile/tags/user-following.tag b/src/web/app/mobile/tags/user-following.tag
index 37ee0ee390..b214789aa9 100644
--- a/src/web/app/mobile/tags/user-following.tag
+++ b/src/web/app/mobile/tags/user-following.tag
@@ -11,7 +11,7 @@
this.user = this.opts.user
this.fetch = (iknow, limit, cursor, cb) => {
- this.api 'users/following' do
+ this.api('users/following', {
user_id: this.user.id
iknow: iknow
limit: limit
diff --git a/src/web/app/mobile/tags/user-timeline.tag b/src/web/app/mobile/tags/user-timeline.tag
index 80311924fa..2d3716b848 100644
--- a/src/web/app/mobile/tags/user-timeline.tag
+++ b/src/web/app/mobile/tags/user-timeline.tag
@@ -15,15 +15,15 @@
this.with-media = this.opts.with-media
this.init = new Promise (res, rej) =>
- this.api 'users/posts' do
+ this.api('users/posts', {
user_id: this.user.id
with_media: @with-media
- .then (posts) =>
+ }).then((posts) => {
res posts
this.trigger('loaded');
this.more = () => {
- this.api 'users/posts' do
+ this.api('users/posts', {
user_id: this.user.id
with_media: @with-media
max_id: this.refs.timeline.tail!.id
diff --git a/src/web/app/mobile/tags/user.tag b/src/web/app/mobile/tags/user.tag
index 660b08879d..9d95e99144 100644
--- a/src/web/app/mobile/tags/user.tag
+++ b/src/web/app/mobile/tags/user.tag
@@ -3,20 +3,43 @@
<header>
<div class="banner" style={ user.banner_url ? 'background-image: url(' + user.banner_url + '?thumbnail&size=1024)' : '' }></div>
<div class="body">
- <div class="top"><a class="avatar"><img src={ user.avatar_url + '?thumbnail&size=160' } alt="avatar"/></a>
+ <div class="top">
+ <a class="avatar">
+ <img src={ user.avatar_url + '?thumbnail&size=160' } alt="avatar"/>
+ </a>
<mk-follow-button if={ SIGNIN && I.id != user.id } user={ user }></mk-follow-button>
</div>
<div class="title">
- <h1>{ user.name }</h1><span class="username">@{ user.username }</span><span class="followed" if={ user.is_followed }>フォローされています</span>
+ <h1>{ user.name }</h1>
+ <span class="username">@{ user.username }</span>
+ <span class="followed" if={ user.is_followed }>フォローされています</span>
</div>
<div class="bio">{ user.bio }</div>
<div class="info">
- <p class="location" if={ user.location }><i class="fa fa-map-marker"></i>{ user.location }</p>
- <p class="birthday" if={ user.birthday }><i class="fa fa-birthday-cake"></i>{ user.birthday.replace('-', '年').replace('-', '月') + '日' } ({ age(user.birthday) }歳)</p>
+ <p class="location" if={ user.location }>
+ <i class="fa fa-map-marker"></i>{ user.location }
+ </p>
+ <p class="birthday" if={ user.birthday }>
+ <i class="fa fa-birthday-cake"></i>{ user.birthday.replace('-', '年').replace('-', '月') + '日' } ({ age(user.birthday) }歳)
+ </p>
+ </div>
+ <div class="friends">
+ <a href="{ user.username }/following">
+ <b>{ user.following_count }</b>
+ <i>フォロー</i>
+ </a>
+ <a href="{ user.username }/followers">
+ <b>{ user.followers_count }</b>
+ <i>フォロワー</i>
+ </a>
</div>
- <div class="friends"><a href="{ user.username }/following"><b>{ user.following_count }</b><i>フォロー</i></a><a href="{ user.username }/followers"><b>{ user.followers_count }</b><i>フォロワー</i></a></div>
</div>
- <nav><a data-is-active={ page == 'posts' } onclick={ goPosts }>投稿</a><a data-is-active={ page == 'media' } onclick={ goMedia }>メディア</a><a data-is-active={ page == 'graphs' } onclick={ goGraphs }>グラフ</a><a data-is-active={ page == 'likes' } onclick={ goLikes }>いいね</a></nav>
+ <nav>
+ <a data-is-active={ page == 'posts' } onclick={ go.bind(null, 'posts') }>投稿</a>
+ <a data-is-active={ page == 'media' } onclick={ go.bind(null, 'media') }>メディア</a>
+ <a data-is-active={ page == 'graphs' } onclick={ go.bind(null, 'graphs') }>グラフ</a>
+ <a data-is-active={ page == 'likes' } onclick={ go.bind(null, 'likes') }>いいね</a>
+ </nav>
</header>
<div class="body">
<mk-user-timeline if={ page == 'posts' } user={ user }></mk-user-timeline>
@@ -154,38 +177,30 @@
</style>
<script>
- this.age = require 's-age'
+ this.age = require('s-age');
this.mixin('i');
this.mixin('api');
- this.username = this.opts.user
- this.page = if this.opts.page? then this.opts.page else 'posts'
- this.fetching = true
+ this.username = this.opts.user;
+ this.page = this.opts.page ? this.opts.page : 'posts';
+ this.fetching = true;
this.on('mount', () => {
- this.api 'users/show' do
+ this.api('users/show', {
username: this.username
- .then (user) =>
- this.fetching = false
- this.user = user
- this.trigger 'loaded' user
+ }).then(user => {
+ this.fetching = false;
+ this.user = user;
+ this.trigger('loaded', user);
this.update();
+ });
+ });
- this.go-posts = () => {
- this.page = 'posts'
- this.update();
-
- this.go-media = () => {
- this.page = 'media'
- this.update();
-
- this.go-graphs = () => {
- this.page = 'graphs'
- this.update();
-
- this.go-likes = () => {
- this.page = 'likes'
- this.update();
+ this.go = page => {
+ this.update({
+ page: page
+ });
+ };
</script>
</mk-user>