Collapse user details when not viewing index view

This commit is contained in:
Robin Ward 2013-10-17 11:25:29 -04:00
parent f8625b5510
commit a215fc5bdc
7 changed files with 50 additions and 2 deletions

View File

@ -12,6 +12,10 @@ Discourse.UserController = Discourse.ObjectController.extend({
return this.get('content.username') === Discourse.User.currentProp('username'); return this.get('content.username') === Discourse.User.currentProp('username');
}.property('content.username'), }.property('content.username'),
collapsedInfo: function() {
return !this.get('indexStream');
}.property('indexStream'),
canSeePrivateMessages: function() { canSeePrivateMessages: function() {
return this.get('viewingSelf') || Discourse.User.currentProp('staff'); return this.get('viewingSelf') || Discourse.User.currentProp('staff');
}.property('viewingSelf'), }.property('viewingSelf'),

View File

@ -22,6 +22,8 @@ Discourse.UserActivityStreamRoute = Discourse.Route.extend({
setupController: function(controller, model) { setupController: function(controller, model) {
controller.set('model', model); controller.set('model', model);
this.controllerFor('user_activity').set('userActionType', this.get('userActionType')); this.controllerFor('user_activity').set('userActionType', this.get('userActionType'));
this.controllerFor('user').set('indexStream', !this.get('userActionType'));
} }
}); });

View File

@ -7,6 +7,7 @@ Discourse.UserTopicListRoute = Discourse.Route.extend({
setupController: function(controller, model) { setupController: function(controller, model) {
this.controllerFor('user_activity').set('userActionType', this.get('userActionType')); this.controllerFor('user_activity').set('userActionType', this.get('userActionType'));
controller.set('model', model); controller.set('model', model);
this.controllerFor('user').set('indexStream', false);
} }
}); });
@ -21,7 +22,10 @@ function createPMRoute(viewName, path, type) {
setupController: function(controller, model) { setupController: function(controller, model) {
this._super(controller, model); this._super(controller, model);
controller.set('hideCategories', true); controller.set('hideCategories', true);
this.controllerFor('user').set('pmView', viewName); this.controllerFor('user').setProperties({
pmView: viewName,
indexStream: false
});
} }
}); });
} }

View File

@ -33,7 +33,8 @@
</section> </section>
<section class='user-main'> <section class='user-main'>
<section class='about'> <section {{bindAttr class="collapsedInfo :about"}}>
<div class='details'> <div class='details'>
<div class='primary'> <div class='primary'>
{{boundAvatar model imageSize="huge"}} {{boundAvatar model imageSize="huge"}}

View File

@ -129,6 +129,43 @@
@include border-radius-all(4px); @include border-radius-all(4px);
} }
.about.collapsed-info {
.controls {
margin-top: 0;
}
.details {
.secondary { display: none; }
.bio { display: none; }
.primary {
width: 100%;
text-align: left;
margin-top: 0;
.avatar {
float: left;
margin-right: 10px;
border: 2px solid white;
width: 45px;
height: 45px;
}
h1 {
font-size: 20px;
line-height: 22px;
}
h2 {
font-size: 17px;
line-height: 20px;
margin-top: 4px;
}
}
}
}
.about { .about {
background-color: #444; background-color: #444;
margin-bottom: 10px; margin-bottom: 10px;