mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -05:00
UX: initial take at collapsing mobile nav on user page
This commit is contained in:
parent
86819f08c3
commit
3e87250215
12 changed files with 127 additions and 20 deletions
|
@ -0,0 +1,38 @@
|
||||||
|
export default Ember.Component.extend({
|
||||||
|
|
||||||
|
_init: function(){
|
||||||
|
if (!this.get('site.mobileView')) {
|
||||||
|
var classes = this.get('desktopClass');
|
||||||
|
if (classes) {
|
||||||
|
classes = classes.split(' ');
|
||||||
|
this.set('classNames', classes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.on('init'),
|
||||||
|
|
||||||
|
tagName: 'ul',
|
||||||
|
|
||||||
|
classNames: ['mobile-nav'],
|
||||||
|
|
||||||
|
currentPathChanged: function(){
|
||||||
|
this.set('expanded', false);
|
||||||
|
Em.run.next(() => this._updateSelectedHtml());
|
||||||
|
}.observes('currentPath'),
|
||||||
|
|
||||||
|
_updateSelectedHtml(){
|
||||||
|
const active = this.$('.active');
|
||||||
|
if (active && active.html) {
|
||||||
|
this.set('selectedHtml', active.html());
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
didInsertElement(){
|
||||||
|
this._updateSelectedHtml();
|
||||||
|
},
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
toggleExpanded(){
|
||||||
|
this.toggleProperty('expanded');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
|
@ -3,7 +3,7 @@ import { exportUserArchive } from 'discourse/lib/export-csv';
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
userActionType: null,
|
userActionType: null,
|
||||||
needs: ["application", "user"],
|
needs: ["application", "user"],
|
||||||
|
currentPath: Em.computed.alias('controllers.application.currentPath'),
|
||||||
viewingSelf: Em.computed.alias("controllers.user.viewingSelf"),
|
viewingSelf: Em.computed.alias("controllers.user.viewingSelf"),
|
||||||
showBookmarks: Em.computed.alias("controllers.user.showBookmarks"),
|
showBookmarks: Em.computed.alias("controllers.user.showBookmarks"),
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@ export default Ember.ArrayController.extend({
|
||||||
|
|
||||||
showDismissButton: Ember.computed.gt('user.total_unread_notifications', 0),
|
showDismissButton: Ember.computed.gt('user.total_unread_notifications', 0),
|
||||||
|
|
||||||
|
currentPath: Em.computed.alias('controllers.application.currentPath'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
resetNew: function() {
|
resetNew: function() {
|
||||||
Discourse.ajax('/notifications/mark-read', { method: 'PUT' }).then(() => {
|
Discourse.ajax('/notifications/mark-read', { method: 'PUT' }).then(() => {
|
||||||
|
|
|
@ -3,11 +3,11 @@ import Topic from 'discourse/models/topic';
|
||||||
|
|
||||||
export default Ember.Controller.extend({
|
export default Ember.Controller.extend({
|
||||||
|
|
||||||
needs: ["user-topics-list", "user"],
|
needs: ["application", "user-topics-list", "user"],
|
||||||
pmView: false,
|
pmView: false,
|
||||||
viewingSelf: Em.computed.alias("controllers.user.viewingSelf"),
|
viewingSelf: Em.computed.alias('controllers.user.viewingSelf'),
|
||||||
isGroup: Em.computed.equal('pmView', 'groups'),
|
isGroup: Em.computed.equal('pmView', 'groups'),
|
||||||
|
currentPath: Em.computed.alias('controllers.application.currentPath'),
|
||||||
selected: Em.computed.alias('controllers.user-topics-list.selected'),
|
selected: Em.computed.alias('controllers.user-topics-list.selected'),
|
||||||
bulkSelectEnabled: Em.computed.alias('controllers.user-topics-list.bulkSelectEnabled'),
|
bulkSelectEnabled: Em.computed.alias('controllers.user-topics-list.bulkSelectEnabled'),
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ import User from 'discourse/models/user';
|
||||||
export default Ember.Controller.extend(CanCheckEmails, {
|
export default Ember.Controller.extend(CanCheckEmails, {
|
||||||
indexStream: false,
|
indexStream: false,
|
||||||
userActionType: null,
|
userActionType: null,
|
||||||
needs: ['user-notifications', 'user-topics-list'],
|
needs: ['application','user-notifications', 'user-topics-list'],
|
||||||
|
currentPath: Em.computed.alias('controllers.application.currentPath'),
|
||||||
|
|
||||||
@computed("content.username")
|
@computed("content.username")
|
||||||
viewingSelf(username) {
|
viewingSelf(username) {
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{{yield}}
|
|
@ -0,0 +1,4 @@
|
||||||
|
<li><a {{action 'toggleExpanded'}}>{{{selectedHtml}}} <i class='fa fa-caret-down'></i></a></li>
|
||||||
|
<ul class='drop {{if expanded 'expanded'}}'>
|
||||||
|
{{yield}}
|
||||||
|
</ul>
|
|
@ -1,26 +1,21 @@
|
||||||
<section class='user-navigation'>
|
<section class='user-navigation'>
|
||||||
<ul class='action-list activity-list nav-stacked'>
|
{{#mobile-nav class='activity-nav' desktopClass='action-list activity-list nav-stacked' currentPath=currentPath}}
|
||||||
|
|
||||||
<li class='no-glyph'>
|
<li class='no-glyph'>
|
||||||
{{#link-to 'userActivity.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
|
{{#link-to 'userActivity.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class='no-glyph'>
|
<li class='no-glyph'>
|
||||||
{{#link-to 'userActivity.topics'}}{{i18n 'user_action_groups.4'}}{{/link-to}}
|
{{#link-to 'userActivity.topics'}}{{i18n 'user_action_groups.4'}}{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
{{#link-to 'userActivity.replies'}}
|
{{#link-to 'userActivity.replies'}}
|
||||||
<i class="glyph fa fa-reply"></i>{{i18n 'user_action_groups.5'}}
|
<i class="glyph fa fa-reply"></i>{{i18n 'user_action_groups.5'}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
{{#link-to 'userActivity.likesGiven'}}
|
{{#link-to 'userActivity.likesGiven'}}
|
||||||
<i class="glyph fa fa-heart"></i>{{i18n 'user_action_groups.1'}}
|
<i class="glyph fa fa-heart"></i>{{i18n 'user_action_groups.1'}}
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
{{#if showBookmarks}}
|
{{#if showBookmarks}}
|
||||||
<li>
|
<li>
|
||||||
{{#link-to 'userActivity.bookmarks'}}
|
{{#link-to 'userActivity.bookmarks'}}
|
||||||
|
@ -28,7 +23,7 @@
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
{{/mobile-nav}}
|
||||||
|
|
||||||
{{#if viewingSelf}}
|
{{#if viewingSelf}}
|
||||||
<div class='user-archive'>
|
<div class='user-archive'>
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
{{d-button class="btn-primary new-private-message" action="composePrivateMessage" icon="envelope" label="user.new_private_message"}}
|
{{d-button class="btn-primary new-private-message" action="composePrivateMessage" icon="envelope" label="user.new_private_message"}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
<ul class='action-list nav-stacked'>
|
|
||||||
|
{{#mobile-nav class='messages-nav' desktopClass='nav-stacked action-list' currentPath=currentPath}}
|
||||||
<li class="noGlyph">
|
<li class="noGlyph">
|
||||||
{{#link-to 'userPrivateMessages.index' model}}
|
{{#link-to 'userPrivateMessages.index' model}}
|
||||||
{{i18n 'user.messages.inbox'}}
|
{{i18n 'user.messages.inbox'}}
|
||||||
|
@ -35,7 +36,7 @@
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
{{/mobile-nav}}
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
<section class='user-navigation'>
|
<section class='user-navigation'>
|
||||||
<ul class='notification-list action-list nav-stacked'>
|
{{#mobile-nav class='notifications-nav' desktopClass='notification-list action-list nav-stacked' currentPath=currentPath}}
|
||||||
{{#if model}}
|
{{#if model}}
|
||||||
<li class='no-glyph'>
|
<li class='no-glyph'>
|
||||||
{{#link-to 'userNotifications.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
|
{{#link-to 'userNotifications.index'}}{{i18n 'user.filters.all'}}{{/link-to}}
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li>{{#link-to 'userNotifications.mentions'}}<i class="glyph fa fa-at"></i>{{i18n 'user_action_groups.7'}}{{/link-to}}</li>
|
<li>{{#link-to 'userNotifications.mentions'}}<i class="glyph fa fa-at"></i>{{i18n 'user_action_groups.7'}}{{/link-to}}</li>
|
||||||
<li>{{#link-to 'userNotifications.edits'}}<i class="glyph fa fa-pencil"></i>{{i18n 'user_action_groups.11'}}{{/link-to}}</li>
|
<li>{{#link-to 'userNotifications.edits'}}<i class="glyph fa fa-pencil"></i>{{i18n 'user_action_groups.11'}}{{/link-to}}</li>
|
||||||
</ul>
|
{{/mobile-nav}}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class='user-right'>
|
<section class='user-right'>
|
||||||
|
|
|
@ -148,13 +148,12 @@
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<ul class="nav nav-pills user-nav">
|
{{#mobile-nav class='main-nav' desktopClass="nav nav-pills user-nav" currentPath=currentPath}}
|
||||||
<li>{{#link-to 'userActivity'}}{{i18n 'user.activity_stream'}}{{/link-to}}</li>
|
<li>{{#link-to 'userActivity'}}{{i18n 'user.activity_stream'}}{{/link-to}}</li>
|
||||||
{{#if showNotificationsTab}}
|
{{#if showNotificationsTab}}
|
||||||
<li>
|
<li>
|
||||||
{{#link-to 'userNotifications'}}
|
{{#link-to 'userNotifications'}}
|
||||||
{{fa-icon "comment" class="glyph"}}
|
{{fa-icon "comment" class="glyph"}}{{i18n 'user.notifications'}}
|
||||||
{{i18n 'user.notifications'}}
|
|
||||||
{{/link-to}}
|
{{/link-to}}
|
||||||
</li>
|
</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -171,7 +170,7 @@
|
||||||
{{#if model.can_edit}}
|
{{#if model.can_edit}}
|
||||||
<li>{{#link-to 'preferences'}}{{fa-icon "cog"}}{{i18n 'user.preferences'}}{{/link-to}}</li>
|
<li>{{#link-to 'preferences'}}{{fa-icon "cog"}}{{i18n 'user.preferences'}}{{/link-to}}</li>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</ul>
|
{{/mobile-nav}}
|
||||||
|
|
||||||
<div class='user-table'>
|
<div class='user-table'>
|
||||||
<div class='wrapper'>
|
<div class='wrapper'>
|
||||||
|
|
|
@ -93,3 +93,69 @@ h2#site-text-logo
|
||||||
.badge-wrapper {
|
.badge-wrapper {
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-table {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mobile-view .mobile-nav {
|
||||||
|
&.messages-nav, &.notifications-nav, &.activity-nav {
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
top: -55px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.mobile-view .mobile-nav {
|
||||||
|
a .fa {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: $primary;
|
||||||
|
}
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background: dark-light-diff($primary, $secondary, 90%, -65%);
|
||||||
|
list-style: none;
|
||||||
|
overflow: visible;
|
||||||
|
position: relative;
|
||||||
|
width: 40%;
|
||||||
|
|
||||||
|
> li > a {
|
||||||
|
padding: 8px 10px;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.fa-caret-down {
|
||||||
|
position: absolute;
|
||||||
|
right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.drop {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.drop.expanded {
|
||||||
|
left: 0;
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 10000000;
|
||||||
|
background-color: $secondary;
|
||||||
|
width: 98%;
|
||||||
|
list-style: none;
|
||||||
|
margin: 0;
|
||||||
|
padding: 5px;
|
||||||
|
border: 1px solid #eaeaea;
|
||||||
|
li {
|
||||||
|
margin: 5px 0;
|
||||||
|
padding: 0;
|
||||||
|
a {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
display: block;
|
||||||
|
padding: 5px 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue