Merge branch 'master' of git://github.com/diaspora/diaspora
This commit is contained in:
commit
d8fce7a9db
8 changed files with 50 additions and 43 deletions
|
|
@ -6,22 +6,29 @@ class ContactsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@aspect = :manage
|
@contacts = case params[:set]
|
||||||
|
when "only_sharing"
|
||||||
if params[:a_id]
|
current_user.contacts.only_sharing
|
||||||
@aspect_ = current_user.aspects.find(params["a_id"])
|
when "all"
|
||||||
@contacts = @aspect_.contacts.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
|
current_user.contacts
|
||||||
elsif params[:aspect_ids] && request.format == "json"
|
|
||||||
@people = Person.joins(:contacts => :aspect_memberships).
|
|
||||||
where(:contacts => {:user_id => current_user.id},
|
|
||||||
:aspect_memberships => {:aspect_id => params[:aspect_ids]})
|
|
||||||
render :json => @people.includes(:profile).to_json
|
|
||||||
elsif params[:set] == "only_sharing"
|
|
||||||
@contacts = current_user.contacts.only_sharing.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
|
|
||||||
elsif params[:set] != "all"
|
|
||||||
@contacts = current_user.contacts.receiving.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
|
|
||||||
else
|
else
|
||||||
@contacts = current_user.contacts.includes(:aspects, :person => :profile).order('profiles.last_name ASC').paginate(:page => params[:page], :per_page => 25)
|
if params[:a_id]
|
||||||
|
@aspect = current_user.aspects.find(params[:a_id])
|
||||||
|
@aspect.contacts
|
||||||
|
else
|
||||||
|
current_user.contacts.receiving
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { @contacts = sort_and_paginate_profiles(@contacts) }
|
||||||
|
format.json {
|
||||||
|
@people = Person.joins(:contacts => :aspect_memberships).
|
||||||
|
where(:contacts => { :user_id => current_user.id },
|
||||||
|
:aspect_memberships => { :aspect_id => params[:aspect_ids] })
|
||||||
|
|
||||||
|
render :json => @people.includes(:profile).to_json
|
||||||
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -30,4 +37,12 @@ class ContactsController < ApplicationController
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def sort_and_paginate_profiles contacts
|
||||||
|
contacts.
|
||||||
|
includes(:aspects, :person => :profile).
|
||||||
|
order('profiles.last_name ASC').
|
||||||
|
paginate(:page => params[:page], :per_page => 25)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -7,14 +7,14 @@ module MarkdownifyHelper
|
||||||
message = h(message).html_safe
|
message = h(message).html_safe
|
||||||
|
|
||||||
options[:newlines] = true if !options.has_key?(:newlines)
|
options[:newlines] = true if !options.has_key?(:newlines)
|
||||||
options[:emoticons] = true if !options.has_key?(:emoticons)
|
options[:specialchars] = true if !options.has_key?(:specialchars)
|
||||||
|
|
||||||
message = process_links(message)
|
message = process_links(message)
|
||||||
message = process_autolinks(message)
|
message = process_autolinks(message)
|
||||||
message = process_emphasis(message)
|
message = process_emphasis(message)
|
||||||
message = process_youtube(message, options[:youtube_maps])
|
message = process_youtube(message, options[:youtube_maps])
|
||||||
message = process_vimeo(message, options[:vimeo_maps])
|
message = process_vimeo(message, options[:vimeo_maps])
|
||||||
message = process_emoticons(message) if options[:emoticons]
|
message = process_specialchars(message) if options[:specialchars]
|
||||||
message = process_newlines(message) if options[:newlines]
|
message = process_newlines(message) if options[:newlines]
|
||||||
|
|
||||||
message
|
message
|
||||||
|
|
@ -115,13 +115,9 @@ module MarkdownifyHelper
|
||||||
processed_message
|
processed_message
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_emoticons(message)
|
def process_specialchars(message)
|
||||||
map = [
|
map = [
|
||||||
["<3", "♥"],
|
["<3", "♥"],
|
||||||
[":(", "☹"],
|
|
||||||
[":-(", "☹"],
|
|
||||||
[":)", "☺"],
|
|
||||||
[":-)", "☺"],
|
|
||||||
["<->", "↔"],
|
["<->", "↔"],
|
||||||
["->", "→"],
|
["->", "→"],
|
||||||
["<-", "←"],
|
["<-", "←"],
|
||||||
|
|
@ -136,4 +132,4 @@ module MarkdownifyHelper
|
||||||
end
|
end
|
||||||
message
|
message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -29,7 +29,7 @@ module NotificationsHelper
|
||||||
end
|
end
|
||||||
elsif note.instance_of?(Notifications::Liked)
|
elsif note.instance_of?(Notifications::Liked)
|
||||||
post = note.target
|
post = note.target
|
||||||
post = post.post if post.is_a? Like
|
post = post.target if post.is_a? Like
|
||||||
if post
|
if post
|
||||||
translation(target_type, :actors => actors, :count => actors_count, :post_author => h(post.author.name), :post_link => link_to(t('notifications.post'), post_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
|
translation(target_type, :actors => actors, :count => actors_count, :post_author => h(post.author.name), :post_link => link_to(t('notifications.post'), post_path(post), 'data-ref' => post.id, :class => 'hard_object_link').html_safe)
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -20,32 +20,32 @@
|
||||||
|
|
||||||
.span-18.last
|
.span-18.last
|
||||||
#people_stream.stream.contacts
|
#people_stream.stream.contacts
|
||||||
- if @aspect_
|
- if @aspect
|
||||||
#aspect_controls
|
#aspect_controls
|
||||||
- suggested_limit = 16
|
- suggested_limit = 16
|
||||||
- conv_opts = { :class => "button conversation_button", :rel => "facebox"}
|
- conv_opts = { :class => "button conversation_button", :rel => "facebox"}
|
||||||
- conv_opts[:title] = t('.many_people_are_you_sure', :suggested_limit => suggested_limit) if @contacts.size > suggested_limit
|
- conv_opts[:title] = t('.many_people_are_you_sure', :suggested_limit => suggested_limit) if @contacts.size > suggested_limit
|
||||||
|
|
||||||
= link_to t('.start_a_conversation'), new_conversation_path(:aspect_id => @aspect_.id, :name => @aspect_.name), conv_opts
|
= link_to t('.start_a_conversation'), new_conversation_path(:aspect_id => @aspect.id, :name => @aspect.name), conv_opts
|
||||||
- if @contacts.size > suggested_limit
|
- if @contacts.size > suggested_limit
|
||||||
= javascript_tag "$('.conversation_button').tipsy({trigger: 'hover', gravity: 'n'});"
|
= javascript_tag "$('.conversation_button').tipsy({trigger: 'hover', gravity: 'n'});"
|
||||||
= link_to t('.edit_aspect', :name => @aspect_.name), edit_aspect_path(@aspect_), :rel => "facebox"
|
= link_to t('.edit_aspect', :name => @aspect.name), edit_aspect_path(@aspect), :rel => "facebox"
|
||||||
|
|
||||||
- if @contacts.size > 0
|
- if @contacts.size > 0
|
||||||
- for contact in @contacts
|
- for contact in @contacts
|
||||||
.stream_element{:id => contact.person.id}
|
.stream_element{:id => contact.person.id}
|
||||||
.right
|
.right
|
||||||
- if @aspect_
|
- if @aspect
|
||||||
= link_to(image_tag('/images/icons/monotone_close_exit_delete.png', :height => 20, :width => 20),
|
= link_to(image_tag('/images/icons/monotone_close_exit_delete.png', :height => 20, :width => 20),
|
||||||
{:controller => "aspect_memberships",
|
{:controller => "aspect_memberships",
|
||||||
:action => 'destroy',
|
:action => 'destroy',
|
||||||
:id => 42,
|
:id => 42,
|
||||||
:aspect_id => @aspect_.id,
|
:aspect_id => @aspect.id,
|
||||||
:person_id => contact.person.id},
|
:person_id => contact.person.id},
|
||||||
:title => t('.remove_person_from_aspect', :person_name => contact.person.first_name, :aspect_name => @aspect_.name),
|
:title => t('.remove_person_from_aspect', :person_name => contact.person.first_name, :aspect_name => @aspect.name),
|
||||||
:method => 'delete')
|
:method => 'delete')
|
||||||
|
|
||||||
- else
|
- else
|
||||||
= render :partial => 'people/relationship_action',
|
= render :partial => 'people/relationship_action',
|
||||||
:locals => { :person => contact.person, :contact => contact,
|
:locals => { :person => contact.person, :contact => contact,
|
||||||
:current_user => current_user }
|
:current_user => current_user }
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
.header
|
.header
|
||||||
= link_to t('.view_all'), notifications_path, :id => "view_all_notifications"
|
= link_to t('.view_all'), notifications_path, :id => "view_all_notifications"
|
||||||
%h4
|
%h4
|
||||||
Recent notifications
|
= t('.recent_notifications')
|
||||||
.notifications
|
.notifications
|
||||||
.ajax_loader
|
.ajax_loader
|
||||||
= image_tag("ajax-loader.gif")
|
= image_tag("ajax-loader.gif")
|
||||||
|
|
|
||||||
|
|
@ -299,6 +299,7 @@ en:
|
||||||
code: "code"
|
code: "code"
|
||||||
admin: "admin"
|
admin: "admin"
|
||||||
view_all: "View all"
|
view_all: "View all"
|
||||||
|
recent_notifications: "Recent notifications"
|
||||||
application:
|
application:
|
||||||
powered_by: "POWERED BY DIASPORA*"
|
powered_by: "POWERED BY DIASPORA*"
|
||||||
whats_new: "what's new?"
|
whats_new: "what's new?"
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,6 @@ describe ContactsController do
|
||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
end
|
||||||
|
|
||||||
it "assigns aspect to manage" do
|
|
||||||
get :index
|
|
||||||
assigns(:aspect).should == :manage
|
|
||||||
end
|
|
||||||
|
|
||||||
it "assigns contacts" do
|
it "assigns contacts" do
|
||||||
get :index
|
get :index
|
||||||
contacts = assigns(:contacts)
|
contacts = assigns(:contacts)
|
||||||
|
|
|
||||||
|
|
@ -150,20 +150,20 @@ describe MarkdownifyHelper do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "emoticons" do
|
describe "specialchars" do
|
||||||
it "replaces <3 with ♥" do
|
it "replaces <3 with ♥" do
|
||||||
message = "i <3 you"
|
message = "i <3 you"
|
||||||
markdownify(message).should == "i ♥ you"
|
markdownify(message).should == "i ♥ you"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "replaces various things with (their) HTML entities" do
|
it "replaces various things with (their) HTML entities" do
|
||||||
message = ":) :-) :( :-( ... <-> -> <- (tm) (r) (c)"
|
message = "... <-> -> <- (tm) (r) (c)"
|
||||||
markdownify(message).should == "☺ ☺ ☹ ☹ … ↔ → ← ™ ® ©"
|
markdownify(message).should == "… ↔ → ← ™ ® ©"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "skips doing it if you say so" do
|
it "skips doing it if you say so" do
|
||||||
message = ":) :-) :( :-( ... -> <-"
|
message = "... -> <-"
|
||||||
markdownify(message, :emoticons => false).should == ":) :-) :( :-( ... -> <-"
|
markdownify(message, :specialchars => false).should == "... -> <-"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -263,4 +263,4 @@ describe MarkdownifyHelper do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Loading…
Reference in a new issue