mirror of
https://github.com/discourse/discourse.git
synced 2025-09-10 21:01:33 +08:00
Add groups list to the poster expansion when you click an avatar while
in a topic.
This commit is contained in:
parent
25070dcde7
commit
b61b33c0fa
9 changed files with 66 additions and 19 deletions
|
@ -0,0 +1,12 @@
|
||||||
|
/**
|
||||||
|
Displays a list of groups that a user belongs to.
|
||||||
|
|
||||||
|
@class Discourse.GroupsListComponent
|
||||||
|
@extends Ember.Component
|
||||||
|
@namespace Discourse
|
||||||
|
@module Discourse
|
||||||
|
**/
|
||||||
|
Discourse.GroupsListComponent = Em.Component.extend({
|
||||||
|
classNames: ['groups']
|
||||||
|
});
|
||||||
|
|
18
app/assets/javascripts/discourse/mixins/scroll_top.js
Normal file
18
app/assets/javascripts/discourse/mixins/scroll_top.js
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
/**
|
||||||
|
This mixin will cause a view to scroll the viewport to the top once it has been inserted
|
||||||
|
|
||||||
|
@class Discourse.ScrollTop
|
||||||
|
@extends Ember.Mixin
|
||||||
|
@namespace Discourse
|
||||||
|
@module Discourse
|
||||||
|
**/
|
||||||
|
Discourse.ScrollTop = Em.Mixin.create({
|
||||||
|
|
||||||
|
_scrollTop: function() {
|
||||||
|
Em.run.schedule('afterRender', function() {
|
||||||
|
$(document).scrollTop(0);
|
||||||
|
});
|
||||||
|
}.on('didInsertElement'),
|
||||||
|
|
||||||
|
});
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
{{#if groups}}
|
||||||
|
{{i18n groups.title count=groups.length}}:
|
||||||
|
{{#each groups}}
|
||||||
|
{{#link-to 'group' this class="group-link"}}{{name}}{{/link-to}}
|
||||||
|
{{/each}}
|
||||||
|
{{/if}}
|
|
@ -10,6 +10,8 @@
|
||||||
<h3>{{i18n last_post}} {{unboundDate path="user.last_posted_at" leaveAgo="true"}}</h3>
|
<h3>{{i18n last_post}} {{unboundDate path="user.last_posted_at" leaveAgo="true"}}</h3>
|
||||||
<h3>{{i18n joined}} {{unboundDate path="user.created_at" leaveAgo="true"}}</h3>
|
<h3>{{i18n joined}} {{unboundDate path="user.created_at" leaveAgo="true"}}</h3>
|
||||||
|
|
||||||
|
{{groups-list groups=user.custom_groups}}
|
||||||
|
|
||||||
<div class='bottom'>
|
<div class='bottom'>
|
||||||
{{#if user.bio_cooked}}<div class='bio'>{{{user.bio_cooked}}}</div>{{/if}}
|
{{#if user.bio_cooked}}<div class='bio'>{{{user.bio_cooked}}}</div>{{/if}}
|
||||||
|
|
||||||
|
|
|
@ -43,14 +43,7 @@
|
||||||
|
|
||||||
<div class='bio'>{{{bio_cooked}}}</div>
|
<div class='bio'>{{{bio_cooked}}}</div>
|
||||||
|
|
||||||
{{#if custom_groups}}
|
{{groups-list groups=custom_groups}}
|
||||||
<div class='groups'>
|
|
||||||
{{i18n groups.title count=custom_groups.length}}:
|
|
||||||
{{#each custom_groups}}
|
|
||||||
{{#link-to 'group' this class="group-link"}}{{name}}{{/link-to}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if isSuspended}}
|
{{#if isSuspended}}
|
||||||
<div class='suspended'>
|
<div class='suspended'>
|
||||||
|
|
|
@ -7,15 +7,9 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.DiscoveryTopicsView = Discourse.View.extend(Discourse.LoadMore, {
|
Discourse.DiscoveryTopicsView = Discourse.View.extend(Discourse.ScrollTop, Discourse.LoadMore, {
|
||||||
eyelineSelector: '.topic-list-item',
|
eyelineSelector: '.topic-list-item',
|
||||||
|
|
||||||
_scrollTop: function() {
|
|
||||||
Em.run.schedule('afterRender', function() {
|
|
||||||
$(document).scrollTop(0);
|
|
||||||
});
|
|
||||||
}.on('didInsertElement'),
|
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
loadMore: function() {
|
loadMore: function() {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
Discourse.GroupIndexView = Discourse.View.extend(Discourse.LoadMore, {
|
/**
|
||||||
|
Displays all posts within a group
|
||||||
|
|
||||||
|
@class Discourse.GroupIndexView
|
||||||
|
@extends Ember.Mixin
|
||||||
|
@namespace Discourse
|
||||||
|
@module Discourse
|
||||||
|
**/
|
||||||
|
Discourse.GroupIndexView = Discourse.View.extend(Discourse.ScrollTop, Discourse.LoadMore, {
|
||||||
eyelineSelector: '.user-stream .item'
|
eyelineSelector: '.user-stream .item'
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,16 @@
|
||||||
margin-top: 0px;
|
margin-top: 0px;
|
||||||
color: $primary_medium;
|
color: $primary_medium;
|
||||||
}
|
}
|
||||||
|
.groups {
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: normal;
|
||||||
|
margin-top: 0px;
|
||||||
|
color: $primary_medium;
|
||||||
|
|
||||||
|
.group-link {
|
||||||
|
color: $primary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.bottom {
|
.bottom {
|
||||||
clear: both;
|
clear: both;
|
||||||
|
|
|
@ -2,6 +2,12 @@
|
||||||
@import "common/foundation/variables";
|
@import "common/foundation/variables";
|
||||||
@import "common/foundation/mixins";
|
@import "common/foundation/mixins";
|
||||||
|
|
||||||
|
.groups {
|
||||||
|
.group-link {
|
||||||
|
color: $tertiary_lightest;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.user-preferences {
|
.user-preferences {
|
||||||
input.category-group {
|
input.category-group {
|
||||||
width: 500px;
|
width: 500px;
|
||||||
|
@ -210,9 +216,6 @@
|
||||||
|
|
||||||
h1, h2 {margin-top: 10px;}
|
h1, h2 {margin-top: 10px;}
|
||||||
|
|
||||||
.group-link {
|
|
||||||
color: $tertiary_lightest;
|
|
||||||
}
|
|
||||||
.bio {
|
.bio {
|
||||||
color: $primary_lighter;
|
color: $primary_lighter;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue