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

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

* Remove unused translations
remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
Eugen Rochko 2018-12-17 03:14:28 +01:00 committed by GitHub
parent 628da11e38
commit 087e118971
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 43 additions and 62 deletions

View File

@ -32,22 +32,12 @@ class DirectoriesController < ApplicationController
end end
def set_accounts 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 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
end end
def set_instance_presenter def set_instance_presenter
@instance_presenter = InstancePresenter.new @instance_presenter = InstancePresenter.new
end end
def popular_requested?
request.path.ends_with?('/popular')
end
end end

View File

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

View File

@ -229,18 +229,6 @@
margin-bottom: 10px; 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 { .page-header {
background: lighten($ui-base-color, 8%); background: lighten($ui-base-color, 8%);
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2); box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);
@ -261,11 +249,20 @@
font-size: 15px; font-size: 15px;
color: $darker-text-color; 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 { .directory {
background: $ui-base-color; background: $ui-base-color;
border-radius: 0 0 4px 4px; border-radius: 4px;
box-shadow: 0 0 15px rgba($base-shadow-color, 0.2); box-shadow: 0 0 15px rgba($base-shadow-color, 0.2);
&__tag { &__tag {
@ -407,4 +404,24 @@
font-size: 14px; 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_display_name, ->(value) { where(arel_table[:display_name].matches("#{value}%")) }
scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) } scope :matches_domain, ->(value) { where(arel_table[:domain].matches("%#{value}%")) }
scope :searchable, -> { where(suspended: false).where(moved_to_account_id: nil) } 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 :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')) } 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, delegate :email,

View File

@ -16,10 +16,6 @@
.grid .grid
.column-0 .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? - if @accounts.empty?
= nothing_here = nothing_here
- else - else
@ -29,10 +25,10 @@
- @accounts.each do |account| - @accounts.each do |account|
%tr %tr
%td= account_link_to account %td= account_link_to account
%td.accounts-table__count %td.accounts-table__count.optional
= number_to_human account.statuses_count, strip_insignificant_zeros: true = number_to_human account.statuses_count, strip_insignificant_zeros: true
%small= t('accounts.posts', count: account.statuses_count).downcase %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 = number_to_human account.followers_count, strip_insignificant_zeros: true
%small= t('accounts.followers', count: account.followers_count).downcase %small= t('accounts.followers', count: account.followers_count).downcase
%td.accounts-table__count %td.accounts-table__count

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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