This new class replaces all existing server side message rendering helpers and is the new global entry point for such needs. All models with relevant fields now expose an instance of MessageRenderer for those. MessageRenderer acts as gateway between the existing processing solutions for markdown, mentions and tags and provides a very flexible interface for all output needs. This makes the API to obtain a message in a certain format clear. As a result of centralizing the processing a lot of duplication is eliminated. Centralizing the message processing also makes it clear where to change its behaviour, add new representations and what options are already available.
92 lines
3.3 KiB
Text
92 lines
3.3 KiB
Text
-# Copyright (c) 2010-2011, Diaspora Inc. This file is
|
|
-# licensed under the Affero General Public License version 3 or later. See
|
|
-# the COPYRIGHT file.
|
|
|
|
#profile
|
|
.profile_photo
|
|
= person_image_link(person, :size => :thumb_large, :to => :photos)
|
|
|
|
- if user_signed_in?
|
|
- if person != current_user.person
|
|
%div#profile_buttons{ :class => profile_buttons_class(@contact, @block) }
|
|
= sharing_message(@person, @contact)
|
|
|
|
- if @contact.receiving?
|
|
.profile_button
|
|
= link_to content_tag(:div, nil, :class => 'icons-mention', :title => t('people.show.mention'), :id => 'mention_button'), new_status_message_path(:person_id => @person.id), :rel => 'facebox'
|
|
.white_bar
|
|
|
|
- if @contact.mutual?
|
|
|
|
|
|
.profile_button
|
|
= link_to content_tag(:div, nil, :class => 'icons-message', :title => t('people.show.message'), :id => 'message_button'), new_conversation_path(:contact_id => @contact.id, :name => @contact.person.name), :rel => 'facebox'
|
|
.white_bar
|
|
|
|
.profile_button
|
|
= link_to content_tag(:div, nil, :class => 'icons-ignoreuser block_user', :title => t('ignore'), :id => 'block_user_button', :data => { :person_id => @person.id }), '#', :rel => "nofollow" if @block.blank?
|
|
|
|
|
|
%br
|
|
|
|
-if contact.sharing? || person == current_user.person
|
|
%ul#profile_information
|
|
|
|
- unless person.bio.blank?
|
|
%li
|
|
%h4
|
|
=t('.bio')
|
|
%div{ :class => direction_for(person.bio) }
|
|
= person.profile.bio_message.markdownified
|
|
- unless person.profile.location.blank?
|
|
%li
|
|
%h4
|
|
=t('.location')
|
|
%div{ :class => direction_for(person.location) }
|
|
= person.profile.location_message.markdownified
|
|
|
|
- unless person.gender.blank?
|
|
%li
|
|
%h4
|
|
=t('.gender')
|
|
= person.gender
|
|
|
|
- unless person.birthday.blank?
|
|
%li
|
|
%h4
|
|
=t('.born')
|
|
= birthday_format(person.birthday)
|
|
- if @photos.present?
|
|
%li.image_list
|
|
%h4
|
|
= t('.photos')
|
|
.item_count
|
|
= "#{@photos.count}"
|
|
- @photos.limit(8).each do |photo|
|
|
= image_tag(photo.url(:thumb_small))
|
|
%br
|
|
= link_to t('layouts.header.view_all'), person_photos_path(person)
|
|
|
|
- if person == current_user.person
|
|
%li.image_list
|
|
%h4
|
|
= t('_contacts')
|
|
.item_count
|
|
= all_contacts_count
|
|
.section.contact_pictures
|
|
- current_user.contacts.limit(8).each do |contact|
|
|
= person_image_link contact.person, :size => :thumb_small
|
|
%p.see_all= link_to t('layouts.header.view_all'), contacts_path
|
|
- elsif @contact.persisted? && @contacts_of_contact_count > 0
|
|
%li.image_list
|
|
%h4
|
|
= t('_contacts')
|
|
.item_count
|
|
= @contacts_of_contact_count
|
|
.section.contact_pictures
|
|
-@contacts_of_contact.limit(8).each do |person|
|
|
= person_image_link person, :size => :thumb_small
|
|
%p.see_all= link_to t('layouts.header.view_all'), person_contacts_path(@person)
|
|
|
|
%br
|
|
%br
|