Merge pull request #2932 from awesomerobot/master

new usercard style
This commit is contained in:
Sam 2014-10-30 11:01:05 +11:00
commit cd0ff7b0f2
7 changed files with 98 additions and 57 deletions

View File

@ -83,7 +83,6 @@
</div> </div>
</div> </div>
{{#if currentUser.admin}} {{#if currentUser.admin}}
<div class='display-row'> <div class='display-row'>
<div class='field'>{{i18n admin.groups.title}}</div> <div class='field'>{{i18n admin.groups.title}}</div>

View File

@ -1,37 +1,22 @@
{{#if username}} {{#if username}}
<div class="card-content">
{{#link-to 'user' user}}{{bound-avatar avatar "huge"}}{{/link-to}} {{#link-to 'user' user}}{{bound-avatar avatar "huge"}}{{/link-to}}
<div class="names"> <div class="names">
<span>
<h1 {{bind-attr class="staff new_user"}}> <h1 {{bind-attr class="staff new_user"}}>
{{#link-to 'user' user}}{{username}}{{/link-to}} {{#link-to 'user' user}}{{username}}{{/link-to}}
</h1> </h1>
{{#if showName}} {{#if showName}}
<h2>{{#link-to 'user' user}}{{name}}{{/link-to}}</h2> <h2>{{#link-to 'user' user}}{{name}}{{/link-to}}</h2>
{{/if}} {{/if}}
</span>
</div> </div>
{{#if showBadges}}
<div class="badge-section">
{{#each user.featured_user_badges}}
{{user-badge badge=badge}}
{{/each}}
{{#if showMoreBadges}}
{{#link-to 'user.badges' user class="btn more-user-badges"}}
{{i18n badges.more_badges count=moreBadgesCount}}
{{/link-to}}
{{/if}}
</div>
{{/if}}
{{#if user}} {{#if user}}
<div class="metadata">
{{#if user.location}}<h3>{{fa-icon "map-marker"}} {{user.location}}</h3>{{/if}}
<h3>{{i18n last_post}} {{format-date path="user.last_posted_at" leaveAgo="true"}}</h3>
<h3>{{i18n joined}} {{format-date path="user.created_at" leaveAgo="true"}}</h3>
{{groups-list groups=user.custom_groups}}
</div>
<div class='bottom'>
{{#if isSuspended}} {{#if isSuspended}}
<div class='suspended'> <div class='suspended'>
{{fa-icon "ban"}} {{fa-icon "ban"}}
@ -42,25 +27,41 @@
{{#if user.bio_cooked}}<div class='bio'>{{{user.bio_cooked}}}</div>{{/if}} {{#if user.bio_cooked}}<div class='bio'>{{{user.bio_cooked}}}</div>{{/if}}
{{/if}} {{/if}}
{{#if showBadges}}
<div class="badge-section">
{{#each user.featured_user_badges}}
{{user-badge badge=badge}}
{{/each}}
{{#if showMoreBadges}}
{{#link-to 'user.badges' user class="btn more-user-badges"}}
{{i18n badges.more_badges count=moreBadgesCount}}
{{/link-to}}
{{/if}}
</div>
{{/if}}
<ul class="usercard-controls">
{{#if user.can_send_private_message_to_user}} {{#if user.can_send_private_message_to_user}}
<button class='btn btn-primary' {{action "composePrivateMessage" user}}>{{fa-icon "envelope"}}{{i18n user.private_message}}</button> <li><a class='btn btn-primary' {{action "composePrivateMessage" user}}>{{fa-icon "envelope"}}{{i18n user.private_message}}</a></li>
{{/if}} {{/if}}
{{#link-to 'user' user class="btn"}}{{fa-icon "user"}}{{i18n user.profile}}{{/link-to}} <li>{{#link-to 'user' user class="btn"}}{{fa-icon "user"}}{{i18n user.profile}}{{/link-to}}</li>
{{#if showFilter}} {{#if showFilter}}
<button class='btn' {{action "togglePosts" user}}>{{fa-icon "filter"}}{{i18n topic.filter_to username="username" post_count="participant.post_count"}}</button> <li><a class='btn' {{action "togglePosts" user}}>{{fa-icon "filter"}}{{i18n topic.filter_to username="username" post_count="participant.post_count"}}</a></li>
{{/if}} {{/if}}
{{#if hasUserFilters}} {{#if hasUserFilters}}
<button class='btn' {{action "cancelFilter"}}>{{fa-icon "times"}}{{i18n topic.filters.cancel}}</button> <li><a class='btn' {{action "cancelFilter"}}>{{fa-icon "times"}}{{i18n topic.filters.cancel}}</a></li>
{{/if}} {{/if}}
</ul>
{{#if user.card_badge}} {{#if user.card_badge}}
{{#link-to 'badges.show' user.card_badge class="card-badge"}} {{#link-to 'badges.show' user.card_badge class="card-badge"}}
{{icon-or-image user.card_badge.image}} {{icon-or-image user.card_badge.image}}
{{/link-to}} {{/link-to}}
{{/if}} {{/if}}
</div> </div>
{{else}} {{else}}
<p class='loading'>{{i18n loading}}</p> <p class='loading'>{{i18n loading}}</p>

View File

@ -39,7 +39,6 @@
<div class='details'> <div class='details'>
<div class='primary'> <div class='primary'>
{{bound-avatar model "huge"}} {{bound-avatar model "huge"}}
<section class='controls'> <section class='controls'>
@ -217,6 +216,5 @@
</section> </section>
</div> </div>
{{/unless}} {{/unless}}

View File

@ -17,9 +17,9 @@ export default Discourse.View.extend(CleansUp, {
if (!$this) { return; } if (!$this) { return; }
if (Ember.empty(url)) { if (Ember.empty(url)) {
$this.css('background-image', ''); $this.css('background-image', '').addClass('no-bg');
} else { } else {
$this.css('background-image', "url(" + url + ")"); $this.css('background-image', "url(" + url + ")").removeClass('no-bg');
} }
}.observes('controller.user.card_background'), }.observes('controller.user.card_background'),

View File

@ -37,7 +37,6 @@
} }
// Base list // Base list
// -------------------------------------------------- // --------------------------------------------------

View File

@ -2,18 +2,33 @@
#user-card { #user-card {
position: absolute; position: absolute;
width: 460px; width: 500px;
left: 20px; left: 20px;
z-index: 990; z-index: 990;
box-shadow: 0 2px 6px rgba(0,0,0, .6); box-shadow: 0 2px 6px rgba(0,0,0, .6);
margin-top: -2px; margin-top: -2px;
background-color: $secondary; background-color: $primary;
padding: 12px 12px 5px 12px; color: $secondary;
border: 1px solid scale-color-diff();
background-size: cover; background-size: cover;
background-position: center center; background-position: center center;
.card-content {
padding: 12px;
background: rgba($primary, .85);
margin-top: 100px;
&:after {
content: '';
display: block;
clear: both;
}
}
&.no-bg {
.card-content {
margin-top: 0;
}
}
.avatar-placeholder { .avatar-placeholder {
width: 120px; width: 120px;
height: 120px; height: 120px;
@ -27,12 +42,12 @@
font-size: 25px; font-size: 25px;
line-height: 1.25; line-height: 1.25;
display: block; display: block;
max-width: 280px; max-width: 250px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
a { a {
color: $primary; color: $secondary;
} }
} }
@ -41,13 +56,12 @@
line-height: 1.25; line-height: 1.25;
font-weight: normal; font-weight: normal;
display: block; display: block;
max-width: 280px; max-width: 250px;
white-space: nowrap; white-space: nowrap;
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
a { a {
color: $primary; color: $secondary;
} }
} }
@ -58,6 +72,9 @@
color: scale-color($primary, $lightness: 50%); color: scale-color($primary, $lightness: 50%);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
a {
color: $secondary;
}
} }
.groups { .groups {
font-size: 13px; font-size: 13px;
@ -84,9 +101,15 @@
} }
.bio { .bio {
max-height: 100px; max-height: 55px;
overflow: auto; overflow: auto;
margin-bottom: 10px; float: left;
margin: 10px 0;
width: 70%;
a {
color: $secondary;
text-decoration: underline;
}
img { img {
max-width: 100%; max-width: 100%;
} }
@ -95,6 +118,7 @@
img.avatar { img.avatar {
float: left; float: left;
padding-right: 10px; padding-right: 10px;
margin-top: -60px;
} }
p { p {
@ -108,6 +132,16 @@
.btn { .btn {
margin: 0 0 7px 0; margin: 0 0 7px 0;
box-sizing: border-box;
}
.usercard-controls {
list-style-type: none;
margin: 0;
position: absolute;
right: 12px;
a {width: 100%; min-width: 150px;}
} }
.new-user a { .new-user a {
@ -115,17 +149,32 @@
} }
&.show-badges { &.show-badges {
width: 560px; width: 580px;
.names { .names {
width: 250px;
float: left; float: left;
height: 60px;
position: relative;
width: 45%;
span {
position: absolute;
bottom: 0;
display: block;
}
} }
.badge-section { .badge-section {
margin-top: 10px; margin-top: 10px;
float: left; float: left;
width: 270px; width: 390px;
.user-badge {
background: transparent;
color: $secondary;
}
h3 { h3 {
color: $primary; color: $primary;

View File

@ -6,11 +6,6 @@
} }
} }
.has-background .details {
}
.profile-image { .profile-image {
height: 250px; height: 250px;
width: 100%; width: 100%;