FEATURE: Full height hamburger menu

- Rename `site-map` to `hamburger-menu`
- Includes acceptance tests
This commit is contained in:
Robin Ward 2015-08-25 12:50:19 -04:00
parent 3faeeca5c8
commit c5460b7d3f
57 changed files with 399 additions and 322 deletions

View File

@ -0,0 +1,13 @@
import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
tagName: 'li',
classNames: ['category-link'],
@computed('category.unreadTopics', 'category.newTopics')
unreadTotal(unreadTopics, newTopics) {
return parseInt(unreadTopics, 10) + parseInt(newTopics, 10);
},
showTopicCount: Ember.computed.not('currentUser')
});

View File

@ -0,0 +1,77 @@
import { default as computed, on } from 'ember-addons/ember-computed-decorators';
export default Ember.Component.extend({
classNameBindings: ['visible::slideright'],
elementId: 'hamburger-menu',
@computed()
showKeyboardShortcuts() {
return !Discourse.Mobile.mobileView && !this.capabilities.touch;
},
@computed()
showMobileToggle() {
return Discourse.Mobile.mobileView || (this.siteSettings.enable_mobile_theme && this.capabilities.touch);
},
@computed()
mobileViewLinkTextKey() {
return Discourse.Mobile.mobileView ? "desktop_view" : "mobile_view";
},
@computed()
faqUrl() {
return this.siteSettings.faq_url ? this.siteSettings.faq_url : Discourse.getURL('/faq');
},
@on('didInsertElement')
_bindEvents() {
this.$().on('click.discourse-hamburger', 'a', () => {
this.set('visible', false);
});
$('body').on('keydown.discourse-hambuger', (e) => {
if (e.which === 27) {
this.set('visible', false);
}
});
if (this.capabilities.touch) {
$('body').on('swipeleft.discourse-hamburger', () => this.set('visible', true));
$('body').on('swiperight.discourse-hamburger', () => this.set('visible', false));
}
},
@on('willDestroyElement')
_removeEvents() {
this.$().off('click.discourse-hamburger');
$('body').off('keydown.discourse-hambuger');
$('body').off('swipeleft.discourse-hamburger');
$('body').off('swiperight.discourse-hamburger');
},
@computed()
categories() {
const hideUncategorized = !this.siteSettings.allow_uncategorized_topics;
const showSubcatList = this.siteSettings.show_subcategory_list;
const isStaff = Discourse.User.currentProp('staff');
return Discourse.Category.list().reject((c) => {
if (showSubcatList && c.get('parent_category_id')) { return true; }
if (hideUncategorized && c.get('isUncategorizedCategory') && !isStaff) { return true; }
return false;
});
},
actions: {
close() {
this.set('visible', false);
},
keyboardShortcuts() {
this.sendAction('showKeyboardAction');
},
toggleMobileView() {
Discourse.Mobile.toggleMobileView();
}
}
});

View File

@ -1,16 +1,27 @@
import computed from 'ember-addons/ember-computed-decorators';
export default Ember.Controller.extend({
showTop: true,
showFooter: false,
styleCategory: null,
hamburgerVisible: false,
canSignUp: function() {
@computed
canSignUp() {
return !Discourse.SiteSettings.invite_only &&
Discourse.SiteSettings.allow_new_registrations &&
!Discourse.SiteSettings.enable_sso;
}.property(),
},
loginRequired: function() {
@computed
loginRequired() {
return Discourse.SiteSettings.login_required && !Discourse.User.current();
}.property()
},
actions: {
toggleHamburgerMenu() {
this.toggleProperty('hamburgerVisible');
}
}
});

View File

@ -1,10 +0,0 @@
export default Ember.Controller.extend({
needs: ['site-map'],
unreadTotal: function() {
return parseInt(this.get('model.unreadTopics'), 10) +
parseInt(this.get('model.newTopics'), 10);
}.property('model.unreadTopics', 'model.newTopics'),
showTopicCount: Em.computed.not('currentUser')
});

View File

@ -1,46 +0,0 @@
import { url } from 'discourse/lib/computed';
export default Ember.ArrayController.extend({
needs: ['application', 'header'],
showBadgesLink: function(){return Discourse.SiteSettings.enable_badges;}.property(),
showAdminLinks: Em.computed.alias('currentUser.staff'),
faqUrl: function() {
return Discourse.SiteSettings.faq_url ? Discourse.SiteSettings.faq_url : Discourse.getURL('/faq');
}.property(),
badgesUrl: url('/badges'),
showKeyboardShortcuts: function(){
return !Discourse.Mobile.mobileView && !this.capabilities.touch;
}.property(),
showMobileToggle: function(){
return Discourse.Mobile.mobileView || (Discourse.SiteSettings.enable_mobile_theme && this.capabilities.touch);
}.property(),
mobileViewLinkTextKey: function() {
return Discourse.Mobile.mobileView ? "desktop_view" : "mobile_view";
}.property(),
categories: function() {
var hideUncategorized = !this.siteSettings.allow_uncategorized_topics,
showSubcatList = this.siteSettings.show_subcategory_list,
isStaff = Discourse.User.currentProp('staff');
return Discourse.Category.list().reject(function(c) {
if (showSubcatList && c.get('parent_category_id')) { return true; }
if (hideUncategorized && c.get('isUncategorizedCategory') && !isStaff) { return true; }
return false;
});
}.property(),
actions: {
keyboardShortcuts: function(){
this.get('controllers.application').send('showKeyboardShortcutsHelp');
},
toggleMobileView: function() {
Discourse.Mobile.toggleMobileView();
}
}
});

View File

@ -45,7 +45,7 @@ const PATH_BINDINGS = {
'k': 'selectUp',
'u': 'goBack',
'/': 'showSearch',
'=': 'showSiteMap', // open site map menu
'=': 'toggleHamburgerMenu',
'p': 'showCurrentUser', // open current user menu
'ctrl+f': 'showBuiltinSearch',
'command+f': 'showBuiltinSearch',
@ -172,9 +172,8 @@ export default {
return false;
},
showSiteMap() {
$('#site-map').click();
$('#site-map-dropdown a:first').focus();
toggleHamburgerMenu() {
this.container.lookup('controller:application').send('toggleHamburgerMenu');
},
showCurrentUser() {

View File

@ -28,5 +28,6 @@ export default {
application.register('capabilities:main', caps, { instantiate: false });
application.inject('view', 'capabilities', 'capabilities:main');
application.inject('controller', 'capabilities', 'capabilities:main');
application.inject('component', 'capabilities', 'capabilities:main');
}
};

View File

@ -13,7 +13,6 @@ function unlessReadOnly(method) {
}
const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
siteTitle: setting('title'),
actions: {
@ -134,12 +133,12 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
});
},
deleteSpammer: function (user) {
deleteSpammer(user) {
this.send('closeModal');
user.deleteAsSpammer(function() { window.location.reload(); });
},
checkEmail: function (user) {
checkEmail(user) {
user.checkEmail();
},
@ -150,7 +149,7 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
this.render(w, {into: 'modal/topic-bulk-actions', outlet: 'bulkOutlet', controller: factory ? controllerName : 'topic-bulk-actions'});
},
createNewTopicViaParams: function(title, body, category_id, category) {
createNewTopicViaParams(title, body, category_id, category) {
this.openComposerWithParams(this.controllerFor('discovery/topics'), title, body, category_id, category);
}
},

View File

@ -18,3 +18,5 @@
{{render "modal"}}
{{render "topic-entrance"}}
{{render "composer"}}
{{hamburger-menu visible=hamburgerVisible showKeyboardAction="showKeyboardShortcutsHelp"}}

View File

@ -0,0 +1,9 @@
{{category-link category allowUncategorized="true"}}
{{#if unreadTotal}}
<a href={{category.url}} class='badge badge-notification'>{{unreadTotal}}</a>
{{/if}}
{{#if showTopicCount}}
<b class="topics-count">{{category.topic_count}}</b>
{{/if}}

View File

@ -1,16 +1,17 @@
<section class="d-dropdown" id="site-map-dropdown">
{{#if visible}}
<a href {{action "close"}} class='close-hamburger'>{{fa-icon 'times'}}</a>
<ul class="location-links">
{{#if showAdminLinks}}
{{#if currentUser.staff}}
<li>
{{#link-to "admin" class="admin-link"}}
<i class='fa fa-wrench'></i> {{i18n 'admin_title'}}
{{fa-icon "wrench"}} {{i18n 'admin_title'}}
{{/link-to}}
</li>
<li>
{{#link-to "adminFlags" class="flagged-posts-link"}}
{{fa-icon "flag"}} {{i18n 'flags_title'}}
{{#if currentUser.site_flagged_posts_count}}
<span title='{{i18n 'notifications.total_flagged'}}' class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</span>
<span title={{i18n 'notifications.total_flagged'}} class='badge-notification flagged-posts'>{{currentUser.site_flagged_posts_count}}</span>
{{/if}}
{{/link-to}}
</li>
@ -20,14 +21,14 @@
{{i18n 'filters.latest.title.zero'}}
{{/link-to}}
</li>
{{#if showBadgesLink}}
{{#if siteSettings.enable_badges}}
<li>
<a href="{{unbound badgesUrl}}" class="badge-link">{{i18n 'badges.title'}}</a>
{{#link-to 'badges' class="badge-link"}}{{i18n 'badges.title'}}{{/link-to}}
</li>
{{/if}}
{{#if siteSettings.enable_user_directory}}
<li>{{#link-to 'users'}}{{i18n "directory.title"}}{{/link-to}}</li>
<li>{{#link-to 'users' class="user-directory-link"}}{{i18n "directory.title"}}{{/link-to}}</li>
{{/if}}
{{#if currentUser.show_queued_posts}}
@ -47,10 +48,10 @@
<li><a href {{action "keyboardShortcuts"}} class="keyboard-shortcuts-link">{{i18n 'keyboard_shortcuts_help.title'}}</a></li>
{{/if}}
<li>
<a href="{{unbound faqUrl}}" class="faq-link">{{i18n 'faq'}}</a>
<a href={{faqUrl}} class="faq-link">{{i18n 'faq'}}</a>
</li>
<li>
{{#link-to 'about'}}{{i18n 'about.simple_title'}}{{/link-to}}
{{#link-to 'about' class="about-link"}}{{i18n 'about.simple_title'}}{{/link-to}}
</li>
{{#if showMobileToggle}}
<li><a href class="mobile-toggle-link" {{action "toggleMobileView"}}>{{boundI18n mobileViewLinkTextKey}}</a></li>
@ -61,23 +62,15 @@
{{#if categories}}
<ul class="category-links">
<li class="heading" title="{{i18n 'filters.categories.help'}}">
{{#link-to "discovery.categories"}}{{i18n 'filters.categories.title'}}{{/link-to}}
<li class="heading" title={{i18n 'filters.categories.help'}}>
{{#link-to "discovery.categories" class="categories-link"}}{{i18n 'filters.categories.title'}}{{/link-to}}
</li>
{{#each c in categories itemController='site-map-category'}}
<li class="category">
{{category-link c.model allowUncategorized="true"}}
{{#if c.unreadTotal}}
<a href={{unbound c.model.url}} class='badge badge-notification'>{{c.unreadTotal}}</a>
{{/if}}
{{#if c.showTopicCount}}
<b class="topics-count">{{unbound c.model.topic_count}}</b>
{{/if}}
</li>
{{#each categories as |c|}}
{{hamburger-category category=c}}
{{/each}}
</ul>
{{/if}}
</section>
<br>
{{/if}}

View File

@ -12,9 +12,9 @@
{{/unless}}
<ul class='icons clearfix' role='navigation'>
{{#if currentUser}}
{{plugin-outlet "header-before-notifications"}}
<li class='notifications'>
<a class='icon' href {{action "showNotifications" target="view"}} data-notifications="notifications-dropdown" id='user-notifications' title='{{i18n 'notifications.title'}}'>
{{fa-icon "comment" label="notifications.title"}}
@ -45,21 +45,18 @@
<li class='categories dropdown'>
{{#if loginRequired}}
<a class='icon'
href="#"
href
aria-hidden="true"
id="site-map"
id="toggle-hamburger-menu"
{{action "showLogin"}}>
{{fa-icon "bars"}}
</a>
{{else}}
<a class='icon'
data-dropdown="site-map-dropdown"
data-render="renderSiteMap"
href
title='{{i18n 'site_map'}}'
aria-label='{{i18n 'site_map'}}'
id="site-map">
{{fa-icon "bars" label="site_map"}}
<a {{action "toggleHamburgerMenu"}} class='icon' href
title={{i18n 'hamburger_menu'}}
aria-label={{i18n 'hamburger_menu'}}
id="toggle-hamburger-menu">
{{fa-icon "bars"}}
</a>
{{/if}}
{{#if flaggedPostsCount}}
@ -82,16 +79,9 @@
</ul>
{{#if view.renderDropdowns}}
{{plugin-outlet "header-before-dropdowns"}}
{{render "search"}}
{{render "notifications" notifications}}
{{#if view.renderSiteMap}}
{{render "site-map"}}
{{/if}}
{{render "user-dropdown"}}
{{/if}}
</div>

View File

@ -25,7 +25,7 @@
<ul>
<li>{{{i18n 'keyboard_shortcuts_help.application.create'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.application.notifications'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.application.site_map_menu'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.application.hamburger_menu'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.application.user_profile_menu'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.application.show_incoming_updated_topics'}}}</li>
<li>{{{i18n 'keyboard_shortcuts_help.application.search'}}}</li>

View File

@ -42,3 +42,4 @@
//= require buffered-proxy
//= require jquery.autoellipsis-1.0.10.min.js
//= require_tree ./discourse/ember
//= require jquery.detect_swipe.js

View File

@ -0,0 +1,64 @@
#hamburger-menu {
position: fixed;
right: 0;
top: 0;
background-color: $secondary;
z-index: 1002;
height: 100%;
overflow: auto;
transition: 0.3s ease-in-out;
transform: translateX(0);
box-shadow: 4px 0 4px 5px rgba(0,0,0, .25);
padding: 0.5em 0.5em 0.5em 0.5em;
width: 300px;
.close-hamburger {
float: right;
color: dark-light-choose(scale-color($header_primary, $lightness: 50%), $header_primary);
font-size: 1.5em;
margin-right: 0.1em;
margin-top: 0.1em;
}
ul {
list-style: none;
margin: 0;
padding: 0;
}
ul.location-links li, li.heading {
a {
padding: 0.5em;
display: block;
&:hover {
background-color: dark-light-diff($highlight, $secondary, 50%, -55%);
}
}
}
li.category-link {
float: left;
background-color: transparent;
width: 45%;
margin: 5px 5px 0 8px;
.box {margin-top: 0;}
.badge-notification {
color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
background-color: transparent;
vertical-align: top;
padding: 5px 5px 2px 5px;
}
}
// note these topic counts only appear for anons in the category hamburger drop down
b.topics-count {
color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
font-weight: normal;
font-size: 11px;
}
}
#hamburger-menu.slideright {
transform: translateX(330px);
}

View File

@ -148,12 +148,6 @@
box-shadow: 0 2px 2px rgba(0,0,0, .4);
// note these topic counts only appear for anons in the category hamburger drop down
b.topics-count {
color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
font-weight: normal;
font-size: 11px;
}
ul {
margin: 0;
@ -233,18 +227,6 @@
@include unselectable;
}
// Site map
&#site-map-dropdown {
.heading {
padding: 5px 5px 5px 0;
a {
display: block;
padding: 0 5px;
}
}
}
// Search
&#search-dropdown {
@ -291,20 +273,6 @@
// Categories
.category {
float: left;
background-color: transparent;
width: 45%;
margin: 5px 5px 0 5px;
.box {margin-top: 0;}
.badge-notification {
color: dark-light-choose(scale-color($primary, $lightness: 50%), scale-color($secondary, $lightness: 50%));
background-color: transparent;
vertical-align: top;
padding: 5px 5px 2px 5px;
}
}
&#user-dropdown {
width: 118px;
}

View File

@ -977,7 +977,7 @@ ar:
category: "البحث في التصنيف \"{{category}}\""
topic: "بحث في هذا الموضوع"
private_messages: "البحث في الرسائل الخاصة"
site_map: "الذهاب إلى قائمة مواضيع أو تصنيف آخر"
hamburger_menu: "الذهاب إلى قائمة مواضيع أو تصنيف آخر"
go_back: 'الرجوع'
not_logged_in_user: 'صفحة المستخدم مع ملخص عن نشاطه و إعداداته'
current_user: 'الذهاب إلى صفحتك الشخصية'
@ -2690,7 +2690,7 @@ ar:
title: 'التطبيقات'
create: '<b>c</b> انشاء موضوع جديد'
notifications: '<b>n</b> فتح الإشعارات'
site_map_menu: '<b>=</b> أفتح قائمة الموقع'
hamburger_menu: '<b>=</b> أفتح قائمة الموقع'
user_profile_menu: '<b>p</b>أفتح قائمة المستخدم'
show_incoming_updated_topics: '<b>.</b> عرض المواضيع المحدثة'
search: '<b>/</b> البحث'

View File

@ -696,7 +696,7 @@ bs_BA:
user: "Traži postove od @{{username}}"
category: "Traži \"{{category}}\" kategoriju"
topic: "Pretraži ovu temu"
site_map: "go to another topic list or category"
hamburger_menu: "go to another topic list or category"
go_back: 'go back'
not_logged_in_user: 'user page with summary of current activity and preferences'
current_user: 'go to your user page'
@ -1794,7 +1794,7 @@ bs_BA:
title: 'Aplikacija'
create: '<b>c</b> Započni novu temu'
notifications: '<b>n</b> Otvori notifikacije'
site_map_menu: '<b>=</b> Otvori meni sajta'
hamburger_menu: '<b>=</b> Otvori meni sajta'
user_profile_menu: '<b>p</b> Otvori meni korisnika'
show_incoming_updated_topics: '<b>.</b> Pročitaj promjenje teme'
search: '<b>/</b> Tragaj'

View File

@ -829,7 +829,7 @@ cs:
category: "Vyhledat v kategorii „{{category}}“"
topic: "Vyhledat v tomto tématu"
private_messages: "Hledat ve zprávách"
site_map: "přejít na jiný seznam témat nebo kategorii"
hamburger_menu: "přejít na jiný seznam témat nebo kategorii"
go_back: 'jít zpět'
not_logged_in_user: 'stránka uživatele s přehledem o aktuální činnosti a nastavení'
current_user: 'jít na vaši uživatelskou stránku'
@ -2322,7 +2322,7 @@ cs:
title: 'Application'
create: '<b>c</b> Create a new topic'
notifications: '<b>n</b> Open notifications'
site_map_menu: '<b>=</b> Otevře hlavní menu'
hamburger_menu: '<b>=</b> Otevře hlavní menu'
user_profile_menu: '<b>p</b> Otevře uživatelské menu'
show_incoming_updated_topics: '<b>.</b> Ukáže aktualizovaná témata'
search: '<b>/</b> Search'

View File

@ -798,7 +798,7 @@ da:
category: "Søg i kategorien \"{{category}}\""
topic: "Søg i dette emne"
private_messages: "Søg i beskeder"
site_map: "gå til en anden emneoversigt eller kategori"
hamburger_menu: "gå til en anden emneoversigt eller kategori"
go_back: 'gå tilbage'
not_logged_in_user: 'bruger side, med oversigt over aktivitet og indstillinger'
current_user: 'gå til brugerside'
@ -2285,7 +2285,7 @@ da:
title: 'Applikation'
create: '<b>c</b> Opret et nyt emne'
notifications: '<b>n</b> Åbn notifikationer'
site_map_menu: '<b>=</b> Åben site menu'
hamburger_menu: '<b>=</b> Åben site menu'
user_profile_menu: '<b>p</b> Åben bruger menu'
show_incoming_updated_topics: '<b>.</b> Vis opdaterede emner'
search: '<b>/</b> Søg'

View File

@ -836,7 +836,7 @@ de:
category: "Kategorie „{{category}}“ durchsuchen"
topic: "Dieses Thema durchsuchen"
private_messages: "Nachrichten durchsuchen"
site_map: "zu einer anderen Themenliste oder Kategorie wechseln"
hamburger_menu: "zu einer anderen Themenliste oder Kategorie wechseln"
go_back: 'zurückgehen'
not_logged_in_user: 'Benutzerseite mit einer Zusammenfassung der Benutzeraktivitäten und Einstellungen'
current_user: 'zu deiner Benutzerseite gehen'
@ -2332,7 +2332,7 @@ de:
title: 'Anwendung'
create: '<b>c</b> Neues Thema erstellen'
notifications: '<b>n</b> Benachrichtigungen anzeigen'
site_map_menu: '<b>=</b> Seitenmenü öffnen'
hamburger_menu: '<b>=</b> Seitenmenü öffnen'
user_profile_menu: '<b>p</b> Benutzermenü öffnen'
show_incoming_updated_topics: '<b>.</b> Zeige aktualisierte Themen'
search: '<b>/</b> Suchen'

View File

@ -930,7 +930,7 @@ en:
topic: "Search this topic"
private_messages: "Search messages"
site_map: "go to another topic list or category"
hamburger_menu: "go to another topic list or category"
go_back: 'go back'
not_logged_in_user: 'user page with summary of current activity and preferences'
current_user: 'go to your user page'
@ -2570,7 +2570,7 @@ en:
title: 'Application'
create: '<b>c</b> Create a new topic'
notifications: '<b>n</b> Open notifications'
site_map_menu: '<b>=</b> Open site menu'
hamburger_menu: '<b>=</b> Open hamburger menu'
user_profile_menu: '<b>p</b> Open user menu'
show_incoming_updated_topics: '<b>.</b> Show updated topics'
search: '<b>/</b> Search'

View File

@ -837,7 +837,7 @@ es:
category: "Buscar en la categoría \"{{category}}\""
topic: "Buscar en este tema"
private_messages: "Buscar en mensajes"
site_map: "ir a otra lista de temas o categoría"
hamburger_menu: "ir a otra lista de temas o categoría"
go_back: 'volver'
not_logged_in_user: 'página con el resumen de actividad y preferencias'
current_user: 'ir a tu página de usuario'
@ -2357,7 +2357,7 @@ es:
title: 'Aplicación'
create: '<b>c</b> Crear un tema nuevo'
notifications: '<b>n</b> Abrir notificaciones'
site_map_menu: '<b>=</b> Abrir menú del sitio'
hamburger_menu: '<b>=</b> Abrir menú del sitio'
user_profile_menu: '<b>p</b> Abrir menú de usuario'
show_incoming_updated_topics: '<b>.</b> Mostrar temas actualizados'
search: '<b>/</b> Buscar'

View File

@ -765,7 +765,7 @@ fa_IR:
category: "جستجوی دستهٔ «{{category}}»"
topic: "جستجوی این موضوع"
private_messages: "جستجوی پیام"
site_map: "به فهرست موضوع یا دسته‌ای دیگر بروید"
hamburger_menu: "به فهرست موضوع یا دسته‌ای دیگر بروید"
go_back: 'برگردید'
not_logged_in_user: 'صفحه کاربر با خلاصه ای از فعالیت های و تنظیمات'
current_user: 'به نمایه‌تان بروید'
@ -2197,7 +2197,7 @@ fa_IR:
title: 'نرم‌افزار'
create: '<b>c</b> ساختن یک موضوع جدید'
notifications: '<b>n</b> باز کردن آگاه‌سازی‌ها'
site_map_menu: '<b>=</b> باز کردن منوی سایت'
hamburger_menu: '<b>=</b> باز کردن منوی سایت'
user_profile_menu: '<b>p</b> باز کردن منوی کاربران'
show_incoming_updated_topics: '<b>.</b> نمایش موضوعات بروز شده'
search: '<b>/</b> جستجو'

View File

@ -817,7 +817,7 @@ fi:
category: "Etsi alueelta \"{{category}}\""
topic: "Etsi tästä ketjusta"
private_messages: "Etsi viesteistä"
site_map: "siirry toiseen ketjuun tai alueelle"
hamburger_menu: "siirry toiseen ketjuun tai alueelle"
go_back: 'mene takaisin'
not_logged_in_user: 'käyttäjäsivu, jossa on tiivistelmä käyttäjän viimeaikaisesta toiminnasta sekä käyttäjäasetukset'
current_user: 'siirry omalle käyttäjäsivullesi'
@ -2313,7 +2313,7 @@ fi:
title: 'Ohjelmisto'
create: '<b>c</b> Luo uusi ketju'
notifications: '<b>n</b> Avaa ilmoitukset'
site_map_menu: '<b>=</b> Avaa palstan valikko'
hamburger_menu: '<b>=</b> Avaa palstan valikko'
user_profile_menu: '<b>p</b> Avaa käyttäjätilin valikko'
show_incoming_updated_topics: '<b>.</b> Näytä päivittyneet ketjut'
search: '<b>/</b> Etsi'

View File

@ -817,7 +817,7 @@ fr:
category: "Rechercher dans la catégorie \"{{category}}\""
topic: "Rechercher dans ce sujet"
private_messages: "Rechercher des messages"
site_map: "aller à une autre liste de sujet ou catégorie"
hamburger_menu: "aller à une autre liste de sujet ou catégorie"
go_back: 'retour'
not_logged_in_user: 'page utilisateur avec un résumé de l''activité en cours et les préférences '
current_user: 'voir la page de l''utilisateur'
@ -2317,7 +2317,7 @@ fr:
title: 'Application'
create: '<b>c</b> Créer un nouveau sujet'
notifications: '<b>n</b> Ouvrir les notifications'
site_map_menu: '<b>=</b> Ouvrir le menu principal'
hamburger_menu: '<b>=</b> Ouvrir le menu principal'
user_profile_menu: '<b>p</b> Ouvrir le menu de votre profil'
show_incoming_updated_topics: '<b>.</b> Afficher les sujets mis à jour'
search: '<b>/</b> Rechercher'

View File

@ -837,7 +837,7 @@ he:
category: "חיפוש בקטגוריה \"{{category}}\""
topic: "חפשו בנושא זה"
private_messages: "חיפוש הודעות"
site_map: "לך לרשימת נושאים או קטגוריה אחרת"
hamburger_menu: "לך לרשימת נושאים או קטגוריה אחרת"
go_back: 'חזור אחורה'
not_logged_in_user: 'עמוד משתמש עם סיכום פעילות נוכחית והעדפות'
current_user: 'לך לעמוד המשתמש שלך'
@ -2332,7 +2332,7 @@ he:
title: 'יישום'
create: '<b>c</b> צור נושא חדש'
notifications: '<b>n</b> פתח התראות'
site_map_menu: '<b>=</b> פתיחת תפריט האתר'
hamburger_menu: '<b>=</b> פתיחת תפריט האתר'
user_profile_menu: '<b>p</b>פתיחת תפריט משתמש/ת'
show_incoming_updated_topics: '<b>.</b> הצגת נושאים שעודכנו'
search: '<b>/</b> חיפוש'

View File

@ -837,7 +837,7 @@ it:
category: "Cerca nella categoria \"{{category}}\""
topic: "Cerca in questo argomento"
private_messages: "Cerca messaggi"
site_map: "vai a un altro elenco di argomenti o categoria"
hamburger_menu: "vai a un altro elenco di argomenti o categoria"
go_back: 'indietro'
not_logged_in_user: 'pagina utente con riassunto delle attività correnti e delle impostazioni'
current_user: 'vai alla pagina utente'
@ -2329,7 +2329,7 @@ it:
title: 'Applicazione'
create: '<b>c</b> Crea un nuovo argomento'
notifications: '<b>n</b> Apri le notifiche'
site_map_menu: '<b>=</b> Apri il menu sito'
hamburger_menu: '<b>=</b> Apri il menu sito'
user_profile_menu: '<b>p</b> Apri il menu del profilo utente'
show_incoming_updated_topics: '<b>.</b> Mostra argomenti aggiornati'
search: '<b>/</b> Cerca'

View File

@ -782,7 +782,7 @@ ja:
category: "\"{{category}}\" カテゴリで検索する"
topic: "このトピックを探す"
private_messages: "メッセージ検索"
site_map: "別のトピックリストやカテゴリに移動"
hamburger_menu: "別のトピックリストやカテゴリに移動"
go_back: '戻る'
not_logged_in_user: 'ユーザアクティビティと設定ページ'
current_user: 'ユーザページに移動'
@ -2225,7 +2225,7 @@ ja:
title: 'アプリケーション'
create: '<b>c</b> 新しいトピックを作成'
notifications: '<b>n</b> お知らせを開く'
site_map_menu: '<b>=</b> サイトメニュを開く'
hamburger_menu: '<b>=</b> サイトメニュを開く'
user_profile_menu: '<b>p</b> ユーザメニュを開く'
show_incoming_updated_topics: '<b>.</b> 更新されたトピックを表示する'
search: '<b>/</b> 検索'

View File

@ -782,7 +782,7 @@ ko:
category: "\"{{category}}\" 카테고리 검색"
topic: "이 토픽을 검색"
private_messages: "메시지 검색"
site_map: "다른 토픽이나 카테고리로 이동"
hamburger_menu: "다른 토픽이나 카테고리로 이동"
go_back: '돌아가기'
not_logged_in_user: 'user page with summary of current activity and preferences'
current_user: '사용자 페이지로 이동'
@ -2225,7 +2225,7 @@ ko:
title: 'Application'
create: '<b>c</b> 새 토픽을 만듭니다.'
notifications: '<b>n</b> Open notifications'
site_map_menu: '<b>=</b> 사이트 메뉴 열기'
hamburger_menu: '<b>=</b> 사이트 메뉴 열기'
user_profile_menu: '<b>p</b> 사용자 메뉴 열기'
show_incoming_updated_topics: '<b>.</b> 갱신된 토픽 보기'
search: '<b>/</b> Search'

View File

@ -827,7 +827,7 @@ nb_NO:
category: "Søk i kategorien \"{{category}}\""
topic: "Søk i dette emnet"
private_messages: "Søk i meldinger"
site_map: "gå til en annen emneliste eller kategori"
hamburger_menu: "gå til en annen emneliste eller kategori"
go_back: 'gå tilbake'
not_logged_in_user: 'brukerside med oppsummering av nylig aktivtet og preferanser.'
current_user: 'go til din brukerside'
@ -2318,7 +2318,7 @@ nb_NO:
title: 'Applikasjon'
create: '<b>c</b> Opprett nytt emne'
notifications: '<b>n</b> Åpne varsler'
site_map_menu: '<b>=</b> Åpne nettstedsmenyen'
hamburger_menu: '<b>=</b> Åpne nettstedsmenyen'
user_profile_menu: '<b>p</b> Åpne brukermenyen'
show_incoming_updated_topics: '<b>.</b> Vis oppdaterte emner'
search: '<b>/</b> Søk'

View File

@ -800,7 +800,7 @@ nl:
category: "Doorzoek de \"{{category}}\" categorie"
topic: "Zoek in deze topic"
private_messages: "Zoek berichten"
site_map: "ga naar een andere topiclijst of categorie"
hamburger_menu: "ga naar een andere topiclijst of categorie"
go_back: 'ga terug'
not_logged_in_user: 'gebruikerspagina met samenvatting van huidige activiteit en voorkeuren'
current_user: 'ga naar je gebruikerspagina'
@ -2285,7 +2285,7 @@ nl:
title: 'Applicatie'
create: '<b>c</b> Maak nieuwe topic'
notifications: '<b>n</b> Open notificaties'
site_map_menu: '<b>=</b> Open site menu'
hamburger_menu: '<b>=</b> Open site menu'
user_profile_menu: '<b>p</b> Open gebruikersmenu'
show_incoming_updated_topics: '<b>.</b> Toon gewijzigde topics'
search: '<b>/</b> Zoek'

View File

@ -872,7 +872,7 @@ pl_PL:
category: "Szukaj w kategorii \"{{category}}\""
topic: "Szukaj w tym temacie"
private_messages: "Wyszukiwanie wiadomości"
site_map: "przejdź do innej listy tematów lub kategorii"
hamburger_menu: "przejdź do innej listy tematów lub kategorii"
go_back: 'wróć'
not_logged_in_user: 'strona użytkownika z podsumowaniem bieżących działań i ustawień'
current_user: 'idź do swojej strony użytkowanika'
@ -2424,7 +2424,7 @@ pl_PL:
title: 'Aplikacja'
create: '<b>c</b> utwórz nowy temat'
notifications: '<b>n</b> pokaż powiadomienia'
site_map_menu: '<b>=</b> menu strony'
hamburger_menu: '<b>=</b> menu strony'
user_profile_menu: '<b>p</b> menu użytkownika'
show_incoming_updated_topics: '<b>.</b> nowe zmiany w tematach'
search: '<b>/</b> wyszukaj'

View File

@ -837,7 +837,7 @@ pt:
category: "Procurar na categoria \"{{category}}\""
topic: "Pesquisar este tópico"
private_messages: "Pesquisar mensagens"
site_map: "ir para outra lista de tópicos ou categorias"
hamburger_menu: "ir para outra lista de tópicos ou categorias"
go_back: 'voltar atrás'
not_logged_in_user: 'página de utilizador com resumo da atividade atual e preferências '
current_user: 'ir para a sua página de utilizador'
@ -2367,7 +2367,7 @@ pt:
title: 'Aplicação'
create: '<b>c</b> Criar um novo tópico'
notifications: '<b>n</b> Abrir notificações'
site_map_menu: '<b>=</b> Abrir menu do sítio'
hamburger_menu: '<b>=</b> Abrir menu do sítio'
user_profile_menu: '<b>p</b> Abrir menu do utilizador'
show_incoming_updated_topics: '<b>.</b> Mostrar tópicos atualizados'
search: '<b>/</b> Pesquisar'

View File

@ -805,7 +805,7 @@ pt_BR:
category: "Procurar a categoria \"{{category}}\""
topic: "Procurar nesse tópico"
private_messages: "Procurar mensagens"
site_map: "ir para outra lista de tópicos ou categorias"
hamburger_menu: "ir para outra lista de tópicos ou categorias"
go_back: 'voltar'
not_logged_in_user: 'página do usuário com resumo de atividades correntes e preferencias'
current_user: 'ir para a sua página de usuário'
@ -2284,7 +2284,7 @@ pt_BR:
title: 'Aplicação'
create: '<b>c</b> Criar um tópico novo'
notifications: '<b>n</b> Abre notificações'
site_map_menu: '<b>=</b> Abrir menu do site'
hamburger_menu: '<b>=</b> Abrir menu do site'
user_profile_menu: '<b>p</b> Abrir menu do usuário'
show_incoming_updated_topics: '<b>.</b> Exibir tópicos atualizados'
search: '<b>/</b> Pesquisa'

View File

@ -796,7 +796,7 @@ ro:
category: "Caută în categoria\"{{category}}\" "
topic: "Caută în această discuție"
private_messages: "Caută mesaje"
site_map: "mergi la o altă listă de discuții sau categorii"
hamburger_menu: "mergi la o altă listă de discuții sau categorii"
go_back: 'înapoi'
not_logged_in_user: 'pagina utilizatorului cu sumarul activităților și preferințelor'
current_user: 'mergi la pagina proprie de utilizator'
@ -2250,7 +2250,7 @@ ro:
title: 'Applicația'
create: '<b>c</b> Crează discuție nouă'
notifications: '<b>n</b> Deschide notificare'
site_map_menu: '<b>=</b> Deschide meniu sit'
hamburger_menu: '<b>=</b> Deschide meniu sit'
user_profile_menu: '<b>p</b> Deschide meniu utilizator'
show_incoming_updated_topics: '<b>.</b> Arată discuţiile actualizate'
search: '<b>/</b> Caută'

View File

@ -862,7 +862,7 @@ ru:
category: "Искать в разделе \"{{category}}\""
topic: "Искать в этой теме"
private_messages: "Поиск в сообщениях"
site_map: "перейти к другому списку тем или другому разделу"
hamburger_menu: "перейти к другому списку тем или другому разделу"
go_back: 'вернуться'
not_logged_in_user: 'страница пользователя с историей его последней активности и настроек'
current_user: 'перейти на вашу страницу пользователя'
@ -2430,7 +2430,7 @@ ru:
title: 'Приложение'
create: '<b>c</b> Создать новую тему'
notifications: '<b>n</b> Открыть уведомления'
site_map_menu: '<b>=</b> Открыть меню сайта'
hamburger_menu: '<b>=</b> Открыть меню сайта'
user_profile_menu: '<b>p</b> Открыть меню моего профиля'
show_incoming_updated_topics: '<b>.</b> Показать обновленные темы'
search: '<b>/</b> Поиск'

View File

@ -817,7 +817,7 @@ sq:
category: "Kërko tek kategoria \"{{category}}\""
topic: "Kërko tek kjo temë"
private_messages: "Search messages"
site_map: "go to another topic list or category"
hamburger_menu: "go to another topic list or category"
go_back: 'kthehu mbrapa'
not_logged_in_user: 'user page with summary of current activity and preferences'
current_user: 'go to your user page'
@ -2312,7 +2312,7 @@ sq:
title: 'Aplikacion'
create: '<b>c</b> Filloni një diskutim të ri'
notifications: '<b>n</b> Open notifications'
site_map_menu: '<b>=</b> Open site menu'
hamburger_menu: '<b>=</b> Open site menu'
user_profile_menu: '<b>p</b> Open user menu'
show_incoming_updated_topics: '<b>.</b> Show updated topics'
search: '<b>/</b> Kërko'

View File

@ -783,7 +783,7 @@ sv:
category: "Sök i kategorin \"{{category}}\""
topic: "Sök i denna diskussion"
private_messages: "Sök meddelanden"
site_map: "gå till en annan ämneslista eller kategori"
hamburger_menu: "gå till en annan ämneslista eller kategori"
go_back: 'gå tillbaka'
not_logged_in_user: 'användarsida med sammanställning av aktuell aktivitet och inställningar'
current_user: 'gå till din användarsida'
@ -2222,7 +2222,7 @@ sv:
application:
create: '<b>s</b> Skapa ett nytt ämne'
notifications: '<b>n</b> Öppna notifikationer'
site_map_menu: '<b>=</b> Öppna webbplatsmeny'
hamburger_menu: '<b>=</b> Öppna webbplatsmeny'
user_profile_menu: '<b>p</b> Öppna användarmeny'
show_incoming_updated_topics: '<b>.</b> Visa uppdaterade ämnen'
search: 'Sök'

View File

@ -686,7 +686,7 @@ te:
user: "@{{username}} యొక్క విషయాలు వెతుకు"
category: "\"{{category}}\" వర్గంలో వెతుకు"
topic: "ఈ విషయంలో వెతుకు"
site_map: "మరో విషయాల జాబితాకు లేదా వర్గానికి వెళ్లు"
hamburger_menu: "మరో విషయాల జాబితాకు లేదా వర్గానికి వెళ్లు"
go_back: 'వెనక్కు మరలు'
not_logged_in_user: 'సభ్యుని ప్రస్తుత కలాపాల మరియు అభిరూపాల సారాంశ పుట'
current_user: 'మీ సభ్యపుటకు వెళ్లు'
@ -1961,7 +1961,7 @@ te:
title: 'అనువర్తనం'
create: '<b>c</b> కొత్త టపా సృష్టించు'
notifications: '<b>n</b> తెరచిన ప్రకటనలు'
site_map_menu: '<b>=</b> సైట్ మెనూ తెరువు'
hamburger_menu: '<b>=</b> సైట్ మెనూ తెరువు'
user_profile_menu: '<b>p</b> యూజర్ మెనూ తెరువు'
show_incoming_updated_topics: '<b>.</b> నవీకరించిన విషయాలను చూపించండి'
search: '<b>/</b> వెతుకు'

View File

@ -763,7 +763,7 @@ tr_TR:
category: "\"{{category}}\" kategorisinde ara"
topic: "Bu konuda ara"
private_messages: "Mesajlarda ara"
site_map: "başka bir konu listesine veya kategoriye git"
hamburger_menu: "başka bir konu listesine veya kategoriye git"
go_back: 'geri dön'
not_logged_in_user: 'güncel aktivitelerin ve ayarların özetinin bulunduğu kullanıcı sayfası'
current_user: 'kendi kullanıcı sayfana git'
@ -2195,7 +2195,7 @@ tr_TR:
title: 'Uygulama'
create: '<b>c</b> Yeni konu aç'
notifications: '<b>n</b> Bildirileri aç'
site_map_menu: '<b>=</b> Site menüsünü aç'
hamburger_menu: '<b>=</b> Site menüsünü aç'
user_profile_menu: '<b>p</b> Kullanıcı menüsünü aç'
show_incoming_updated_topics: '<b>.</b> Güncellenmiş konuları göster'
search: '<b>/</b> Arama'

View File

@ -593,7 +593,7 @@ uk:
searching: "Пошук ..."
context:
topic: "Пошук в цій темі"
site_map: "перейти до іншого переліку або категорії тем"
hamburger_menu: "перейти до іншого переліку або категорії тем"
go_back: 'повернутися назад'
not_logged_in_user: 'сторінка користувача з підсумком поточної діяльності та налаштуваннями'
current_user: 'перейти до Вашої сторінки користувача'

View File

@ -782,7 +782,7 @@ zh_CN:
category: "搜索“{{category}}”分类"
topic: "只搜索本主题"
private_messages: "搜索消息"
site_map: "去另一个主题列表或分类"
hamburger_menu: "去另一个主题列表或分类"
go_back: '返回'
not_logged_in_user: '显示当前活动和设置的用户页面'
current_user: '去你的用户页面'
@ -2230,7 +2230,7 @@ zh_CN:
title: '应用'
create: '<b>c</b> 创建一个新主题'
notifications: '<b>n</b> 打开通知菜单'
site_map_menu: '<b>=</b> 打开站点菜单'
hamburger_menu: '<b>=</b> 打开站点菜单'
user_profile_menu: '<b>p</b> 打开用户菜单'
show_incoming_updated_topics: '<b>.</b> 显示更新过的主题'
search: '<b>/</b> 搜索'

View File

@ -718,7 +718,7 @@ zh_TW:
user: "搜尋 @{{username}} 的文章"
category: "搜尋 \"{{category}}\" 分類"
topic: "搜尋此討論話題"
site_map: "到另一個討論話題列表或分類"
hamburger_menu: "到另一個討論話題列表或分類"
go_back: '返回'
not_logged_in_user: '用戶頁面包含目前活動及喜好的總結'
current_user: '到你的用戶頁面'
@ -2057,7 +2057,7 @@ zh_TW:
title: 'Application'
create: '<b>c</b> 表示新討論話題'
notifications: '<b>n</b> 開啟通知'
site_map_menu: '<b>=</b> 打開網站選單'
hamburger_menu: '<b>=</b> 打開網站選單'
user_profile_menu: '<b>p</b> 打開使用者選單'
show_incoming_updated_topics: '<b>.</b> 顯示有更新的討論話題'
search: '<b>/</b> 搜尋'

View File

@ -0,0 +1,13 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Hamburger Menu - Staff", { loggedIn: true });
test("Menu Items", (assert) => {
visit("/");
click("#toggle-hamburger-menu");
andThen(() => {
assert.ok(exists("#hamburger-menu .admin-link"));
assert.ok(exists("#hamburger-menu .flagged-posts-link"));
assert.ok(exists("#hamburger-menu .flagged-posts.badge-notification"), "it displays flag notifications");
});
});

View File

@ -0,0 +1,39 @@
import { acceptance } from "helpers/qunit-helpers";
acceptance("Hamburger Menu");
test("Toggle Menu", (assert) => {
visit("/");
andThen(() => {
assert.ok(exists("#hamburger-menu.slideright"), "hidden by default");
});
click("#toggle-hamburger-menu");
andThen(() => {
assert.ok(!exists("#hamburger-menu.slideright"), "a click makes it appear");
});
click(".close-hamburger");
andThen(() => {
assert.ok(exists("#hamburger-menu.slideright"), "clicking the X hides it");
});
});
test("Menu Items", (assert) => {
visit("/");
click("#toggle-hamburger-menu");
andThen(() => {
assert.ok(!exists("#hamburger-menu .admin-link"));
assert.ok(!exists("#hamburger-menu .flagged-posts-link"));
assert.ok(exists("#hamburger-menu .latest-topics-link"));
assert.ok(exists("#hamburger-menu .badge-link"));
assert.ok(exists("#hamburger-menu .user-directory-link"));
assert.ok(exists("#hamburger-menu .keyboard-shortcuts-link"));
assert.ok(exists("#hamburger-menu .faq-link"));
assert.ok(exists("#hamburger-menu .about-link"));
assert.ok(exists("#hamburger-menu .categories-link"));
assert.ok(exists('#hamburger-menu .category-link'));
});
});

View File

@ -7,7 +7,6 @@ test("header", () => {
ok(exists("header"), "is rendered");
ok(exists(".logo-big"), "it renders the large logo by default");
not(exists("#notifications-dropdown li"), "no notifications at first");
not(exists('#site-map-dropdown'), "no site map by default");
not(exists("#user-dropdown:visible"), "initially user dropdown is closed");
not(exists("#search-dropdown:visible"), "initially search box is closed");
});
@ -21,14 +20,6 @@ test("header", () => {
ok(exists(".logo-small"), "it shows the small logo when `showExtraInfo` is enabled");
});
// Site Map
click("#site-map");
andThen(() => {
ok(exists('#site-map-dropdown'), "is rendered after user opens it");
ok(exists("#site-map-dropdown .faq-link"), "it shows the faq link");
ok(exists("#site-map-dropdown .category-links"), "has categories correctly bound");
});
// Search
click("#search-button");
andThen(() => {

View File

@ -13,13 +13,6 @@ test("header", () => {
ok($items.first().hasClass("read"), "correctly binds items' 'read' class");
});
// Site Map
click("#site-map");
andThen(() => {
ok(exists("#site-map-dropdown .admin-link"), "it has the admin link");
ok(exists("#site-map-dropdown .flagged-posts.badge-notification"), "it displays flag notifications");
});
// User dropdown
click("#current-user");
andThen(() => {

View File

@ -37,7 +37,7 @@ test("redirect", () => {
ok(invisible('.login-modal'), "it closes the login modal");
});
click('#site-map');
click('#toggle-hamburger-menu');
andThen(() => {
ok(exists('.login-modal'), "site map opens the login modal");
});

View File

@ -55,7 +55,7 @@ module("lib:keyboard-shortcuts", {
"<div class='alert alert-info clickable'></div>",
"<button id='create-topic'></button>",
"<div id='user-notifications'></div>",
"<div id='site-map'></div>",
"<div id='toggle-hamburger-menu'></div>",
"<div id='search-button'></div>",
"<div id='current-user'></div>",
"<div id='keyboard-help'></div>"

View File

@ -1,26 +0,0 @@
moduleFor("controller:site-map-category", 'controller:site-map-category', {
needs: ['controller:site-map']
});
test("showTopicCount anonymous", function() {
var controller = this.subject();
ok(controller.get("showTopicCount"), 'true when anonymous');
});
test("showTopicCount logged in", function() {
var controller = this.subject({ currentUser: Discourse.User.create() });
ok(!controller.get("showTopicCount"), 'false when logged in');
});
test("unreadTotal default", function() {
var controller = this.subject({ currentUser: Discourse.User.create() });
ok(!controller.get('unreadTotal'), "empty by default");
});
test("unreadTotal with values", function() {
var controller = this.subject({
currentUser: Discourse.User.create(),
model: { unreadTopics: 1, newTopics: 3 }
});
equal(controller.get('unreadTotal'), 4);
});

View File

@ -1,77 +0,0 @@
var oldMobileView;
moduleFor("controller:site-map", "controller:site-map", {
needs: ['controller:application', 'controller:header'],
setup: function() {
oldMobileView = Discourse.Mobile.mobileView;
},
teardown: function() {
Discourse.Mobile.mobileView = oldMobileView;
}
});
test("showAdminLinks", function() {
const currentUser = Ember.Object.create({ staff: true });
const controller = this.subject({ currentUser });
equal(controller.get("showAdminLinks"), true, "is true when current user is a staff member");
currentUser.set("staff", false);
equal(controller.get("showAdminLinks"), false, "is false when current user is not a staff member");
});
test("faqUrl returns faq url configured in site settings if it is set", function() {
Discourse.SiteSettings.faq_url = "faq-url";
var controller = this.subject();
equal(controller.get("faqUrl"), "faq-url");
});
test("faqUrl returns default '/faq' url when there is no corresponding site setting set", function() {
Discourse.SiteSettings.faq_url = null;
var controller = this.subject();
equal(controller.get("faqUrl"), "/faq");
});
test("showMoblieToggle returns true when mobile theme is enabled in site settings", function() {
Discourse.SiteSettings.enable_mobile_theme = true;
Discourse.Mobile.isMobileDevice = true;
var controller = this.subject();
controller.capabilities = { touch: true };
equal(controller.get("showMobileToggle"), true);
});
test("showMoblieToggle returns false when mobile theme is disabled in site settings", function() {
Discourse.SiteSettings.enable_mobile_theme = false;
Discourse.Mobile.isMobileDevice = true;
var controller = this.subject();
equal(controller.get("showMobileToggle"), false);
});
test("mobileViewLinkTextKey returns translation key for a desktop view if the current view is mobile view", function() {
Discourse.Mobile.mobileView = true;
var controller = this.subject();
equal(controller.get("mobileViewLinkTextKey"), "desktop_view");
});
test("mobileViewLinkTextKey returns translation key for a mobile view if the current view is desktop view", function() {
Discourse.Mobile.mobileView = false;
var controller = this.subject();
equal(controller.get("mobileViewLinkTextKey"), "mobile_view");
});
test("categories", function() {
var categoryListStub = ["category1", "category2"];
sandbox.stub(Discourse.Category, "list").returns(categoryListStub);
var controller = this.subject({ siteSettings: Discourse.SiteSettings });
deepEqual(controller.get("categories"), categoryListStub, "returns the list of categories");
});
test("toggleMobleView", function() {
sandbox.stub(Discourse.Mobile, "toggleMobileView");
var controller = this.subject();
controller.send("toggleMobileView");
ok(Discourse.Mobile.toggleMobileView.calledOnce, "switches between desktop and mobile views");
});

View File

@ -1,7 +1,7 @@
/* global asyncTest, fixtures */
import sessionFixtures from 'fixtures/session-fixtures';
import siteFixtures from 'fixtures/site_fixtures';
import siteFixtures from 'fixtures/site-fixtures';
import HeaderView from 'discourse/views/header';
function currentUser() {

View File

@ -74,6 +74,7 @@ Discourse.SiteSettingsOriginal = {
"polling_interval":3000,
"anon_polling_interval":30000,
"flush_timings_secs":5,
"enable_user_directory":true,
"tos_url":"",
"privacy_policy_url":"",
"tos_accept_required":false,

View File

@ -75,7 +75,7 @@ if (window.Logster) {
var origDebounce = Ember.run.debounce,
createPretendServer = require('helpers/create-pretender', null, null, false).default,
fixtures = require('fixtures/site_fixtures', null, null, false).default,
fixtures = require('fixtures/site-fixtures', null, null, false).default,
flushMap = require('discourse/models/store', null, null, false).flushMap,
ScrollingDOMMethods = require('discourse/mixins/scrolling', null, null, false).ScrollingDOMMethods,
_DiscourseURL = require('discourse/lib/url', null, null, false).default,

View File

@ -0,0 +1,72 @@
/**
* jquery.detectSwipe v2.1.1
* jQuery Plugin to obtain touch gestures from iPhone, iPod Touch, iPad and Android
* http://github.com/marcandre/detect_swipe
* Based on touchwipe by Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
*/
(function($) {
$.detectSwipe = {
version: '2.1.1',
enabled: 'ontouchstart' in document.documentElement,
preventDefault: true,
threshold: 20
};
var startX,
startY,
isMoving = false;
function onTouchEnd() {
this.removeEventListener('touchmove', onTouchMove);
this.removeEventListener('touchend', onTouchEnd);
isMoving = false;
}
function onTouchMove(e) {
if ($.detectSwipe.preventDefault) { e.preventDefault(); }
if(isMoving) {
var x = e.touches[0].pageX;
var y = e.touches[0].pageY;
var dx = startX - x;
var dy = startY - y;
var dir;
if(Math.abs(dx) >= $.detectSwipe.threshold) {
dir = dx > 0 ? 'left' : 'right'
}
else if(Math.abs(dy) >= $.detectSwipe.threshold) {
dir = dy > 0 ? 'down' : 'up'
}
if(dir) {
onTouchEnd.call(this);
$(this).trigger('swipe', dir).trigger('swipe' + dir);
}
}
}
function onTouchStart(e) {
if (e.touches.length === 1) {
startX = e.touches[0].pageX;
startY = e.touches[0].pageY;
isMoving = true;
this.addEventListener('touchmove', onTouchMove, false);
this.addEventListener('touchend', onTouchEnd, false);
}
}
function setup() {
this.addEventListener && this.addEventListener('touchstart', onTouchStart, false);
}
function teardown() {
this.removeEventListener('touchstart', onTouchStart);
}
$.event.special.swipe = { setup: setup, teardown: teardown };
$.each(['left', 'up', 'down', 'right'], function () {
$.event.special['swipe' + this] = { setup: function() {
$(this).on('swipe', $.noop);
} };
});
})(jQuery);