From e1edef9ff10a8912211469f8e1d446c7fc77a64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= <mrzyx@mrzyx.de> Date: Fri, 13 Jan 2012 22:08:44 +0100 Subject: [PATCH] lets see how all this markdown in the title looks. Attempt to fix #2395 --- app/helpers/posts_helper.rb | 19 +++++++++++++++++++ app/views/posts/show.html.haml | 3 +++ config/locales/diaspora/en.yml | 8 ++++++++ 3 files changed, 30 insertions(+) create mode 100644 app/helpers/posts_helper.rb diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb new file mode 100644 index 0000000000..9cc4f68970 --- /dev/null +++ b/app/helpers/posts_helper.rb @@ -0,0 +1,19 @@ +# Copyright (c) 2012, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + +module PostsHelper + def post_page_title(post) + if post.is_a?(Photo) + I18n.t "posts.show.photos_by", :count => 1, :author => post.status_message.author.name + elsif post.is_a?(Reshare) + I18n.t "posts.show.reshare_by", :author => post.author.name + else + if post.text.present? + truncate(post.text(:plain_text => true), :length => 20) + elsif post.photos.present? + I18n.t "posts.show.photos_by", :count => post.photos.size, :author => post.author.name + end + end + end +end diff --git a/app/views/posts/show.html.haml b/app/views/posts/show.html.haml index 9ecf343dc6..d230c583c4 100644 --- a/app/views/posts/show.html.haml +++ b/app/views/posts/show.html.haml @@ -2,6 +2,9 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +- content_for :page_title do + = post_page_title @post + .span-20.append-2.prepend-2.last #main_stream.stream.status_message_show diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 453483b000..e76e82401f 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -614,6 +614,14 @@ en: destroy: "Delete" permalink: "permalink" not_found: "Sorry, we couldn't find that post." + photos_by: + zero: "No photos by %{author}" + one: "One photo by %{author}" + two: "Two photos by %{author}" + few: "%{count} photos by %{author}" + many: "%{count} photos by %{author}" + other: "%{count} photos by %{author}" + reshare_by: "Reshare by %{author}" share_visibilites: update: -- GitLab