From a215fc5bdc39d1a0f51405b762bd0f89d1910ef9 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 17 Oct 2013 11:25:29 -0400 Subject: [PATCH] Collapse user details when not viewing index view --- .../discourse/controllers/user_controller.js | 4 ++ .../routes/user_activity_stream_route.js | 2 + ...nvited_routes.js => user_invited_route.js} | 0 .../routes/{user_routes.js => user_route.js} | 0 .../routes/user_topic_list_routes.js | 6 ++- .../templates/user/user.js.handlebars | 3 +- app/assets/stylesheets/desktop/user.scss | 37 +++++++++++++++++++ 7 files changed, 50 insertions(+), 2 deletions(-) rename app/assets/javascripts/discourse/routes/{user_invited_routes.js => user_invited_route.js} (100%) rename app/assets/javascripts/discourse/routes/{user_routes.js => user_route.js} (100%) diff --git a/app/assets/javascripts/discourse/controllers/user_controller.js b/app/assets/javascripts/discourse/controllers/user_controller.js index 2872d5c6ffd..74f221c60bc 100644 --- a/app/assets/javascripts/discourse/controllers/user_controller.js +++ b/app/assets/javascripts/discourse/controllers/user_controller.js @@ -12,6 +12,10 @@ Discourse.UserController = Discourse.ObjectController.extend({ return this.get('content.username') === Discourse.User.currentProp('username'); }.property('content.username'), + collapsedInfo: function() { + return !this.get('indexStream'); + }.property('indexStream'), + canSeePrivateMessages: function() { return this.get('viewingSelf') || Discourse.User.currentProp('staff'); }.property('viewingSelf'), diff --git a/app/assets/javascripts/discourse/routes/user_activity_stream_route.js b/app/assets/javascripts/discourse/routes/user_activity_stream_route.js index 8106599300a..8b482187110 100644 --- a/app/assets/javascripts/discourse/routes/user_activity_stream_route.js +++ b/app/assets/javascripts/discourse/routes/user_activity_stream_route.js @@ -22,6 +22,8 @@ Discourse.UserActivityStreamRoute = Discourse.Route.extend({ setupController: function(controller, model) { controller.set('model', model); this.controllerFor('user_activity').set('userActionType', this.get('userActionType')); + + this.controllerFor('user').set('indexStream', !this.get('userActionType')); } }); diff --git a/app/assets/javascripts/discourse/routes/user_invited_routes.js b/app/assets/javascripts/discourse/routes/user_invited_route.js similarity index 100% rename from app/assets/javascripts/discourse/routes/user_invited_routes.js rename to app/assets/javascripts/discourse/routes/user_invited_route.js diff --git a/app/assets/javascripts/discourse/routes/user_routes.js b/app/assets/javascripts/discourse/routes/user_route.js similarity index 100% rename from app/assets/javascripts/discourse/routes/user_routes.js rename to app/assets/javascripts/discourse/routes/user_route.js diff --git a/app/assets/javascripts/discourse/routes/user_topic_list_routes.js b/app/assets/javascripts/discourse/routes/user_topic_list_routes.js index 127d0dbe428..e0529d550d9 100644 --- a/app/assets/javascripts/discourse/routes/user_topic_list_routes.js +++ b/app/assets/javascripts/discourse/routes/user_topic_list_routes.js @@ -7,6 +7,7 @@ Discourse.UserTopicListRoute = Discourse.Route.extend({ setupController: function(controller, model) { this.controllerFor('user_activity').set('userActionType', this.get('userActionType')); controller.set('model', model); + this.controllerFor('user').set('indexStream', false); } }); @@ -21,7 +22,10 @@ function createPMRoute(viewName, path, type) { setupController: function(controller, model) { this._super(controller, model); controller.set('hideCategories', true); - this.controllerFor('user').set('pmView', viewName); + this.controllerFor('user').setProperties({ + pmView: viewName, + indexStream: false + }); } }); } diff --git a/app/assets/javascripts/discourse/templates/user/user.js.handlebars b/app/assets/javascripts/discourse/templates/user/user.js.handlebars index 9ed035c5e09..e4bc1ded5a9 100644 --- a/app/assets/javascripts/discourse/templates/user/user.js.handlebars +++ b/app/assets/javascripts/discourse/templates/user/user.js.handlebars @@ -33,7 +33,8 @@
-
+
+
{{boundAvatar model imageSize="huge"}} diff --git a/app/assets/stylesheets/desktop/user.scss b/app/assets/stylesheets/desktop/user.scss index fc961f4ab5f..27ea4c57a9a 100644 --- a/app/assets/stylesheets/desktop/user.scss +++ b/app/assets/stylesheets/desktop/user.scss @@ -129,6 +129,43 @@ @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 { background-color: #444; margin-bottom: 10px;