Making public pages responsive, removing reblogs/favs counts from them

This commit is contained in:
Eugen Rochko 2016-10-03 00:26:00 +02:00
parent d74da1a89a
commit 188c6f326b
8 changed files with 31 additions and 57 deletions

View File

@ -8,6 +8,11 @@
overflow: hidden; overflow: hidden;
position: relative; position: relative;
@media screen and (max-width: 700px) {
border-radius: 0;
box-shadow: none;
}
&:after { &:after {
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);
display: block; display: block;
@ -192,6 +197,11 @@
padding-bottom: 10px; padding-bottom: 10px;
overflow: hidden; overflow: hidden;
@media screen and (max-width: 700px) {
border-radius: 0;
box-shadow: none;
}
.account-grid-card { .account-grid-card {
box-sizing: border-box; box-sizing: border-box;
width: 335px; width: 335px;

View File

@ -69,6 +69,7 @@ body {
padding-bottom: 140px; padding-bottom: 140px;
text-rendering: optimizelegibility; text-rendering: optimizelegibility;
font-feature-settings: "kern"; font-feature-settings: "kern";
min-width: 380px;
&.app-body { &.app-body {
position: fixed; position: fixed;
@ -90,6 +91,11 @@ body {
width: 700px; width: 700px;
margin: 0 auto; margin: 0 auto;
margin-top: 40px; margin-top: 40px;
@media screen and (max-width: 700px) {
width: 100%;
margin: 0;
}
} }
.logo-container { .logo-container {
@ -141,6 +147,7 @@ body {
.form-container { .form-container {
width: 400px; width: 400px;
margin: 0 auto; margin: 0 auto;
padding: 20px;
.field { .field {
margin-bottom: 15px; margin-bottom: 15px;

View File

@ -56,11 +56,18 @@
} }
} }
&.activity-stream-embedded { @media screen and (max-width: 700px) {
border-radius: 0;
box-shadow: none; box-shadow: none;
.entry { &.activity-stream-headless {
border-radius: 0; .entry:first-child {
border-radius: 0;
&:last-child {
border-radius: 0;
}
}
} }
} }
@ -76,7 +83,7 @@
width: 56px; width: 56px;
height: 56px; height: 56px;
display: block; display: block;
border-radius: 56px; border-radius: 4px;
} }
} }
@ -96,27 +103,7 @@
} }
.header__right { .header__right {
.counter-btn {
color: #d9e1e8;
display: inline-block;
padding: 0 10px;
cursor: default;
.counter-number {
font-weight: 500;
display: inline-block;
margin-left: 3px;
font-size: 12px;
}
&.reblogged {
color: #2b90d9;
}
&.favourited {
color: #df405a;
}
}
} }
.name { .name {

View File

@ -8,15 +8,6 @@ class AccountsController < ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
@statuses = @account.statuses.order('id desc').with_includes.with_counters.paginate(page: params[:page], per_page: 10) @statuses = @account.statuses.order('id desc').with_includes.with_counters.paginate(page: params[:page], per_page: 10)
if user_signed_in?
status_ids = @statuses.collect { |s| [s.id, s.reblog_of_id] }.flatten.uniq
@favourited = Status.favourites_map(status_ids, current_user.account_id)
@reblogged = Status.reblogs_map(status_ids, current_user.account_id)
else
@favourited = {}
@reblogged = {}
end
end end
format.atom do format.atom do

View File

@ -11,15 +11,6 @@ class StreamEntriesController < ApplicationController
if @stream_entry.activity_type == 'Status' if @stream_entry.activity_type == 'Status'
@ancestors = @stream_entry.activity.ancestors @ancestors = @stream_entry.activity.ancestors
@descendants = @stream_entry.activity.descendants @descendants = @stream_entry.activity.descendants
if user_signed_in?
status_ids = [@stream_entry.activity_id] + @ancestors.map(&:id) + @descendants.map(&:id)
@favourited = Status.favourites_map(status_ids, current_user.account_id)
@reblogged = Status.reblogs_map(status_ids, current_user.account_id)
else
@favourited = {}
@reblogged = {}
end
end end
respond_to do |format| respond_to do |format|

View File

@ -14,9 +14,7 @@ class Favourite < ApplicationRecord
"#{account.acct} favourited a status by #{status.account.acct}" "#{account.acct} favourited a status by #{status.account.acct}"
end end
def object_type delegate :object_type, to: :target
target.object_type
end
def thread def thread
status status

View File

@ -11,8 +11,4 @@ class User < ApplicationRecord
scope :prolific, -> { joins('inner join statuses on statuses.account_id = users.account_id').select('users.*, count(statuses.id) as statuses_count').group('users.id').order('statuses_count desc') } scope :prolific, -> { joins('inner join statuses on statuses.account_id = users.account_id').select('users.*, count(statuses.id) as statuses_count').group('users.id').order('statuses_count desc') }
scope :recent, -> { order('created_at desc') } scope :recent, -> { order('created_at desc') }
scope :admins, -> { where(admin: true) } scope :admins, -> { where(admin: true) }
def admin?
admin
end
end end

View File

@ -23,18 +23,12 @@
= link_to TagManager.instance.url_for(proper_status(status).account), class: 'name' do = link_to TagManager.instance.url_for(proper_status(status).account), class: 'name' do
%strong= display_name(proper_status(status).account) %strong= display_name(proper_status(status).account)
= "@#{proper_status(status).account.acct}" = "@#{proper_status(status).account.acct}"
.header__right
= link_to TagManager.instance.url_for(proper_status(status)), class: 'time' do = link_to TagManager.instance.url_for(proper_status(status)), class: 'time' do
%span{ title: proper_status(status).created_at } %span{ title: proper_status(status).created_at }
= relative_time(proper_status(status).created_at) = relative_time(proper_status(status).created_at)
.header__right
.counter-btn{ class: reblogged_by_me_class(proper_status(status)) }
%i.fa.fa-retweet
%span.counter-number= proper_status(status).reblogs_count
.counter-btn{ class: favourited_by_me_class(proper_status(status)) }
%i.fa.fa-star
%span.counter-number= proper_status(status).favourites_count
.content= Formatter.instance.format(proper_status(status)) .content= Formatter.instance.format(proper_status(status))
%ul.media-attachments %ul.media-attachments