about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-12-17 03:14:28 +0100
committerGitHub <noreply@github.com>2018-12-17 03:14:28 +0100
commit087e11897137dc1f2811c21c3ccc6cec3ccdedb3 (patch)
treec690ef737c21b6c2f910c0363ec22eef8192bc70 /app
parent628da11e38b0580a074268f32d09791ed6278def (diff)
Remove "most popular" tab from profile directory, add responsive design (#9539)
* Remove "most popular" tab from profile directory, add responsive design

* Remove unused translations
Diffstat (limited to 'app')
-rw-r--r--app/controllers/directories_controller.rb12
-rw-r--r--app/javascript/styles/mastodon/containers.scss6
-rw-r--r--app/javascript/styles/mastodon/widgets.scss43
-rw-r--r--app/models/account.rb3
-rw-r--r--app/views/directories/index.html.haml8
-rw-r--r--app/views/layouts/public.html.haml6
6 files changed, 43 insertions, 35 deletions
diff --git a/app/controllers/directories_controller.rb b/app/controllers/directories_controller.rb
index b8565af4b..df012657a 100644
--- a/app/controllers/directories_controller.rb
+++ b/app/controllers/directories_controller.rb
@@ -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
diff --git a/app/javascript/styles/mastodon/containers.scss b/app/javascript/styles/mastodon/containers.scss
index 44fc1e538..8de53ca98 100644
--- a/app/javascript/styles/mastodon/containers.scss
+++ b/app/javascript/styles/mastodon/containers.scss
@@ -294,6 +294,12 @@
         text-decoration: underline;
         color: $primary-text-color;
       }
+
+      @media screen and (max-width: $no-gap-breakpoint) {
+        &.optional {
+          display: none;
+        }
+      }
     }
 
     .nav-button {
diff --git a/app/javascript/styles/mastodon/widgets.scss b/app/javascript/styles/mastodon/widgets.scss
index c863e3b4f..87e633c70 100644
--- a/app/javascript/styles/mastodon/widgets.scss
+++ b/app/javascript/styles/mastodon/widgets.scss
@@ -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;
+  }
 }
diff --git a/app/models/account.rb b/app/models/account.rb
index 9767e3767..a47741611 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -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,
diff --git a/app/views/directories/index.html.haml b/app/views/directories/index.html.haml
index f70eb964a..88706def7 100644
--- a/app/views/directories/index.html.haml
+++ b/app/views/directories/index.html.haml
@@ -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
diff --git a/app/views/layouts/public.html.haml b/app/views/layouts/public.html.haml
index 93ed12f18..caccd5bb6 100644
--- a/app/views/layouts/public.html.haml
+++ b/app/views/layouts/public.html.haml
@@ -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?