diff --git a/app/controllers/admins_controller.rb b/app/controllers/admins_controller.rb index 1b7e858f8a015926503b44a4c26fd55914634312..bd2dc4d133f3847b395d897cff4ae5cf7e139e98 100644 --- a/app/controllers/admins_controller.rb +++ b/app/controllers/admins_controller.rb @@ -28,4 +28,12 @@ class AdminsController < ApplicationController flash[:notice] = "invitation sent to #{params[:identifier]}" redirect_to user_search_path end + + def stats + @popular_tags = ActsAsTaggableOn::Tagging.joins(:tag).limit(15).count(:group => :tag, :order => 'count(taggings.id) DESC') + @most_liked_posts = Post.where(:type => ['StatusMessage', 'ActivityStreams::Photo'], + :public => true).order('likes_count DESC').limit(15).all + @new_posts = Post.where(:type => ['StatusMessage','ActivityStreams::Photo'], + :public => true).order('created_at DESC').limit(15).all + end end diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 5c30f9ede4d64a65caaa30fdda5975bfb686e575..e15a1d6fd00d734f360d658c96ac0ea76765b848 100644 --- a/app/helpers/notifications_helper.rb +++ b/app/helpers/notifications_helper.rb @@ -56,7 +56,7 @@ module NotificationsHelper actors =people || note.actors number_of_actors = actors.count sentence_translations = {:two_words_connector => " #{t('notifications.index.and')} ", :last_word_connector => ", #{t('notifications.index.and')} " } - actor_links = actors.collect{ |person| link_to("#{h(person.name.titlecase.strip)}", person_path(person))} + actor_links = actors.collect{ |person| link_to("#{h(person.name.titlecase.strip)}", person_path(person), :class => ('hovercardable' if defined?(user_signed_in?) && user_signed_in? && current_user.person != person))} if number_of_actors < 4 message = actor_links.to_sentence(sentence_translations) diff --git a/app/models/person.rb b/app/models/person.rb index c56adb37452027ec9ddbd1f16ece80ab08f8f52f..e67a5071fadae8b077d76a5454748d5a96bdead1 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -223,7 +223,7 @@ class Person < ActiveRecord::Base json = { :id => self.id, :name => self.name, - :avatar => self.profile.image_url(:thumb_small), + :avatar => self.profile.image_url(:thumb_medium), :handle => self.diaspora_handle, :url => "/people/#{self.id}", :hashtags => self.profile.tags.map{|t| "##{t.name}"} diff --git a/app/models/status_message.rb b/app/models/status_message.rb index 0c8e998b24c8ba0afce48e4655bd461e7d474306..a5aed41b34630af6b2f0535c051f7755ad20323c 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -57,7 +57,7 @@ class StatusMessage < Post if opts[:plain_text] person ? ERB::Util.h(person.name) : ERB::Util.h($~[1]) else - person ? "<a href=\"/people/#{person.id}\" class=\"mention\">@#{ERB::Util.h(person.name)}</a>" : ERB::Util.h($~[1]) + person ? "<a href=\"/people/#{person.id}\" class=\"mention hovercardable\">@#{ERB::Util.h(person.name)}</a>" : ERB::Util.h($~[1]) end end form_message @@ -107,7 +107,7 @@ class StatusMessage < Post <activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb> <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type> </entry> - XML + XML end def socket_to_user(user_or_id, opts={}) diff --git a/app/views/admins/stats.html.haml b/app/views/admins/stats.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..565e7cfdf1244d262d1cce3b50dca5200602d697 --- /dev/null +++ b/app/views/admins/stats.html.haml @@ -0,0 +1,19 @@ +.span-24.last + %h3 + = for tg in @popular_tags + = link_to tg, tags_path(tg) + +%br +%br + +.span-12 + %h3 + New public posts + .stream + = render 'shared/stream', :posts => @new_posts + +.span-12.last + %h3 + Most Liked + .stream + = render 'shared/stream', :posts => @most_liked_posts diff --git a/app/views/aspect_memberships/create.js.erb b/app/views/aspect_memberships/create.js.erb index 2292d0ae65941d6f00816e57cdb43c6d5d501bf5..28f41cb136eeac32047c75c3887e24937d31f453 100644 --- a/app/views/aspect_memberships/create.js.erb +++ b/app/views/aspect_memberships/create.js.erb @@ -2,8 +2,6 @@ // licensed under the Affero General Public License version 3 or later. See // the COPYRIGHT file. -ContactEdit.updateNumber("<%= @contact.person_id%>"); - var element = $(".add[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]"); if( $("#no_contacts").is(':visible') ) { diff --git a/app/views/aspect_memberships/destroy.js.erb b/app/views/aspect_memberships/destroy.js.erb index 3c48c72290535b2f1a998ae1bb8c1ef91614264c..e8a93371948895f7e3815b05f674a895d7287336 100644 --- a/app/views/aspect_memberships/destroy.js.erb +++ b/app/views/aspect_memberships/destroy.js.erb @@ -2,7 +2,6 @@ // licensed under the Affero General Public License version 3 or later. See // the COPYRIGHT file. -ContactEdit.updateNumber("<%= @contact.person_id%>"); var element = $(".added[data-aspect_id=<%= @aspect.id %>][data-person_id=<%= @contact.person_id%>]"); element.parent().html("<%= escape_javascript(render('aspect_memberships/remove_from_aspect', :aspect => @aspect, :person => @contact.person, :contact => @contact)) %>"); element.fadeTo(200,1); diff --git a/app/views/contacts/index.html.haml b/app/views/contacts/index.html.haml index 5c7714eb818b5313c3a36a939bc9b96389232d98..0a7d1a309d641fbcd72ea56956a022078c530a7b 100644 --- a/app/views/contacts/index.html.haml +++ b/app/views/contacts/index.html.haml @@ -9,6 +9,8 @@ - content_for :head do = include_javascripts :people + + #section_header %h2 = t('.title') @@ -20,7 +22,13 @@ #people_stream.stream.contacts - if @aspect_ #aspect_controls - /= link_to t('.start_a_conversation'), new_conversation_path(:aspect_id => @aspect_.id, :name => @aspect_.name), :class => "button conversation_button", :rel => "facebox" + - suggested_limit = 16 + - 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 + + = link_to t('.start_a_conversation'), new_conversation_path(:aspect_id => @aspect_.id, :name => @aspect_.name), conv_opts + - if @contacts.size > suggested_limit + = javascript_tag "$('.conversation_button').tipsy({trigger: 'hover', gravity: 'n'});" = link_to t('.edit_aspect', :name => @aspect_.name), edit_aspect_path(@aspect_), :rel => "facebox" - if @contacts.size > 0 diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index b8a609eb0e3586156964f6d3aaf70e156d86a991..4bac06a5fc5cdc98c30f491b3acd9e4f7da55686 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -214,6 +214,7 @@ en: all_contacts: "All Contacts" only_sharing_with_me: "Only sharing with me" remove_person_from_aspect: "Remove %{person_name} from \"%{aspect_name}\"" + many_people_are_you_sure: "Are you sure you want to start a private conversation with more than %{suggested_limit} contacts? Posting to this aspect may be a better way to contact them." conversations: index: diff --git a/config/routes.rb b/config/routes.rb index e78d8b2ec2fc820f615a05a41bcd5336fcc45064..4cfdf5bcc67d26f6e16a2f76cb006c384f14567f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -83,6 +83,7 @@ Diaspora::Application.routes.draw do match 'user_search' => :user_search get 'admin_inviter' => :admin_inviter get 'add_invites' => :add_invites, :as => 'add_invites' + get 'stats' => :stats, :as => 'pod_stats' end resource :profile diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 1bf2f0d6b8c6dd31597f064d2b35736bef11d14c..e7054bdc566e960b4437791ab41166ddd71327dc 100644 --- a/features/step_definitions/user_steps.rb +++ b/features/step_definitions/user_steps.rb @@ -121,7 +121,6 @@ When /^I (add|remove|toggle) the person (to|from) my ([\d])(nd|rd|st|th) aspect$ steps %Q{ And I press the first ".toggle.button" And I press the #{aspect_number}#{nd} "li" within ".dropdown.active .dropdown_list" - And I wait for the ajax to finish And I press the first ".toggle.button" } end diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 5faf6cf0b2cf1740a893a437014e75fd2bc538d7..ccfdfee8b02107f6393a1be575615879080159f3 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -3078,16 +3078,28 @@ ul.left_nav :width 70px :margin :right 10px + :left 0 + :top 0 !important :background :color $background + :height 70px + :padding 5px - :bottom 55px + :bottom 25px :border 1px solid #999 :width 240px + + h4 + :margin + :bottom 10px + a + :color $blue + :font + :weight bold !important .hovercard_footer :position absolute @@ -3097,8 +3109,7 @@ ul.left_nav :color #eee :width 100% - :height 20px - :min-height 20px + :min-height 19px :font :size smaller @@ -3107,7 +3118,7 @@ ul.left_nav :top 1px solid #ccc .footer_container - :padding 2px 5px + :padding 1px 5px .hashtags :overflow hidden @@ -3118,6 +3129,8 @@ ul.left_nav :color #999 :margin :right 4px + :font + :weight normal #hovercard_container :padding 10px diff --git a/public/stylesheets/sass/ui.sass b/public/stylesheets/sass/ui.sass index c811f7da647b78c26b05b4e5b8bbae0836fb178a..a5b9eaaa114f7531ac5b4bfac0a07d248e8cec54 100644 --- a/public/stylesheets/sass/ui.sass +++ b/public/stylesheets/sass/ui.sass @@ -122,16 +122,19 @@ ul @include user-select(none) + :font + :size normal :padding 0 !important :margin 0 !important - :color #333 + :color #000 > li :font-size 11px !important :padding 3px 2px :left 24px :position relative + :color #222 .check, .checkWhite diff --git a/spec/controllers/admins_controller_spec.rb b/spec/controllers/admins_controller_spec.rb index 48348e0da9b9448e322e3a244c5bba5f43814e7f..5b744d9c5171c856461024c3427fc98b02e2706f 100644 --- a/spec/controllers/admins_controller_spec.rb +++ b/spec/controllers/admins_controller_spec.rb @@ -116,4 +116,16 @@ describe AdminsController do end end end + + describe '#stats' do + before do + AppConfig[:admins] = [@user.username] + end + + it 'succeeds and renders stats' do + get :stats + response.should be_success + response.should render_template(:stats) + end + end end diff --git a/spec/models/status_message_spec.rb b/spec/models/status_message_spec.rb index 80969ddb0cce5fa0acc7d3419249c618d7c43b2b..ce2f6e5577010d35c749ff2f5eaaef37da16d86e 100644 --- a/spec/models/status_message_spec.rb +++ b/spec/models/status_message_spec.rb @@ -87,8 +87,8 @@ STR describe '#format_mentions' do it 'adds the links in the formated message text' do @sm.format_mentions(@sm.raw_message).should == <<-STR -#{link_to('@' << @people[0].name, person_path(@people[0]), :class => 'mention')} can mention people like Raphael #{link_to('@' << @people[1].name, person_path(@people[1]), :class => 'mention')} -can mention people like Raphaellike Raphael #{link_to('@' << @people[2].name, person_path(@people[2]), :class => 'mention')} can mention people like Raph +#{link_to('@' << @people[0].name, person_path(@people[0]), :class => 'mention hovercardable')} can mention people like Raphael #{link_to('@' << @people[1].name, person_path(@people[1]), :class => 'mention hovercardable')} +can mention people like Raphaellike Raphael #{link_to('@' << @people[2].name, person_path(@people[2]), :class => 'mention hovercardable')} can mention people like Raph STR end