Migrate `createViewWithBodyClass` helper to components

This commit is contained in:
Robin Ward 2016-11-10 13:33:31 -05:00
parent ecb9574a32
commit 0904ad5537
38 changed files with 683 additions and 621 deletions

View File

@ -0,0 +1,45 @@
import DiscourseURL from 'discourse/lib/url';
// Can add a body class from within a component, also will scroll to the top automatically.
export default Ember.Component.extend({
tagName: 'section',
_scrollTop() {
if (Ember.testing) { return; }
$(document).scrollTop(0);
},
didInsertElement() {
this._super();
const pageClass = this.get('pageClass');
if (pageClass) {
$('body').addClass(`${pageClass}-page`);
}
const bodyClass = this.get('bodyClass');
if (bodyClass) {
$('body').addClass(bodyClass);
}
if (this.get('scrollTop') === "false") {
return;
}
if (DiscourseURL.isJumpScheduled()) { return; }
Ember.run.scheduleOnce('afterRender', this, this._scrollTop);
},
willDestroyElement() {
this._super();
const pageClass = this.get('pageClass');
if (pageClass) {
$('body').removeClass(`${pageClass}-page`);
}
const bodyClass = this.get('bodyClass');
if (bodyClass) {
$('body').removeClass(bodyClass);
}
}
});

View File

@ -1,15 +0,0 @@
import { on } from 'ember-addons/ember-computed-decorators';
export function createViewWithBodyClass(body_class) {
return Ember.View.extend({
@on("didInsertElement")
addBodyClass() {
$('body').addClass(body_class);
},
@on("willDestroyElement")
removeBodyClass() {
$('body').removeClass(body_class);
}
});
}

View File

@ -1,97 +1,99 @@
<div class='container'>
<div class='contents clearfix body-page'>
{{#d-section pageClass="about"}}
<div class='container'>
<div class='contents clearfix body-page'>
<ul class="nav-pills">
<li class="nav-item-about">{{#link-to 'about' class="active"}}{{i18n 'about.simple_title'}}{{/link-to}}</li>
{{#if faqOverriden}}
<li class="nav-item-guidelines">{{#link-to 'guidelines'}}{{i18n 'guidelines'}}{{/link-to}}</li>
<li class="nav-item-faq">{{#link-to 'faq'}}{{i18n 'faq'}}{{/link-to}}</li>
{{else}}
<li class="nav-item-faq">{{#link-to 'faq'}}{{i18n 'faq'}}{{/link-to}}</li>
{{/if}}
<li class="nav-item-tos">{{#link-to 'tos'}}{{i18n 'terms_of_service'}}{{/link-to}}</li>
<li class="nav-item-privacy">{{#link-to 'privacy'}}{{i18n 'privacy'}}{{/link-to}}</li>
</ul>
<section class='about'>
<h2>{{i18n 'about.title' title=model.title}}</h2>
<p>{{model.description}}</p>
</section>
{{#if model.admins}}
<section class='about admins'>
<h3>{{i18n 'about.our_admins'}}</h3>
{{#each model.admins as |a|}}
{{user-info user=a}}
{{/each}}
<div class='clearfix'></div>
<ul class="nav-pills">
<li class="nav-item-about">{{#link-to 'about' class="active"}}{{i18n 'about.simple_title'}}{{/link-to}}</li>
{{#if faqOverriden}}
<li class="nav-item-guidelines">{{#link-to 'guidelines'}}{{i18n 'guidelines'}}{{/link-to}}</li>
<li class="nav-item-faq">{{#link-to 'faq'}}{{i18n 'faq'}}{{/link-to}}</li>
{{else}}
<li class="nav-item-faq">{{#link-to 'faq'}}{{i18n 'faq'}}{{/link-to}}</li>
{{/if}}
<li class="nav-item-tos">{{#link-to 'tos'}}{{i18n 'terms_of_service'}}{{/link-to}}</li>
<li class="nav-item-privacy">{{#link-to 'privacy'}}{{i18n 'privacy'}}{{/link-to}}</li>
</ul>
<section class='about'>
<h2>{{i18n 'about.title' title=model.title}}</h2>
<p>{{model.description}}</p>
</section>
{{/if}}
{{#if model.moderators}}
<section class='about moderators'>
<h3>{{i18n 'about.our_moderators'}}</h3>
{{#if model.admins}}
<section class='about admins'>
<h3>{{i18n 'about.our_admins'}}</h3>
<div class='users'>
{{#each model.moderators as |m|}}
{{user-info user=m}}
{{#each model.admins as |a|}}
{{user-info user=a}}
{{/each}}
</div>
<div class='clearfix'></div>
<div class='clearfix'></div>
</section>
{{/if}}
{{#if model.moderators}}
<section class='about moderators'>
<h3>{{i18n 'about.our_moderators'}}</h3>
<div class='users'>
{{#each model.moderators as |m|}}
{{user-info user=m}}
{{/each}}
</div>
<div class='clearfix'></div>
</section>
{{/if}}
<section class='about stats'>
<h3>{{i18n 'about.stats'}}</h3>
<table class='table'>
<tr>
<th>&nbsp;</th>
<th>{{i18n 'about.stat.all_time'}}</th>
<th>{{i18n 'about.stat.last_7_days'}}</th>
<th>{{i18n 'about.stat.last_30_days'}}</th>
</tr>
<tr>
<td class='title'>{{i18n 'about.topic_count'}}</td>
<td>{{number model.stats.topic_count}}</td>
<td>{{number model.stats.topics_7_days}}</td>
<td>{{number model.stats.topics_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.post_count'}}</td>
<td>{{number model.stats.post_count}}</td>
<td>{{number model.stats.posts_7_days}}</td>
<td>{{number model.stats.posts_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.user_count'}}</td>
<td>{{number model.stats.user_count}}</td>
<td>{{number model.stats.users_7_days}}</td>
<td>{{number model.stats.users_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.active_user_count'}}</td>
<td>&mdash;</td>
<td>{{number model.stats.active_users_7_days}}</td>
<td>{{number model.stats.active_users_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.like_count'}}</td>
<td>{{number model.stats.like_count}}</td>
<td>{{number model.stats.likes_7_days}}</td>
<td>{{number model.stats.likes_30_days}}</td>
</tr>
</table>
</section>
{{/if}}
<section class='about stats'>
<h3>{{i18n 'about.stats'}}</h3>
<table class='table'>
<tr>
<th>&nbsp;</th>
<th>{{i18n 'about.stat.all_time'}}</th>
<th>{{i18n 'about.stat.last_7_days'}}</th>
<th>{{i18n 'about.stat.last_30_days'}}</th>
</tr>
<tr>
<td class='title'>{{i18n 'about.topic_count'}}</td>
<td>{{number model.stats.topic_count}}</td>
<td>{{number model.stats.topics_7_days}}</td>
<td>{{number model.stats.topics_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.post_count'}}</td>
<td>{{number model.stats.post_count}}</td>
<td>{{number model.stats.posts_7_days}}</td>
<td>{{number model.stats.posts_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.user_count'}}</td>
<td>{{number model.stats.user_count}}</td>
<td>{{number model.stats.users_7_days}}</td>
<td>{{number model.stats.users_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.active_user_count'}}</td>
<td>&mdash;</td>
<td>{{number model.stats.active_users_7_days}}</td>
<td>{{number model.stats.active_users_30_days}}</td>
</tr>
<tr>
<td>{{i18n 'about.like_count'}}</td>
<td>{{number model.stats.like_count}}</td>
<td>{{number model.stats.likes_7_days}}</td>
<td>{{number model.stats.likes_30_days}}</td>
</tr>
</table>
</section>
{{#if contactInfo}}
<section class='about contact'>
<h3>{{i18n 'about.contact'}}</h3>
<p>{{{contactInfo}}}</p>
</section>
{{/if}}
{{#if contactInfo}}
<section class='about contact'>
<h3>{{i18n 'about.contact'}}</h3>
<p>{{{contactInfo}}}</p>
</section>
{{/if}}
</div>
</div>
</div>
{{/d-section}}

View File

@ -1,17 +1,19 @@
<div class='container badges'>
<h1>{{i18n 'badges.title'}}</h1>
{{#d-section pageClass="badges"}}
<div class='container badges'>
<h1>{{i18n 'badges.title'}}</h1>
<div class='badge-groups'>
{{#each badgeGroups as |bg|}}
<div class='badge-grouping'>
<div class='title'>
<h3>{{bg.badgeGrouping.displayName}}</h3>
<div class='badge-groups'>
{{#each badgeGroups as |bg|}}
<div class='badge-grouping'>
<div class='title'>
<h3>{{bg.badgeGrouping.displayName}}</h3>
</div>
{{#each bg.badges as |b|}}
{{badge-card badge=b navigateOnClick="true"}}
{{/each}}
</div>
{{#each bg.badges as |b|}}
{{badge-card badge=b navigateOnClick="true"}}
{{/each}}
</div>
{{/each}}
{{/each}}
</div>
</div>
</div>
{{/d-section}}

View File

@ -1,132 +1,134 @@
<div class="search row clearfix">
{{search-text-field value=searchTerm class="full-page-search input-xxlarge search no-blur" action="search" hasAutofocus=hasAutofocus}}
{{d-button action="search" icon="search" class="btn-primary" disabled=searching}}
{{#d-section pageClass="search" class="search-container"}}
<div class="search row clearfix">
{{search-text-field value=searchTerm class="full-page-search input-xxlarge search no-blur" action="search" hasAutofocus=hasAutofocus}}
{{d-button action="search" icon="search" class="btn-primary" disabled=searching}}
<div class='search-advanced'>
<button class="search-advanced-btn btn" {{action "toggleAdvancedSearch"}}>
{{{searchAdvancedIcon}}}
{{i18n "search.advanced.title"}}
</button>
<div class='search-advanced'>
<button class="search-advanced-btn btn" {{action "toggleAdvancedSearch"}}>
{{{searchAdvancedIcon}}}
{{i18n "search.advanced.title"}}
</button>
{{#if expanded}}
{{search-advanced-options searchTerm=searchTerm isExpanded=expanded}}
{{#if expanded}}
{{search-advanced-options searchTerm=searchTerm isExpanded=expanded}}
{{/if}}
</div>
{{#if canCreateTopic}}
<span class="new-topic-btn">{{d-button id="create-topic" class="btn-default" action="createTopic" actionParam=searchTerm icon="plus" label="topic.create"}}</span>
{{/if}}
{{#if canBulkSelect}}
{{d-button icon="list" class="bulk-select" title="topics.bulk.toggle" action="toggleBulkSelect"}}
{{bulk-select-button selected=selected action="search"}}
{{/if}}
</div>
{{#if canCreateTopic}}
<span class="new-topic-btn">{{d-button id="create-topic" class="btn-default" action="createTopic" actionParam=searchTerm icon="plus" label="topic.create"}}</span>
{{/if}}
{{#if canBulkSelect}}
{{d-button icon="list" class="bulk-select" title="topics.bulk.toggle" action="toggleBulkSelect"}}
{{bulk-select-button selected=selected action="search"}}
{{/if}}
</div>
{{#if bulkSelectEnabled}}
<div class='fps-select'>
<a {{action "selectAll"}}>{{i18n "search.select_all"}}</a>
<a {{action "clearAll"}}>{{i18n "search.clear_all"}}</a>
</div>
{{/if}}
{{#if invalidSearch}}
<div class='fps-invalid'>
{{i18n "search.too_short"}}
</div>
{{/if}}
{{#if context}}
<div class='fps-search-context'>
<label>
{{input type="checkbox" name="searchContext" checked=searchContextEnabled}} {{searchContextDescription}}
</label>
</div>
{{/if}}
{{#conditional-loading-spinner condition=loading}}
{{#unless hasResults}}
<h3>
{{#if searchActive}}
{{i18n "search.no_results"}}
{{/if}}
</h3>
{{/unless}}
{{#if hasResults}}
<div class='search-title clearfix'>
<div class='result-count'>
<span>
{{{i18n "search.result_count" count=resultCount term=noSortQ}}}
</span>
</div>
<div class='sort-by'>
<span class='desc'>
{{i18n "search.sort_by"}}
</span>
{{combo-box value=sortOrder content=sortOrders castInteger="true"}}
</div>
{{#if bulkSelectEnabled}}
<div class='fps-select'>
<a {{action "selectAll"}}>{{i18n "search.select_all"}}</a>
<a {{action "clearAll"}}>{{i18n "search.clear_all"}}</a>
</div>
{{/if}}
{{#each model.posts as |result|}}
<div class='fps-result'>
<div class='author'>
<a href={{result.userPath}} data-user-card="{{unbound result.username}}">
{{avatar result imageSize="large"}}
</a>
</div>
{{#if invalidSearch}}
<div class='fps-invalid'>
{{i18n "search.too_short"}}
</div>
{{/if}}
<div class='fps-topic'>
<div class='topic'>
{{#if bulkSelectEnabled}}
{{track-selected selectedList=selected selectedId=result.topic}}
{{/if}}
{{#if context}}
<div class='fps-search-context'>
<label>
{{input type="checkbox" name="searchContext" checked=searchContextEnabled}} {{searchContextDescription}}
</label>
</div>
{{/if}}
<a class='search-link' href='{{unbound result.url}}'>
{{topic-status topic=result.topic disableActions=true}}<span class='topic-title'>{{#highlight-text highlight=q}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}}</span>
</a>
{{#conditional-loading-spinner condition=loading}}
<div class='search-category'>
{{category-link result.topic.category}}
{{#each result.topic.tags as |tag|}}
{{discourse-tag tag}}
{{/each}}
{{plugin-outlet "full-page-search-category"}}
</div>
</div>
<div class='blurb container'>
<span class='date'>
{{format-age result.created_at}}
{{#if result.blurb}}
-
{{/if}}
</span>
{{#if result.blurb}}
{{#highlight-text highlight=q}}
{{{unbound result.blurb}}}
{{/highlight-text}}
{{/if}}
</div>
{{#if showLikeCount}}
{{#if result.like_count}}
<span class='like-count'>
{{result.like_count}} {{fa-icon "heart"}}
</span>
{{/if}}
{{#unless hasResults}}
<h3>
{{#if searchActive}}
{{i18n "search.no_results"}}
{{/if}}
</h3>
{{/unless}}
{{#if hasResults}}
<div class='search-title clearfix'>
<div class='result-count'>
<span>
{{{i18n "search.result_count" count=resultCount term=noSortQ}}}
</span>
</div>
<div class='sort-by'>
<span class='desc'>
{{i18n "search.sort_by"}}
</span>
{{combo-box value=sortOrder content=sortOrders castInteger="true"}}
</div>
</div>
</div>
{{/each}}
{{/if}}
{{#if hasResults}}
<h3 class="search-footer">
{{i18n "search.no_more_results"}}
</h3>
{{/if}}
{{#each model.posts as |result|}}
<div class='fps-result'>
<div class='author'>
<a href={{result.userPath}} data-user-card="{{unbound result.username}}">
{{avatar result imageSize="large"}}
</a>
</div>
{{/conditional-loading-spinner}}
<div class='fps-topic'>
<div class='topic'>
{{#if bulkSelectEnabled}}
{{track-selected selectedList=selected selectedId=result.topic}}
{{/if}}
<a class='search-link' href='{{unbound result.url}}'>
{{topic-status topic=result.topic disableActions=true}}<span class='topic-title'>{{#highlight-text highlight=q}}{{{unbound result.topic.fancyTitle}}}{{/highlight-text}}</span>
</a>
<div class='search-category'>
{{category-link result.topic.category}}
{{#each result.topic.tags as |tag|}}
{{discourse-tag tag}}
{{/each}}
{{plugin-outlet "full-page-search-category"}}
</div>
</div>
<div class='blurb container'>
<span class='date'>
{{format-age result.created_at}}
{{#if result.blurb}}
-
{{/if}}
</span>
{{#if result.blurb}}
{{#highlight-text highlight=q}}
{{{unbound result.blurb}}}
{{/highlight-text}}
{{/if}}
</div>
{{#if showLikeCount}}
{{#if result.like_count}}
<span class='like-count'>
{{result.like_count}} {{fa-icon "heart"}}
</span>
{{/if}}
{{/if}}
</div>
</div>
{{/each}}
{{#if hasResults}}
<h3 class="search-footer">
{{i18n "search.no_more_results"}}
</h3>
{{/if}}
{{/conditional-loading-spinner}}
{{/d-section}}

View File

@ -1,7 +1,9 @@
{{bread-crumbs categories=categories}}
{{#d-section bodyClass="navigation-topics" scrollTop="false"}}
{{bread-crumbs categories=categories}}
{{navigation-bar navItems=navItems filterMode=filterMode}}
{{navigation-bar navItems=navItems filterMode=filterMode}}
{{#if canCreateTopic}}
<button id="create-topic" class='btn btn-default' {{action "createTopic"}}><i class='fa fa-plus'></i>{{i18n 'topic.create'}}</button>
{{/if}}
{{#if canCreateTopic}}
<button id="create-topic" class='btn btn-default' {{action "createTopic"}}><i class='fa fa-plus'></i>{{i18n 'topic.create'}}</button>
{{/if}}
{{/d-section}}

View File

@ -1,4 +1,4 @@
<section class='user-content user-preferences'>
{{#d-section pageClass="user-preferences" class="user-content user-preferences"}}
<form class="form-horizontal">
@ -367,4 +367,4 @@
</div>
{{/if}}
</form>
</section>
{{/d-section}}

View File

@ -1,9 +1,11 @@
<div class="container list-container">
<div class="row">
<div class="full-width">
<div id='list-area'>
{{outlet}}
{{#d-section pageClass="tags"}}
<div class="container list-container">
<div class="row">
<div class="full-width">
<div id='list-area'>
{{outlet}}
</div>
</div>
</div>
</div>
</div>
{{/d-section}}

View File

@ -1,109 +1,111 @@
{{#if canInviteToForum}}
{{#load-more class="paginated-topics-list" selector=".paginated-topics-list .user-invite-list tr" action="loadMore"}}
<section class='user-content'>
<h2>{{i18n 'user.invited.title'}}</h2>
{{#d-section pageClass="user-invites"}}
{{#if canInviteToForum}}
{{#load-more class="paginated-topics-list" selector=".paginated-topics-list .user-invite-list tr" action="loadMore"}}
<section class='user-content'>
<h2>{{i18n 'user.invited.title'}}</h2>
{{#if model.can_see_invite_details}}
<div class='user-invite-controls'>
<div class='span15'>
<ul class="nav nav-pills">
{{nav-item route='userInvited.show' routeParam='pending' i18nLabel=pendingLabel}}
{{nav-item route='userInvited.show' routeParam='redeemed' i18nLabel=redeemedLabel}}
</ul>
</div>
{{#if model.can_see_invite_details}}
<div class='user-invite-controls'>
<div class='span15'>
<ul class="nav nav-pills">
{{nav-item route='userInvited.show' routeParam='pending' i18nLabel=pendingLabel}}
{{nav-item route='userInvited.show' routeParam='redeemed' i18nLabel=redeemedLabel}}
</ul>
</div>
<div class="pull-right">
{{d-button icon="plus" action="showInvite" label="user.invited.create" class="btn"}}
{{#if canBulkInvite}}
{{resumable-upload target="/invites/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}}
{{/if}}
{{#if showReinviteAllButton}}
{{#if reinvitedAll}}
{{i18n 'user.invited.reinvited_all'}}
{{else}}
{{d-button icon="refresh" action="reinviteAll" class="btn" label="user.invited.reinvite_all"}}
<div class="pull-right">
{{d-button icon="plus" action="showInvite" label="user.invited.create" class="btn"}}
{{#if canBulkInvite}}
{{resumable-upload target="/invites/upload" success="uploadSuccess" error="uploadError" uploadText=uploadText}}
{{/if}}
{{/if}}
</div>
</div>
{{/if}}
{{#if showSearch}}
<div class="user-invite-search">
<form>{{text-field value=searchTerm placeholderKey="user.invited.search"}}</form>
</div>
{{/if}}
{{#if model.invites}}
<table class='table user-invite-list'>
<tr>
{{#if inviteRedeemed}}
<th>{{i18n 'user.invited.user'}}</th>
<th>{{i18n 'user.invited.redeemed_at'}}</th>
{{#if model.can_see_invite_details}}
<th>{{i18n 'user.last_seen'}}</th>
<th>{{i18n 'user.invited.topics_entered'}}</th>
<th>{{i18n 'user.invited.posts_read_count'}}</th>
<th>{{i18n 'user.invited.time_read'}}</th>
<th>{{i18n 'user.invited.days_visited'}}</th>
{{#if showReinviteAllButton}}
{{#if reinvitedAll}}
{{i18n 'user.invited.reinvited_all'}}
{{else}}
{{d-button icon="refresh" action="reinviteAll" class="btn" label="user.invited.reinvite_all"}}
{{/if}}
{{/if}}
{{else}}
<th colspan="1">{{i18n 'user.invited.user'}}</th>
<th colspan="6">{{i18n 'user.invited.sent'}}</th>
{{/if}}
</tr>
{{#each model.invites as |invite|}}
</div>
</div>
{{/if}}
{{#if showSearch}}
<div class="user-invite-search">
<form>{{text-field value=searchTerm placeholderKey="user.invited.search"}}</form>
</div>
{{/if}}
{{#if model.invites}}
<table class='table user-invite-list'>
<tr>
{{#if invite.user}}
<td>
{{#link-to 'user' invite.user}}{{avatar invite.user imageSize="tiny"}}{{/link-to}}
{{#link-to 'user' invite.user}}{{invite.user.username}}{{/link-to}}
</td>
<td>{{format-date invite.redeemed_at}}</td>
{{#if inviteRedeemed}}
<th>{{i18n 'user.invited.user'}}</th>
<th>{{i18n 'user.invited.redeemed_at'}}</th>
{{#if model.can_see_invite_details}}
<td>{{format-date invite.user.last_seen_at}}</td>
<td>{{number invite.user.topics_entered}}</td>
<td>{{number invite.user.posts_read_count}}</td>
<td>{{{unbound invite.user.time_read}}}</td>
<td><span title="{{i18n 'user.invited.days_visited'}}">{{{unbound invite.user.days_visited}}}</span>
/
<span title="{{i18n 'user.invited.account_age_days'}}">{{{unbound invite.user.days_since_created}}}</span></td>
<th>{{i18n 'user.last_seen'}}</th>
<th>{{i18n 'user.invited.topics_entered'}}</th>
<th>{{i18n 'user.invited.posts_read_count'}}</th>
<th>{{i18n 'user.invited.time_read'}}</th>
<th>{{i18n 'user.invited.days_visited'}}</th>
{{/if}}
{{else}}
<td>{{unbound invite.email}}</td>
<td>{{format-date invite.created_at}}</td>
<td colspan='5'>
{{#if invite.expired}}
{{i18n 'user.invited.expired'}}
&nbsp;&nbsp;&nbsp;&nbsp;
{{/if}}
{{#if invite.rescinded}}
{{i18n 'user.invited.rescinded'}}
{{else}}
{{d-button icon="times" action="rescind" actionParam=invite class="btn" label="user.invited.rescind"}}
{{/if}}
&nbsp;&nbsp;&nbsp;&nbsp;
{{#if invite.reinvited}}
{{i18n 'user.invited.reinvited'}}
{{else}}
{{d-button icon="refresh" action="reinvite" actionParam=invite class="btn" label="user.invited.reinvite"}}
{{/if}}
</td>
<th colspan="1">{{i18n 'user.invited.user'}}</th>
<th colspan="6">{{i18n 'user.invited.sent'}}</th>
{{/if}}
</tr>
{{/each}}
</table>
{{conditional-loading-spinner condition=invitesLoading}}
{{#each model.invites as |invite|}}
<tr>
{{#if invite.user}}
<td>
{{#link-to 'user' invite.user}}{{avatar invite.user imageSize="tiny"}}{{/link-to}}
{{#link-to 'user' invite.user}}{{invite.user.username}}{{/link-to}}
</td>
<td>{{format-date invite.redeemed_at}}</td>
{{#if model.can_see_invite_details}}
<td>{{format-date invite.user.last_seen_at}}</td>
<td>{{number invite.user.topics_entered}}</td>
<td>{{number invite.user.posts_read_count}}</td>
<td>{{{unbound invite.user.time_read}}}</td>
<td><span title="{{i18n 'user.invited.days_visited'}}">{{{unbound invite.user.days_visited}}}</span>
/
<span title="{{i18n 'user.invited.account_age_days'}}">{{{unbound invite.user.days_since_created}}}</span></td>
{{/if}}
{{else}}
<td>{{unbound invite.email}}</td>
<td>{{format-date invite.created_at}}</td>
<td colspan='5'>
{{#if invite.expired}}
{{i18n 'user.invited.expired'}}
&nbsp;&nbsp;&nbsp;&nbsp;
{{/if}}
{{#if invite.rescinded}}
{{i18n 'user.invited.rescinded'}}
{{else}}
{{d-button icon="times" action="rescind" actionParam=invite class="btn" label="user.invited.rescind"}}
{{/if}}
&nbsp;&nbsp;&nbsp;&nbsp;
{{#if invite.reinvited}}
{{i18n 'user.invited.reinvited'}}
{{else}}
{{d-button icon="refresh" action="reinvite" actionParam=invite class="btn" label="user.invited.reinvite"}}
{{/if}}
</td>
{{/if}}
</tr>
{{/each}}
</table>
{{conditional-loading-spinner condition=invitesLoading}}
{{else}}
<div class="user-invite-none">
{{#if canBulkInvite}}
{{{i18n 'user.invited.bulk_invite.none'}}}
{{else}}
{{i18n 'user.invited.none'}}
{{/if}}
</div>
{{/if}}
</section>
{{/load-more}}
{{/if}}
{{else}}
<div class="user-invite-none">
{{#if canBulkInvite}}
{{{i18n 'user.invited.bulk_invite.none'}}}
{{else}}
{{i18n 'user.invited.none'}}
{{/if}}
</div>
{{/if}}
</section>
{{/load-more}}
{{/if}}
{{/d-section}}

View File

@ -1,4 +1,4 @@
<section class='user-navigation'>
{{#d-section pageClass="user-activity" class="user-nagivation" scrollTop="false"}}
{{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=currentPath}}
<li class='no-glyph'>
{{#link-to 'userActivity.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
@ -31,10 +31,8 @@
{{d-button action="exportUserArchive" label="user.download_archive" icon="download"}}
</div>
{{/if}}
</section>
{{/d-section}}
<section class='user-right'>
{{outlet}}
{{outlet}}
</section>

View File

@ -1,5 +1,5 @@
<section class='user-content user-badges-list'>
{{#d-section pageClass="user-badges" class="user-content user-badges-list"}}
{{#each sortedBadges as |ub|}}
{{badge-card badge=ub.badge count=ub.count navigateOnClick="true" username=username}}
{{/each}}
</section>
{{/d-section}}

View File

@ -1,4 +1,4 @@
<section class='user-navigation'>
{{#d-section class="user-navigation" pageClass="user-messages"}}
{{#unless site.mobileView}}
{{#if showNewPM}}
{{d-button class="btn-primary new-private-message" action="composePrivateMessage" icon="envelope" label="user.new_private_message"}}
@ -37,8 +37,7 @@
{{/if}}
{{/each}}
{{/mobile-nav}}
</section>
{{/d-section}}
<section class='user-right messages'>

View File

@ -1,4 +1,4 @@
<section class='user-navigation'>
{{#d-section pageClass="user-notifications" class="user-notifications"}}
{{#mobile-nav class='notifications-nav' desktopClass='notification-list action-list nav-stacked' currentPath=application.currentPath}}
<li class='no-glyph'>
{{#link-to 'userNotifications.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
@ -26,7 +26,7 @@
icon='check'
disabled=allNotificationsRead}}
{{/if}}
</section>
{{/d-section}}
<section class='user-right'>
{{#load-more class="notification-history user-stream" selector=".user-stream .notification" action="loadMore"}}

View File

@ -1,185 +1,187 @@
<div class='top-section stats-section'>
<h3 class='stats-title'>{{i18n "user.summary.stats"}}</h3>
<ul>
<li>
{{user-stat value=model.days_visited label="user.summary.days_visited"}}
</li>
<li>
<span class='value'>{{model.time_read}}</span>
<span class='label'>{{{i18n "user.summary.time_read"}}}</span>
</li>
<li>
{{user-stat value=model.posts_read_count label="user.summary.posts_read"}}
</li>
<li class="linked-stat">
{{#link-to 'userActivity.likesGiven'}}
{{user-stat value=model.likes_given label="user.summary.likes_given"}}
{{/link-to}}
</li>
{{#if model.bookmark_count}}
{{#d-section pageClass="user-summary"}}
<div class='top-section stats-section'>
<h3 class='stats-title'>{{i18n "user.summary.stats"}}</h3>
<ul>
<li>
{{user-stat value=model.days_visited label="user.summary.days_visited"}}
</li>
<li>
<span class='value'>{{model.time_read}}</span>
<span class='label'>{{{i18n "user.summary.time_read"}}}</span>
</li>
<li>
{{user-stat value=model.posts_read_count label="user.summary.posts_read"}}
</li>
<li class="linked-stat">
{{#link-to 'userActivity.bookmarks'}}
{{user-stat value=model.bookmark_count label="user.summary.bookmark_count"}}
{{#link-to 'userActivity.likesGiven'}}
{{user-stat value=model.likes_given label="user.summary.likes_given"}}
{{/link-to}}
</li>
{{/if}}
<li class="linked-stat">
{{#link-to 'userActivity.topics'}}
{{user-stat value=model.topic_count label="user.summary.topic_count"}}
{{/link-to}}
</li>
<li class="linked-stat">
{{#link-to 'userActivity.replies'}}
{{user-stat value=model.post_count label="user.summary.post_count"}}
{{/link-to}}
</li>
<li>
{{user-stat value=model.likes_received label="user.summary.likes_received"}}
</li>
</ul>
</div>
<div class='top-section'>
<div class='top-sub-section replies-section pull-left'>
<h3 class='stats-title'>{{i18n "user.summary.top_replies"}}</h3>
{{#if model.replies.length}}
<ul>
{{#each model.replies as |reply|}}
<li>
<span class='topic-info'>
{{format-date reply.createdAt format="tiny" noTitle="true"}}
{{#if reply.like_count}}
&middot;
{{fa-icon 'heart'}}&nbsp;<span class='like-count'>{{number reply.like_count}}</span>
{{/if}}
</span>
<br>
<a href="{{unbound reply.url}}">{{{reply.topic.fancyTitle}}}</a>
</li>
{{/each}}
</ul>
{{#if moreReplies}}
<p>{{#link-to "userActivity.replies" user class="more"}}{{i18n "user.summary.more_replies"}}{{/link-to}}</p>
{{#if model.bookmark_count}}
<li class="linked-stat">
{{#link-to 'userActivity.bookmarks'}}
{{user-stat value=model.bookmark_count label="user.summary.bookmark_count"}}
{{/link-to}}
</li>
{{/if}}
{{else}}
<p>{{i18n "user.summary.no_replies"}}</p>
{{/if}}
<li class="linked-stat">
{{#link-to 'userActivity.topics'}}
{{user-stat value=model.topic_count label="user.summary.topic_count"}}
{{/link-to}}
</li>
<li class="linked-stat">
{{#link-to 'userActivity.replies'}}
{{user-stat value=model.post_count label="user.summary.post_count"}}
{{/link-to}}
</li>
<li>
{{user-stat value=model.likes_received label="user.summary.likes_received"}}
</li>
</ul>
</div>
<div class='top-sub-section topics-section pull-right'>
<h3 class='stats-title'>{{i18n "user.summary.top_topics"}}</h3>
{{#if model.topics.length}}
<ul>
{{#each model.topics as |topic|}}
<li>
<span class='topic-info'>
{{format-date topic.createdAt format="tiny" noTitle="true"}}
{{#if topic.like_count}}
&middot;
{{fa-icon 'heart'}}&nbsp;<span class='like-count'>{{number topic.like_count}}</span>
{{/if}}
</span>
<br>
<a href="{{unbound topic.url}}">{{{topic.fancyTitle}}}</a>
</li>
{{/each}}
</ul>
{{#if moreTopics}}
<p>{{#link-to "userActivity.topics" user class="more"}}{{i18n "user.summary.more_topics"}}{{/link-to}}</p>
<div class='top-section'>
<div class='top-sub-section replies-section pull-left'>
<h3 class='stats-title'>{{i18n "user.summary.top_replies"}}</h3>
{{#if model.replies.length}}
<ul>
{{#each model.replies as |reply|}}
<li>
<span class='topic-info'>
{{format-date reply.createdAt format="tiny" noTitle="true"}}
{{#if reply.like_count}}
&middot;
{{fa-icon 'heart'}}&nbsp;<span class='like-count'>{{number reply.like_count}}</span>
{{/if}}
</span>
<br>
<a href="{{unbound reply.url}}">{{{reply.topic.fancyTitle}}}</a>
</li>
{{/each}}
</ul>
{{#if moreReplies}}
<p>{{#link-to "userActivity.replies" user class="more"}}{{i18n "user.summary.more_replies"}}{{/link-to}}</p>
{{/if}}
{{else}}
<p>{{i18n "user.summary.no_replies"}}</p>
{{/if}}
{{else}}
<p>{{i18n "user.summary.no_topics"}}</p>
{{/if}}
</div>
<div class='top-sub-section topics-section pull-right'>
<h3 class='stats-title'>{{i18n "user.summary.top_topics"}}</h3>
{{#if model.topics.length}}
<ul>
{{#each model.topics as |topic|}}
<li>
<span class='topic-info'>
{{format-date topic.createdAt format="tiny" noTitle="true"}}
{{#if topic.like_count}}
&middot;
{{fa-icon 'heart'}}&nbsp;<span class='like-count'>{{number topic.like_count}}</span>
{{/if}}
</span>
<br>
<a href="{{unbound topic.url}}">{{{topic.fancyTitle}}}</a>
</li>
{{/each}}
</ul>
{{#if moreTopics}}
<p>{{#link-to "userActivity.topics" user class="more"}}{{i18n "user.summary.more_topics"}}{{/link-to}}</p>
{{/if}}
{{else}}
<p>{{i18n "user.summary.no_topics"}}</p>
{{/if}}
</div>
</div>
</div>
<div class='top-section'>
<div class='top-sub-section links-section pull-left'>
<h3 class='stats-title'>{{i18n "user.summary.top_links"}}</h3>
{{#if model.links.length}}
<ul>
{{#each model.links as |link|}}
<li>
<a class='domain'
href='{{unbound link.url}}'
title='{{unbound link.title}}'
rel='{{unless user.removeNoFollow 'nofollow'}}'
target='_blank'>
{{shorten-url link.url}}
</a>
<span class='badge badge-notification clicks' title='{{i18n 'topic_map.clicks' count=link.clicks}}'>{{number link.clicks}}</span>
<br>
<a href="{{unbound link.post_url}}">{{{link.topic.fancyTitle}}}</a>
</li>
{{/each}}
</ul>
{{else}}
<p>{{i18n "user.summary.no_links"}}</p>
{{/if}}
<div class='top-section'>
<div class='top-sub-section links-section pull-left'>
<h3 class='stats-title'>{{i18n "user.summary.top_links"}}</h3>
{{#if model.links.length}}
<ul>
{{#each model.links as |link|}}
<li>
<a class='domain'
href='{{unbound link.url}}'
title='{{unbound link.title}}'
rel='{{unless user.removeNoFollow 'nofollow'}}'
target='_blank'>
{{shorten-url link.url}}
</a>
<span class='badge badge-notification clicks' title='{{i18n 'topic_map.clicks' count=link.clicks}}'>{{number link.clicks}}</span>
<br>
<a href="{{unbound link.post_url}}">{{{link.topic.fancyTitle}}}</a>
</li>
{{/each}}
</ul>
{{else}}
<p>{{i18n "user.summary.no_links"}}</p>
{{/if}}
</div>
<div class='top-sub-section likes-section pull-right'>
<h3 class='stats-title'>{{i18n "user.summary.most_replied_to_users"}}</h3>
{{#if model.most_replied_to_users.length}}
<ul>
{{#each model.most_replied_to_users as |user|}}
<li>
{{#user-info user=user}}
{{fa-icon "reply"}}
<span class='replies'>{{number user.count}}</span>
{{/user-info}}
</li>
{{/each}}
</ul>
{{else}}
<p>{{i18n "user.summary.no_replies"}}</p>
{{/if}}
</div>
</div>
<div class='top-sub-section likes-section pull-right'>
<h3 class='stats-title'>{{i18n "user.summary.most_replied_to_users"}}</h3>
{{#if model.most_replied_to_users.length}}
<ul>
{{#each model.most_replied_to_users as |user|}}
<li>
{{#user-info user=user}}
{{fa-icon "reply"}}
<span class='replies'>{{number user.count}}</span>
{{/user-info}}
</li>
{{/each}}
</ul>
{{else}}
<p>{{i18n "user.summary.no_replies"}}</p>
{{/if}}
</div>
</div>
<div class='top-section'>
<div class='top-sub-section likes-section pull-left'>
<h3 class='stats-title'>{{i18n "user.summary.most_liked_by"}}</h3>
{{#if model.most_liked_by_users.length}}
<ul>
{{#each model.most_liked_by_users as |user|}}
<li>
{{#user-info user=user}}
{{fa-icon "heart"}}
<span class='likes'>{{number user.count}}</span>
{{/user-info}}
</li>
{{/each}}
</ul>
{{else}}
<p>{{i18n "user.summary.no_likes"}}</p>
{{/if}}
<div class='top-section'>
<div class='top-sub-section likes-section pull-left'>
<h3 class='stats-title'>{{i18n "user.summary.most_liked_by"}}</h3>
{{#if model.most_liked_by_users.length}}
<ul>
{{#each model.most_liked_by_users as |user|}}
<li>
{{#user-info user=user}}
{{fa-icon "heart"}}
<span class='likes'>{{number user.count}}</span>
{{/user-info}}
</li>
{{/each}}
</ul>
{{else}}
<p>{{i18n "user.summary.no_likes"}}</p>
{{/if}}
</div>
<div class='top-sub-section likes-section pull-right'>
<h3 class='stats-title'>{{i18n "user.summary.most_liked_users"}}</h3>
{{#if model.most_liked_users.length}}
<ul>
{{#each model.most_liked_users as |user|}}
<li>
{{#user-info user=user}}
{{fa-icon "heart"}}
<span class='likes'>{{number user.count}}</span>
{{/user-info}}
</li>
{{/each}}
</ul>
{{else}}
<p>{{i18n "user.summary.no_likes"}}</p>
{{/if}}
</div>
</div>
<div class='top-sub-section likes-section pull-right'>
<h3 class='stats-title'>{{i18n "user.summary.most_liked_users"}}</h3>
{{#if model.most_liked_users.length}}
<ul>
{{#each model.most_liked_users as |user|}}
<li>
{{#user-info user=user}}
{{fa-icon "heart"}}
<span class='likes'>{{number user.count}}</span>
{{/user-info}}
</li>
{{/each}}
</ul>
{{else}}
<p>{{i18n "user.summary.no_likes"}}</p>
{{/if}}
</div>
</div>
<div class='top-section badges-section'>
<h3 class='stats-title'>{{i18n "user.summary.top_badges"}}</h3>
{{#each model.badges as |badge|}}
{{badge-card badge=badge count=badge.count navigateOnClick="true" username=user.username_lower}}
{{else}}
<p>{{i18n "user.summary.no_badges"}}</p>
{{/each}}
{{#if moreBadges}}
<p>{{#link-to "user.badges" user class="more"}}{{i18n "user.summary.more_badges"}}{{/link-to}}</p>
{{/if}}
</div>
<div class='top-section badges-section'>
<h3 class='stats-title'>{{i18n "user.summary.top_badges"}}</h3>
{{#each model.badges as |badge|}}
{{badge-card badge=badge count=badge.count navigateOnClick="true" username=user.username_lower}}
{{else}}
<p>{{i18n "user.summary.no_badges"}}</p>
{{/each}}
{{#if moreBadges}}
<p>{{#link-to "user.badges" user class="more"}}{{i18n "user.summary.more_badges"}}{{/link-to}}</p>
{{/if}}
</div>
{{/d-section}}

View File

@ -1,44 +1,46 @@
{{#load-more selector=".directory tbody tr" action="loadMore"}}
<div class="container">
<div class='directory'>
{{#d-section pageClass="users"}}
{{#load-more selector=".directory tbody tr" action="loadMore"}}
<div class="container">
<div class='directory'>
<div class='clearfix'>
{{period-chooser period=period}}
{{text-field value=nameInput placeholderKey="directory.filter_name" class="filter-name no-blur"}}
</div>
{{#conditional-loading-spinner condition=model.loading}}
{{#if model.length}}
<div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div>
<table>
<thead>
<th>&nbsp;</th>
{{directory-toggle field="likes_received" order=order asc=asc icon="heart"}}
{{directory-toggle field="likes_given" order=order asc=asc icon="heart"}}
{{directory-toggle field="topic_count" order=order asc=asc}}
{{directory-toggle field="post_count" order=order asc=asc}}
{{directory-toggle field="topics_entered" order=order asc=asc}}
{{directory-toggle field="posts_read" order=order asc=asc}}
{{directory-toggle field="days_visited" order=order asc=asc}}
{{#if showTimeRead}}
<th>{{i18n "directory.time_read"}}</th>
{{/if}}
</thead>
<tbody>
{{#each model as |item|}}
{{directory-item item=item showTimeRead=showTimeRead}}
{{/each}}
</tbody>
</table>
{{conditional-loading-spinner condition=model.loadingMore}}
{{else}}
<div class='clearfix'></div>
<p>{{i18n "directory.no_results"}}</p>
{{/if}}
{{/conditional-loading-spinner}}
<div class='clearfix'>
{{period-chooser period=period}}
{{text-field value=nameInput placeholderKey="directory.filter_name" class="filter-name no-blur"}}
</div>
{{#conditional-loading-spinner condition=model.loading}}
{{#if model.length}}
<div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div>
<table>
<thead>
<th>&nbsp;</th>
{{directory-toggle field="likes_received" order=order asc=asc icon="heart"}}
{{directory-toggle field="likes_given" order=order asc=asc icon="heart"}}
{{directory-toggle field="topic_count" order=order asc=asc}}
{{directory-toggle field="post_count" order=order asc=asc}}
{{directory-toggle field="topics_entered" order=order asc=asc}}
{{directory-toggle field="posts_read" order=order asc=asc}}
{{directory-toggle field="days_visited" order=order asc=asc}}
{{#if showTimeRead}}
<th>{{i18n "directory.time_read"}}</th>
{{/if}}
</thead>
<tbody>
{{#each model as |item|}}
{{directory-item item=item showTimeRead=showTimeRead}}
{{/each}}
</tbody>
</table>
{{conditional-loading-spinner condition=model.loadingMore}}
{{else}}
<div class='clearfix'></div>
<p>{{i18n "directory.no_results"}}</p>
{{/if}}
{{/conditional-loading-spinner}}
</div>
</div>
{{/load-more}}
{{/load-more}}
{{/d-section}}

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('about-page');

View File

@ -1,4 +0,0 @@
import ScrollTop from 'discourse/mixins/scroll-top';
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('badges-page').extend(ScrollTop);

View File

@ -1,5 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('search-page').extend({
classNames: ['search-container']
});

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('navigation-topics');

View File

@ -1,6 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('user-preferences-page').extend({
templateName: 'user/preferences',
classNames: ['user-preferences']
});

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('tags-page');

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('user-activity-page');

View File

@ -1,4 +0,0 @@
import ScrollTop from 'discourse/mixins/scroll-top';
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('user-badges-page').extend(ScrollTop);

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('user-invites-page');

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('user-messages-page');

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('user-notifications-page');

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('user-summary-page');

View File

@ -1,3 +0,0 @@
import { createViewWithBodyClass } from 'discourse/lib/create-view';
export default createViewWithBodyClass('users-page');

View File

@ -4,6 +4,7 @@ acceptance("About");
test("viewing", () => {
visit("/about");
andThen(() => {
ok($('body.about-page').length, "has body class");
ok(exists('.about.admins .user-info'), 'has admins');
ok(exists('.about.moderators .user-info'), 'has moderators');
ok(exists('.about.stats tr td'), 'has stats');

View File

@ -5,6 +5,7 @@ acceptance("Badges");
test("Visit Badge Pages", () => {
visit("/badges");
andThen(() => {
ok($('body.badges-page').length, "has body class");
ok(exists('.badge-groups .badge-card'), "has a list of badges");
});

View File

@ -5,6 +5,7 @@ test("update some fields", () => {
visit("/users/eviltrout/preferences");
andThen(() => {
ok($('body.user-preferences-page').length, "has the body class");
equal(currentURL(), '/users/eviltrout/preferences', "it doesn't redirect");
ok(exists('.user-preferences'), 'it shows the preferences');
});

View File

@ -43,6 +43,8 @@ test("perform various searches", assert => {
visit("/search");
andThen(() => {
ok($('body.search-page').length, "has body class");
ok(exists('.search-container'), "has container class");
assert.ok(find('input.search').length > 0);
assert.ok(find('.fps-topic').length === 0);
});

View File

@ -0,0 +1,11 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Tags", { loggedIn: true });
test("list the tags", () => {
visit("/tags");
andThen(() => {
ok($('body.tags-page').length, "has the body class");
ok(exists('.tag-eviltrout'), "shows the evil trout tag");
});
});

View File

@ -4,6 +4,7 @@ acceptance("Topic Discovery");
test("Visit Discovery Pages", () => {
visit("/");
andThen(() => {
ok($('body.navigation-topics').length, "has the default navigation");
ok(exists(".topic-list"), "The list of topics was rendered");
ok(exists('.topic-list .topic-list-item'), "has topics");
});

View File

@ -24,6 +24,9 @@ test("Root URL", () => {
test("Filters", () => {
visit("/users/eviltrout/activity");
andThen(() => {
ok($('body.user-activity-page').length, "has the body class");
});
hasStream();
visit("/users/eviltrout/activity/topics");
@ -33,6 +36,14 @@ test("Filters", () => {
hasStream();
});
test("Badges", () => {
visit("/users/eviltrout/badges");
andThen(() => {
ok($('body.user-badges-page').length, "has the body class");
ok(exists(".user-badges-list .badge-card"), "shows a badge");
});
});
test("Restricted Routes", () => {
visit("/users/eviltrout/preferences");

View File

@ -1,17 +1,32 @@
import { acceptance } from "helpers/qunit-helpers";
import { hasStream } from 'acceptance/user-anonymous-test';
acceptance("User", {loggedIn: true});
test("Pending", () => {
visit("/users/eviltrout/activity/pending");
hasStream();
test("Invites", () => {
visit("/users/eviltrout/invited/pending");
andThen(() => {
ok($('body.user-invites-page').length, "has the body class");
});
});
test("Messages", () => {
visit("/users/eviltrout/messages");
andThen(() => {
ok($('body.user-messages-page').length, "has the body class");
});
});
test("Notifications", () => {
visit("/users/eviltrout/notifications");
andThen(() => {
ok($('body.user-notifications-page').length, "has the body class");
});
});
test("Root URL - Viewing Self", () => {
visit("/users/eviltrout");
andThen(() => {
ok($('body.user-summary-page').length, "has the body class");
equal(currentPath(), 'user.summary', "it defaults to summary");
});
});

View File

@ -4,6 +4,7 @@ acceptance("User Directory");
test("Visit Page", function() {
visit("/users");
andThen(() => {
ok($('body.users-page').length, "has the body class");
ok(exists('.directory table tr'), "has a list of users");
});
});

View File

@ -56,6 +56,13 @@ export default function() {
return response(json);
});
this.get('/tags', () => {
return response({ tags: [{
id: 'eviltrout',
count: 1
}] });
});
this.get('/users/eviltrout.json', () => {
const json = fixturesByUrl['/users/eviltrout.json'];
if (loggedIn()) {
@ -76,6 +83,20 @@ export default function() {
});
});
this.get('/users/eviltrout/invited_count.json', () => {
return response({
"counts": { "pending": 1, "redeemed": 0, "total": 0 }
});
});
this.get('/users/eviltrout/invited.json', () => {
return response({ "invites": [ {id: 1} ] });
});
this.get('/topics/private-messages/eviltrout.json', () => {
return response({ topic_list: { topics: [] } });
});
this.get('/clicks/track', success);
this.get('/search', request => {