Remove "most popular" tab from profile directory, add responsive design (#9539)

* Remove "most popular" tab from profile directory, add responsive design

* Remove unused translations
lolsob-rspec
Eugen Rochko 2018-12-17 03:14:28 +01:00 committed by GitHub
parent 26140838c4
commit 32bd452b56
20 changed files with 43 additions and 62 deletions

View File

@ -32,22 +32,12 @@ class DirectoriesController < ApplicationController
end
def set_accounts
@accounts = Account.searchable.discoverable.page(params[:page]).per(50).tap do |query|
@accounts = Account.discoverable.page(params[:page]).per(30).tap do |query|
query.merge!(Account.tagged_with(@tag.id)) if @tag
if popular_requested?
query.merge!(Account.popular)
else
query.merge!(Account.by_recent_status)
end
end
end
def set_instance_presenter
@instance_presenter = InstancePresenter.new
end
def popular_requested?
request.path.ends_with?('/popular')
end
end

View File

@ -294,6 +294,12 @@
text-decoration: underline;
color: $primary-text-color;
}
@media screen and (max-width: $no-gap-breakpoint) {
&.optional {
display: none;
}
}
}
.nav-button {

View File

@ -229,18 +229,6 @@
margin-bottom: 10px;
}
.moved-account-widget,
.memoriam-widget,
.box-widget,
.contact-widget,
.landing-page__information.contact-widget {
@media screen and (max-width: $no-gap-breakpoint) {
margin-bottom: 0;
box-shadow: none;
border-radius: 0;
}
}
.page-header {
background: lighten($ui-base-color, 8%);
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);
@ -261,11 +249,20 @@
font-size: 15px;
color: $darker-text-color;
}
@media screen and (max-width: $no-gap-breakpoint) {
margin-top: 0;
background: lighten($ui-base-color, 4%);
h1 {
font-size: 24px;
}
}
}
.directory {
background: $ui-base-color;
border-radius: 0 0 4px 4px;
border-radius: 4px;
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);
&__tag {
@ -407,4 +404,24 @@
font-size: 14px;
}
}
@media screen and (max-width: $no-gap-breakpoint) {
tbody td.optional {
display: none;
}
}
}
.moved-account-widget,
.memoriam-widget,
.box-widget,
.contact-widget,
.landing-page__information.contact-widget,
.directory,
.page-header {
@media screen and (max-width: $no-gap-breakpoint) {
margin-bottom: 0;
box-shadow: none;
border-radius: 0;
}
}

View File

@ -91,9 +91,8 @@ class Account < ApplicationRecord
scope :matches_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) }
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
scope :searchable, -> { where(suspended: false).where(moved_to_account_id: nil) }
scope :discoverable, -> { where(silenced: false).where(discoverable: true).joins(:account_stat).where(AccountStat.arel_table[:followers_count].gteq(MIN_FOLLOWERS_DISCOVERY)) }
scope :discoverable, -> { searchable.where(silenced: false).where(discoverable: true).joins(:account_stat).where(AccountStat.arel_table[:followers_count].gteq(MIN_FOLLOWERS_DISCOVERY)).by_recent_status }
scope :tagged_with, ->(tag) { joins(:accounts_tags).where(accounts_tags: { tag_id: tag }) }
scope :popular, -> { order('account_stats.followers_count desc') }
scope :by_recent_status, -> { order(Arel.sql('(case when account_stats.last_status_at is null then 1 else 0 end) asc, account_stats.last_status_at desc')) }
delegate :email,

View File

@ -16,10 +16,6 @@
.grid
.column-0
.account__section-headline
= active_link_to t('directories.most_recently_active'), @tag ? explore_hashtag_path(@tag) : explore_path
= active_link_to t('directories.most_popular'), @tag ? explore_hashtag_popular_path(@tag) : explore_popular_path
- if @accounts.empty?
= nothing_here
- else
@ -29,10 +25,10 @@
- @accounts.each do |account|
%tr
%td= account_link_to account
%td.accounts-table__count
%td.accounts-table__count.optional
= number_to_human account.statuses_count, strip_insignificant_zeros: true
%small= t('accounts.posts', count: account.statuses_count).downcase
%td.accounts-table__count
%td.accounts-table__count.optional
= number_to_human account.followers_count, strip_insignificant_zeros: true
%small= t('accounts.followers', count: account.followers_count).downcase
%td.accounts-table__count

View File

@ -10,9 +10,9 @@
= image_tag asset_pack_path('logo_full.svg'), alt: 'Mastodon'
- if Setting.profile_directory
= link_to t('directories.directory'), explore_path, class: 'nav-link'
= link_to t('about.about_this'), about_more_path, class: 'nav-link'
= link_to t('about.apps'), 'https://joinmastodon.org/apps', class: 'nav-link'
= link_to t('directories.directory'), explore_path, class: 'nav-link optional'
= link_to t('about.about_this'), about_more_path, class: 'nav-link optional'
= link_to t('about.apps'), 'https://joinmastodon.org/apps', class: 'nav-link optional'
.nav-center
.nav-right
- if user_signed_in?

View File

@ -541,7 +541,6 @@ ar:
warning_title: توافر المحتوى المنشور و المبعثَر
directories:
explore_mastodon: استكشف %{title}
most_popular: المشهورة
errors:
'403': ليس لك الصلاحيات الكافية لعرض هذه الصفحة.
'404': إنّ الصفحة التي تبحث عنها لا وجود لها أصلا.

View File

@ -531,8 +531,6 @@ co:
directory: Annuariu di i prufili
explanation: Scopre utilizatori à partesi di i so centri d'interessu
explore_mastodon: Scopre à %{title}
most_popular: I più pupulari
most_recently_active: Attività a più fresca
people:
one: "%{count} persona"
other: "%{count} persone"

View File

@ -536,8 +536,6 @@ cs:
directory: Adresář profilů
explanation: Objevujte uživatele podle jejich zájmů
explore_mastodon: Prozkoumejte %{title}
most_popular: Nejpopulárnější
most_recently_active: Naposledy aktivní
people:
few: "%{count} lidé"
one: "%{count} člověk"

View File

@ -531,8 +531,6 @@ el:
directory: Κατάλογος λογαριασμών
explanation: Βρες χρήστες βάσει των ενδιαφερόντων τους
explore_mastodon: Εξερεύνησε %{title}
most_popular: Δημοφιλείς
most_recently_active: Πρόσφατα ενεργοί
people:
one: "%{count} άτομο"
other: "%{count} άτομα"

View File

@ -535,8 +535,6 @@ en:
directory: Profile directory
explanation: Discover users based on their interests
explore_mastodon: Explore %{title}
most_popular: Most popular
most_recently_active: Most recently active
people:
one: "%{count} person"
other: "%{count} people"

View File

@ -531,8 +531,6 @@ eu:
directory: Profilen direktorioa
explanation: Deskubritu erabiltzaileak interesen arabera
explore_mastodon: Esploratu %{title}
most_popular: Puri-purian
most_recently_active: Azkenaldian aktibo
people:
one: pertsona %{count}
other: "%{count} pertsona"

View File

@ -531,8 +531,6 @@ fr:
directory: Annuaire des profils
explanation: Découvrir des utilisateurs en se basant sur leurs centres d'intérêt
explore_mastodon: Explorer %{title}
most_popular: Les plus populaires
most_recently_active: Les actifs les plus récents
people:
one: "%{count} personne"
other: "%{count} personne"

View File

@ -531,8 +531,6 @@ gl:
directory: Directorio de perfil
explanation: Descubra usuarias según o seu interese
explore_mastodon: Explorar %{title}
most_popular: Máis popular
most_recently_active: Máis activa recentemente
people:
one: "%{count} persoa"
other: "%{count} persoas"

View File

@ -530,8 +530,6 @@ ja:
directories:
directory: ディレクトリ
explore_mastodon: "%{title}を探索"
most_popular: 人気順
most_recently_active: 直近の活動順
people:
one: "%{count} 人"
other: "%{count} 人"

View File

@ -531,8 +531,6 @@ nl:
directory: Gebruikersgids
explanation: Ontdek gebruikers aan de hand van hun interesses
explore_mastodon: "%{title} verkennen"
most_popular: Meest populair
most_recently_active: Recentelijk actief
people:
one: "%{count} gebruikers"
other: "%{count} gebruikers"

View File

@ -587,8 +587,6 @@ oc:
directory: Annuari de perfils
explanation: Trobar dutilizaires segon lor interèsses
explore_mastodon: Explorar %{title}
most_popular: Mai populars
most_recently_active: Mai actius recentament
people:
one: "%{count} persona"
other: "%{count} personas"

View File

@ -541,8 +541,6 @@ pl:
directory: Katalog profilów
explanation: Poznaj profile na podstawie zainteresowań
explore_mastodon: Odkrywaj %{title}
most_popular: Napopularniejsi
most_recently_active: Ostatnio aktywni
people:
few: "%{count} osoby"
many: "%{count} osób"

View File

@ -536,8 +536,6 @@ sk:
directory: Databáza profilov
explanation: Pátraj po užívateľoch podľa ich záujmov
explore_mastodon: Prebádaj %{title}
most_popular: Najpopulárnejšie
most_recently_active: Naposledy aktívni
people:
few: "%{count} ľudia"
one: "%{count} človek"

View File

@ -81,9 +81,7 @@ Rails.application.routes.draw do
post '/interact/:id', to: 'remote_interaction#create'
get '/explore', to: 'directories#index', as: :explore
get '/explore/popular', to: 'directories#index', as: :explore_popular
get '/explore/:id', to: 'directories#show', as: :explore_hashtag
get '/explore/:id/popular', to: 'directories#show', as: :explore_hashtag_popular
namespace :settings do
resource :profile, only: [:show, :update]