about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/accounts.scss1
-rw-r--r--app/assets/stylesheets/application.scss1
-rw-r--r--app/assets/stylesheets/stream_entries.scss52
-rw-r--r--app/controllers/home_controller.rb3
-rw-r--r--app/helpers/stream_entries_helper.rb19
-rw-r--r--app/views/home/index.html.haml6
-rw-r--r--app/views/stream_entries/_status.html.haml21
7 files changed, 79 insertions, 24 deletions
diff --git a/app/assets/stylesheets/accounts.scss b/app/assets/stylesheets/accounts.scss
index b9633f074..d659cbcb3 100644
--- a/app/assets/stylesheets/accounts.scss
+++ b/app/assets/stylesheets/accounts.scss
@@ -4,6 +4,7 @@
   padding: 60px 0;
   padding-bottom: 10px;
   border-radius: 4px 4px 0 0;
+  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
 
   .name {
     display: block;
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss
index 3a35ab997..a091d79ff 100644
--- a/app/assets/stylesheets/application.scss
+++ b/app/assets/stylesheets/application.scss
@@ -71,6 +71,7 @@ body {
   font-family: 'Roboto', sans-serif;
   background: #282c37 image-url('background-photo.jpeg');
   background-size: cover;
+  background-attachment: fixed;
   font-size: 13px;
   line-height: 18px;
   font-weight: 400;
diff --git a/app/assets/stylesheets/stream_entries.scss b/app/assets/stylesheets/stream_entries.scss
index ce5c7f4ba..31bec6374 100644
--- a/app/assets/stylesheets/stream_entries.scss
+++ b/app/assets/stylesheets/stream_entries.scss
@@ -1,7 +1,6 @@
-
 .activity-stream {
   clear: both;
-  box-shadow: 4px 3px 0 rgba(0, 0, 0, 0.1);
+  box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
 
   .entry {
     border-bottom: 1px solid #d9e1e8;
@@ -49,14 +48,14 @@
   }
 
   .avatar {
-    width: 48px;
+    width: 56px;
     padding: 15px;
 
     img {
-      width: 48px;
-      height: 48px;
+      width: 56px;
+      height: 56px;
       display: block;
-      border-radius: 48px;
+      border-radius: 56px;
     }
   }
 
@@ -65,10 +64,39 @@
   }
 
   .header {
-    margin-bottom: 5px;
+    margin-bottom: 10px;
     padding: 15px;
     padding-bottom: 0;
     padding-left: 8px;
+    display: flex;
+
+    .header__left {
+      flex: 1;
+    }
+
+    .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 {
       text-decoration: none;
@@ -119,6 +147,16 @@
       &:hover {
         text-decoration: underline;
       }
+
+      &.mention {
+        &:hover {
+          text-decoration: none;
+
+          span {
+            text-decoration: underline;
+          }
+        }
+      }
     }
   }
 
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb
index 95f29929c..3a3d0ade4 100644
--- a/app/controllers/home_controller.rb
+++ b/app/controllers/home_controller.rb
@@ -1,4 +1,7 @@
 class HomeController < ApplicationController
+  before_action :authenticate_user!
+
   def index
+    @statuses = Status.where(account: ([current_user.account] + current_user.account.following)).where('reblog_of_id IS NULL OR account_id != ?', current_user.account.id).order('created_at desc')
   end
 end
diff --git a/app/helpers/stream_entries_helper.rb b/app/helpers/stream_entries_helper.rb
index 529ba98da..d6a14352f 100644
--- a/app/helpers/stream_entries_helper.rb
+++ b/app/helpers/stream_entries_helper.rb
@@ -4,7 +4,7 @@ module StreamEntriesHelper
   end
 
   def avatar_for_status_url(status)
-    status.reblog? ? status.reblog.account.avatar.url(:small) : status.account.avatar.url(:small)
+    status.reblog? ? status.reblog.account.avatar.url(:medium) : status.account.avatar.url(:medium)
   end
 
   def entry_classes(status, is_predecessor, is_successor, include_threads)
@@ -24,12 +24,17 @@ module StreamEntriesHelper
     mention_hash = {}
     status.mentions.each { |m| mention_hash[m.acct] = m }
 
-    status.text.gsub(Account::MENTION_RE) do |m|
-      full_match = Account::MENTION_RE.match(m)
-      acct       = full_match[1]
-      account    = mention_hash[acct]
-
-      "#{m.split('@').first}<a href=\"#{account.url}\" class=\"mention\">@<span>#{acct}</span></a>"
+    auto_link(CGI.escapeHTML(status.text), link: :urls, html: { target: '_blank', rel: 'nofollow' }).gsub(Account::MENTION_RE) do |m|
+      account = mention_hash[Account::MENTION_RE.match(m)[1]]
+      "#{m.split('@').first}<a href=\"#{url_for_target(account)}\" class=\"mention\">@<span>#{account.acct}</span></a>"
     end.html_safe
   end
+
+  def reblogged_by_me_class(status)
+    user_signed_in? && (status.reblog? ? status.reblog : status).reblogs.where(account: current_user.account).count == 1 ? 'reblogged' : ''
+  end
+
+  def favourited_by_me_class(status)
+    user_signed_in? && (status.reblog? ? status.reblog : status).favourites.where(account: current_user.account).count == 1 ? 'favourited' : ''
+  end
 end
diff --git a/app/views/home/index.html.haml b/app/views/home/index.html.haml
index 11894d72c..068c34408 100644
--- a/app/views/home/index.html.haml
+++ b/app/views/home/index.html.haml
@@ -1,3 +1,3 @@
-Mastodon
-
-= link_to 'Logout', destroy_user_session_path, method: :delete
+.activity-stream.activity-stream-headless
+  - @statuses.each do |status|
+    = render partial: 'stream_entries/status', locals: { status: status, include_threads: false, is_successor: false, is_predecessor: false }
diff --git a/app/views/stream_entries/_status.html.haml b/app/views/stream_entries/_status.html.haml
index a11da83a6..38986cf1f 100644
--- a/app/views/stream_entries/_status.html.haml
+++ b/app/views/stream_entries/_status.html.haml
@@ -14,13 +14,20 @@
 
     .entry__container__container
       .header
-        = link_to url_for_target(status.reblog? ? status.reblog.account : status.account), class: 'name' do
-          %strong= display_name(status.reblog? ? status.reblog.account : status.account)
-          = "@#{status.reblog? ? status.reblog.account.acct : status.account.acct}"
-        = link_to url_for_target(status.reblog? ? status.reblog : status), class: 'time' do
-          %span{ title: status.reblog? ? status.reblog.created_at : status.created_at }
-            = relative_time(status.reblog? ? status.reblog.created_at : status.created_at)
-
+        .header__left
+          = link_to url_for_target(status.reblog? ? status.reblog.account : status.account), class: 'name' do
+            %strong= display_name(status.reblog? ? status.reblog.account : status.account)
+            = "@#{status.reblog? ? status.reblog.account.acct : status.account.acct}"
+          = link_to url_for_target(status.reblog? ? status.reblog : status), class: 'time' do
+            %span{ title: status.reblog? ? status.reblog.created_at : status.created_at }
+              = relative_time(status.reblog? ? status.reblog.created_at : status.created_at)
+        .header__right
+          .counter-btn{ class: reblogged_by_me_class(status) }
+            %i.fa.fa-retweet
+            %span.counter-number= status.reblog? ? status.reblog.reblogs.count : status.reblogs.count
+          .counter-btn{ class: favourited_by_me_class(status) }
+            %i.fa.fa-star
+            %span.counter-number= status.reblog? ? status.reblog.favourites.count : status.favourites.count
       .content
         = status.reblog? ? (status.reblog.local? ? linkify(status.reblog) : status.reblog.content.html_safe) : (status.local? ? linkify(status) : status.content.html_safe)