Skip to content

Commit

Permalink
ui/routes: fix UserFollowedChannelsRoute
Browse files Browse the repository at this point in the history
- fix infinite-scroll / pagination parameters
- remove controller and query parameters for sorting (unsupported now)
- reformat template
  • Loading branch information
bastimeyer committed Jan 18, 2022
1 parent 1b67400 commit 4b4fed1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 87 deletions.
20 changes: 0 additions & 20 deletions src/app/ui/routes/user/followed-channels/controller.js

This file was deleted.

28 changes: 7 additions & 21 deletions src/app/ui/routes/user/followed-channels/route.js
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
import { getProperties } from "@ember/object";
import UserIndexRoute from "../index/route";
import PaginationMixin from "ui/routes/-mixins/routes/infinite-scroll/pagination";
import RefreshRouteMixin from "ui/routes/-mixins/routes/refresh";


export default UserIndexRoute.extend( PaginationMixin, RefreshRouteMixin, {
modelName: "twitch-user-followed",
modelMapBy: "to",
modelPreload: "profile_image_url",
itemSelector: ".channel-item-component",
modelName: "twitchChannelFollowed",
modelMapBy: "channel",
modelPreload: "logo",

queryParams: {
sortby: {
refreshModel: true
},
direction: {
refreshModel: true
}
},
query() {
const query = this._super();
const { user_id } = this.auth.session;


model({ sortby = "created_at", direction = "desc" }) {
return this._super({ sortby, direction });
},

fetchContent() {
const params = getProperties( this.controller, "sortby", "direction" );

return this.model( params );
return Object.assign( query, { from_id: user_id } );
}
});
62 changes: 16 additions & 46 deletions src/app/ui/routes/user/followed-channels/template.hbs
Original file line number Diff line number Diff line change
@@ -1,48 +1,18 @@
<main class="content content-user content-user-followed-channels">
<header>
<h2>{{t "routes.user.followedChannels.header"}}</h2>
{{headline-totals model.meta.total}}
{{#quick-bar}}
<div class="multibtn sort-method">
{{form-button
action=(action "sortMethod" "created_at")
class=(if (is-equal sortby "created_at") "active")
icon="fa-calendar"
title=(t "routes.user.followedChannels.buttons.sort-by-followed")
}}
{{form-button
action=(action "sortMethod" "last_broadcast")
class=(if (is-equal sortby "last_broadcast") "active")
icon="fa-video-camera"
title=(t "routes.user.followedChannels.buttons.sort-by-broadcast")
}}
{{form-button
action=(action "sortMethod" "login")
class=(if (is-equal sortby "login") "active")
icon="fa-sign-in"
title=(t "routes.user.followedChannels.buttons.sort-by-login")
}}
</div>
<div class="multibtn sort-order">
{{form-button
action=(action "sortOrder" "desc")
class=(if (is-equal direction "desc") "active")
icon="fa-long-arrow-down"
title=(t "routes.user.followedChannels.buttons.sort-desc")
}}
{{form-button
action=(action "sortOrder" "asc")
class=(if (is-equal direction "asc") "active")
icon="fa-long-arrow-up"
title=(t "routes.user.followedChannels.buttons.sort-asc")
}}
</div>
{{quick-bar-homepage}}
{{/quick-bar}}
</header>
{{#content-list model as |item isNewItem isDuplicateItem|}}
{{channel-item content=item isNewItem=isNewItem isDuplicateItem=isDuplicateItem}}
{{else}}
<p>{{t "routes.user.followedChannels.empty"}}</p>
{{/content-list}}
<header>
<h2>{{t "routes.user.followedChannels.header"}}</h2>
{{headline-totals model.meta.total}}
{{#quick-bar}}
{{quick-bar-homepage}}
{{/quick-bar}}
</header>
{{#content-list model as |item isNewItem isDuplicateItem|}}
{{channel-item
content=item
isNewItem=isNewItem
isDuplicateItem=isDuplicateItem
}}
{{else}}
<p>{{t "routes.user.followedChannels.empty"}}</p>
{{/content-list}}
</main>

0 comments on commit 4b4fed1

Please sign in to comment.