]> cat aescling's git repositories - mastodon.git/commitdiff
Making public pages responsive, removing reblogs/favs counts from them
authorEugen Rochko <eugen@zeonfederated.com>
Sun, 2 Oct 2016 22:26:00 +0000 (00:26 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 2 Oct 2016 22:26:00 +0000 (00:26 +0200)
app/assets/stylesheets/accounts.scss
app/assets/stylesheets/application.scss
app/assets/stylesheets/stream_entries.scss
app/controllers/accounts_controller.rb
app/controllers/stream_entries_controller.rb
app/models/favourite.rb
app/models/user.rb
app/views/stream_entries/_status.html.haml

index 571cee5c9b4dc64bc467efdde0a07266c22a317c..57da328562d5d83bc29921ceba54d9a134bbf7b8 100644 (file)
@@ -8,6 +8,11 @@
   overflow: hidden;
   position: relative;
 
+  @media screen and (max-width: 700px) {
+    border-radius: 0;
+    box-shadow: none;
+  }
+
   &:after {
     background: rgba(0, 0, 0, 0.5);
     display: block;
   padding-bottom: 10px;
   overflow: hidden;
 
+  @media screen and (max-width: 700px) {
+    border-radius: 0;
+    box-shadow: none;
+  }
+
   .account-grid-card {
     box-sizing: border-box;
     width: 335px;
index 1bae0b44e0b76bf4c6b9694d44060714c98f2ab2..917a2f9d96adb3d4c8aac479b3df8cf522f34d68 100644 (file)
@@ -69,6 +69,7 @@ body {
   padding-bottom: 140px;
   text-rendering: optimizelegibility;
   font-feature-settings: "kern";
+  min-width: 380px;
 
   &.app-body {
     position: fixed;
@@ -90,6 +91,11 @@ body {
   width: 700px;
   margin: 0 auto;
   margin-top: 40px;
+
+  @media screen and (max-width: 700px) {
+    width: 100%;
+    margin: 0;
+  }
 }
 
 .logo-container {
@@ -141,6 +147,7 @@ body {
 .form-container {
   width: 400px;
   margin: 0 auto;
+  padding: 20px;
 
   .field {
     margin-bottom: 15px;
index d91ce20cfd328454d3ee6a227220da39582524fa..a111ec1e61e4cb3f2968cd0fcf5a64073ec15eb6 100644 (file)
     }
   }
 
-  &.activity-stream-embedded {
+  @media screen and (max-width: 700px) {
+    border-radius: 0;
     box-shadow: none;
 
-    .entry {
-      border-radius: 0;
+    &.activity-stream-headless {
+      .entry:first-child {
+        border-radius: 0;
+
+        &:last-child {
+          border-radius: 0;
+        }
+      }
     }
   }
 
@@ -76,7 +83,7 @@
       width: 56px;
       height: 56px;
       display: block;
-      border-radius: 56px;
+      border-radius: 4px;
     }
   }
 
     }
 
     .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 {
index 55b1f3c45937ddba494a5a420689a316ddd8c354..9f47517712e37a2ee0aaf06030899f602a78b30f 100644 (file)
@@ -8,15 +8,6 @@ class AccountsController < ApplicationController
     respond_to do |format|
       format.html do
         @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
 
       format.atom do
index fd8b97c9f786b50d58f2d660d6b8398d98fe77a0..e1b664b08a191fbda2539a1adfd41d12f100907c 100644 (file)
@@ -11,15 +11,6 @@ class StreamEntriesController < ApplicationController
     if @stream_entry.activity_type == 'Status'
       @ancestors   = @stream_entry.activity.ancestors
       @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
 
     respond_to do |format|
index 3681181e5fcf5168ec7034ba1e67aa7934ec22a6..4f9b2094250b1fe0a2bb57d254e85fc73c1005c8 100644 (file)
@@ -14,9 +14,7 @@ class Favourite < ApplicationRecord
     "#{account.acct} favourited a status by #{status.account.acct}"
   end
 
-  def object_type
-    target.object_type
-  end
+  delegate :object_type, to: :target
 
   def thread
     status
index 9c0546c2f96717495d6b489826957074eb337f1a..04f3eb02c413472215fe0e2676e7966174f2864e 100644 (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 :recent,   -> { order('created_at desc') }
   scope :admins,   -> { where(admin: true) }
-
-  def admin?
-    admin
-  end
 end
index 6254d75e9e41576e5ec83edbf2db78a4646954de..4e74fa1313e8b9e9b43d7e01678df6d3ae87409f 100644 (file)
           = link_to TagManager.instance.url_for(proper_status(status).account), class: 'name' do
             %strong= display_name(proper_status(status).account)
             = "@#{proper_status(status).account.acct}"
+
+        .header__right
           = link_to TagManager.instance.url_for(proper_status(status)), class: 'time' do
             %span{ title: 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))
 
       %ul.media-attachments