mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add acceptance tests for all mobile templates
This commit is contained in:
@@ -39,7 +39,6 @@ function parseName(fullName) {
|
||||
}
|
||||
|
||||
export default Ember.DefaultResolver.extend({
|
||||
|
||||
parseName: parseName,
|
||||
|
||||
normalize(fullName) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import Mobile from 'discourse/lib/mobile';
|
||||
|
||||
// Initializes the `Mobile` helper object.
|
||||
// Initializes the `Mobile` helper object.
|
||||
export default {
|
||||
name: 'mobile',
|
||||
after: 'inject-objects',
|
||||
@@ -16,4 +16,3 @@ export default {
|
||||
app.registry.resolver.__resolver__.mobileView = Mobile.mobileView;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
let mobileForced = false;
|
||||
|
||||
// An object that is responsible for logic related to mobile devices.
|
||||
const Mobile = {
|
||||
isMobileDevice: false,
|
||||
@@ -5,8 +7,10 @@ const Mobile = {
|
||||
|
||||
init() {
|
||||
const $html = $('html');
|
||||
this.isMobileDevice = $html.hasClass('mobile-device');
|
||||
this.mobileView = $html.hasClass('mobile-view');
|
||||
this.isMobileDevice = mobileForced || $html.hasClass('mobile-device');
|
||||
this.mobileView = mobileForced || $html.hasClass('mobile-view');
|
||||
|
||||
if (mobileForced) { return; }
|
||||
|
||||
try{
|
||||
if (window.location.search.match(/mobile_view=1/)){
|
||||
@@ -27,8 +31,8 @@ const Mobile = {
|
||||
}
|
||||
},
|
||||
|
||||
toggleMobileView: function() {
|
||||
try{
|
||||
toggleMobileView() {
|
||||
try {
|
||||
if (localStorage) {
|
||||
localStorage.mobileView = !this.mobileView;
|
||||
}
|
||||
@@ -38,11 +42,19 @@ const Mobile = {
|
||||
this.reloadPage(!this.mobileView);
|
||||
},
|
||||
|
||||
reloadPage: function(mobile) {
|
||||
reloadPage(mobile) {
|
||||
window.location.assign(window.location.pathname + '?mobile_view=' + (mobile ? '1' : '0'));
|
||||
}
|
||||
};
|
||||
|
||||
export function forceMobile() {
|
||||
mobileForced = true;
|
||||
}
|
||||
|
||||
export function resetMobile() {
|
||||
mobileForced = false;
|
||||
}
|
||||
|
||||
// Backwards compatibiltity, deprecated
|
||||
Object.defineProperty(Discourse, 'Mobile', {
|
||||
get: function() {
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{{user-info user=item.user}}
|
||||
{{user-stat value=item.likes_received label="directory.likes_received" icon="heart"}}
|
||||
{{user-stat value=item.likes_given label="directory.likes_given" icon="heart"}}
|
||||
{{user-stat value=item.topic_count label="directory.topic_count"}}
|
||||
{{user-stat value=item.post_count label="directory.post_count"}}
|
||||
{{user-stat value=item.topics_entered label="directory.topics_entered"}}
|
||||
{{user-stat value=item.posts_read label="directory.posts_read"}}
|
||||
{{user-stat value=item.days_visited label="directory.days_visited"}}
|
||||
{{#if showTimeRead}}
|
||||
<div class='time-read'>{{unbound item.time_read}}</div>
|
||||
{{/if}}
|
||||
@@ -9,24 +9,9 @@
|
||||
{{#conditional-loading-spinner condition=model.loading}}
|
||||
{{#if model.length}}
|
||||
<div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div>
|
||||
|
||||
{{#each model itemController="directory-item"}}
|
||||
<div class="user {{if ic.me 'me'}}">
|
||||
{{#with ic.model as |it|}}
|
||||
{{user-info user=it.user}}
|
||||
{{user-stat value=it.likes_received label="directory.likes_received" icon="heart"}}
|
||||
{{user-stat value=it.likes_given label="directory.likes_given" icon="heart"}}
|
||||
{{user-stat value=it.topic_count label="directory.topic_count"}}
|
||||
{{user-stat value=it.post_count label="directory.post_count"}}
|
||||
{{user-stat value=it.topics_entered label="directory.topics_entered"}}
|
||||
{{user-stat value=it.posts_read label="directory.posts_read"}}
|
||||
{{user-stat value=it.days_visited label="directory.days_visited"}}
|
||||
{{#if showTimeRead}}
|
||||
<div class='time-read'>{{unbound it.time_read}}</div>
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
</div>
|
||||
{{/each}}
|
||||
{{#each model as |item|}}
|
||||
{{directory-item tagName="div" class="user" item=item showTimeRead=showTimeRead}}
|
||||
{{/each}}
|
||||
|
||||
{{conditional-loading-spinner condition=model.loadingMore}}
|
||||
{{else}}
|
||||
|
||||
Reference in New Issue
Block a user