Adjusting design of profile and entry pages, linkify mentions in statuses

This commit is contained in:
Eugen Rochko 2016-03-05 23:42:40 +01:00
parent 6045b6cb18
commit ab80ebdeec
9 changed files with 75 additions and 41 deletions

View file

@ -1,39 +1,40 @@
.card { .card {
display: flex; background: $primary-color image-url('background-photo.jpeg');
background: $primary-color; background-size: cover;
box-shadow: 4px 3px 0 rgba(0, 0, 0, 0.1); padding: 80px 0;
padding-bottom: 30px;
border-radius: 4px 4px 0 0;
.bio { .bio {
flex-grow: 1;
} }
.name { .name {
display: block;
font-size: 20px; font-size: 20px;
line-height: 18px * 1.5; line-height: 18px * 1.5;
color: $quaternary-color; color: #fff;
font-weight: 500;
text-align: center;
small { small {
display: block; display: block;
font-size: 14px; font-size: 14px;
color: $quaternary-color; color: #2b90d9;
font-weight: 400;
} }
} }
.avatar { .avatar {
width: 96px; width: 120px;
float: left; margin: 0 auto;
margin-right: 10px; margin-bottom: 15px;
padding: 10px;
padding-right: 0;
padding-left: 9px;
margin-top: -30px;
img { img {
width: 94px; width: 120px;
height: 94px; height: 120px;
display: block; display: block;
border-radius: 5px; border-radius: 120px;
box-shadow: 4px 3px 0 rgba(0, 0, 0, 0.1);
} }
} }
} }

View file

@ -69,12 +69,13 @@ table {
body { body {
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
background: $background-color image-url('background-photo.jpeg'); background: #282c37 image-url('background-photo.jpeg');
background-size: cover; background-size: cover;
font-size: 13px; font-size: 13px;
line-height: 18px; line-height: 18px;
font-weight: 400; font-weight: 400;
color: $text-color; color: #fff;
padding-bottom: 140px;
} }
.container { .container {
@ -221,6 +222,17 @@ body {
} }
} }
.footer {
text-align: center;
margin-top: 30px;
.domain {
font-size: 12px;
font-weight: 400;
font-family: 'Roboto Mono', monospace;
}
}
@import 'home'; @import 'home';
@import 'accounts'; @import 'accounts';
@import 'stream_entries'; @import 'stream_entries';

View file

@ -4,9 +4,9 @@
box-shadow: 4px 3px 0 rgba(0, 0, 0, 0.1); box-shadow: 4px 3px 0 rgba(0, 0, 0, 0.1);
.entry { .entry {
border-bottom: 1px solid $darker-background-color; border-bottom: 1px solid #d9e1e8;
background: $background-color; background: #fff;
border-left: 2px solid $primary-color; border-left: 2px solid #fff;
&.entry-reblog { &.entry-reblog {
border-left: 2px solid $tertiary-color; border-left: 2px solid $tertiary-color;
@ -19,12 +19,10 @@
} }
&.entry-predecessor, &.entry-successor { &.entry-predecessor, &.entry-successor {
border-left: 2px solid $lighter-text-color;
background: darken($background-color, 5%);
.content { .content {
a { a {
color: $lighter-text-color;
} }
} }
} }
@ -38,6 +36,7 @@
&:last-child { &:last-child {
border-bottom: 0; border-bottom: 0;
border-radius: 0 0 4px 0;
} }
} }
@ -47,16 +46,13 @@
.avatar { .avatar {
width: 48px; width: 48px;
padding: 10px; padding: 15px;
padding-left: 8px;
padding-right: 0;
padding-top: 12px;
img { img {
width: 48px; width: 48px;
height: 48px; height: 48px;
display: block; display: block;
border-radius: 5px; border-radius: 48px;
} }
} }
@ -66,16 +62,17 @@
.header { .header {
margin-bottom: 5px; margin-bottom: 5px;
padding: 10px; padding: 15px;
padding-bottom: 0; padding-bottom: 0;
padding-left: 8px; padding-left: 8px;
.name { .name {
text-decoration: none; text-decoration: none;
color: $lighter-text-color; color: #9baec8;
strong { strong {
color: $text-color; color: #282c37;
font-weight: 500;
} }
&:hover { &:hover {
@ -87,15 +84,15 @@
} }
.pre-header { .pre-header {
border-bottom: 1px solid darken($background-color, 5%); border-bottom: 1px solid #d9e1e8;
color: $tertiary-color; color: #2b90d9;
padding: 5px 10px; padding: 5px 10px;
padding-left: 8px; padding-left: 8px;
clear: both; clear: both;
.name { .name {
color: $tertiary-color; color: #2b90d9;
font-weight: bold; font-weight: 500;
text-decoration: none; text-decoration: none;
&:hover { &:hover {
@ -109,9 +106,10 @@
padding: 0 10px; padding: 0 10px;
padding-left: 8px; padding-left: 8px;
padding-bottom: 25px; padding-bottom: 25px;
color: #282c37;
a { a {
color: $primary-color; color: #2b90d9;
text-decoration: none; text-decoration: none;
&:hover { &:hover {
@ -122,7 +120,7 @@
.time { .time {
text-decoration: none; text-decoration: none;
color: $lighter-text-color; color: #9baec8;
&:hover { &:hover {
text-decoration: underline; text-decoration: underline;

View file

@ -1,4 +1,6 @@
class AccountsController < ApplicationController class AccountsController < ApplicationController
layout 'public'
before_action :set_account before_action :set_account
before_action :set_webfinger_header before_action :set_webfinger_header

View file

@ -1,4 +1,6 @@
class StreamEntriesController < ApplicationController class StreamEntriesController < ApplicationController
layout 'public'
before_action :set_account before_action :set_account
before_action :set_stream_entry before_action :set_stream_entry

View file

@ -19,4 +19,17 @@ module StreamEntriesHelper
def relative_time(date) def relative_time(date)
date < 5.days.ago ? date.strftime("%d.%m.%Y") : "#{time_ago_in_words(date)} ago" date < 5.days.ago ? date.strftime("%d.%m.%Y") : "#{time_ago_in_words(date)} ago"
end end
def linkify(status)
mention_hash = {}
status.mentions.each { |m| mention_hash[m.acct] = m }
status.text.gsub(Account::MENTION_RE) do |m|
full_match = Account::MENTION_RE.match(m)
acct = full_match[1]
account = mention_hash[acct]
"#{m.split('@').first}<a href=\"#{account.url}\" class=\"mention\">@<span>#{acct}</span></a>"
end.html_safe
end
end end

View file

@ -3,7 +3,7 @@
%link{ rel: 'alternate', type: 'application/atom+xml', href: account_url(@account, format: 'atom') }/ %link{ rel: 'alternate', type: 'application/atom+xml', href: account_url(@account, format: 'atom') }/
.card .card
.avatar= image_tag @account.avatar.url(:medium) .avatar= image_tag @account.avatar.url(:large)
.bio .bio
%h1.name %h1.name
= @account.display_name.blank? ? @account.username : @account.display_name = @account.display_name.blank? ? @account.username : @account.display_name

View file

@ -0,0 +1,6 @@
- content_for :content do
= yield
.footer
.domain= Rails.configuration.x.local_domain
= render template: "layouts/application"

View file

@ -22,7 +22,7 @@
= relative_time(status.reblog? ? status.reblog.created_at : status.created_at) = relative_time(status.reblog? ? status.reblog.created_at : status.created_at)
.content .content
= status.content.html_safe = status.reblog? ? (status.reblog.local? ? linkify(status.reblog) : status.reblog.content.html_safe) : (status.local? ? linkify(status) : status.content.html_safe)
- if include_threads - if include_threads
- status.replies.each do |status| - status.replies.each do |status|