From 8d94115bbcd317f59ffc9acdb45b4db5396c5401 Mon Sep 17 00:00:00 2001 From: Ilyaaaaaaaaaaaaa Zhitomirskiy Date: Wed, 6 Jul 2011 16:04:43 -0700 Subject: [PATCH 01/10] added the start conversation button back with a message if you try to add more than 16 people --- app/views/contacts/index.html.haml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/views/contacts/index.html.haml b/app/views/contacts/index.html.haml index 5c7714eb8..f0b9970e0 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] = "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." 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 From 738487b381b1a854851d3fcf49350a54f3a0e63e Mon Sep 17 00:00:00 2001 From: Ilyaaaaaaaaaaaaa Zhitomirskiy Date: Wed, 6 Jul 2011 16:34:51 -0700 Subject: [PATCH 02/10] moved the are you sure dialog into a translation --- app/views/contacts/index.html.haml | 2 +- config/locales/diaspora/en.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/contacts/index.html.haml b/app/views/contacts/index.html.haml index f0b9970e0..0a7d1a309 100644 --- a/app/views/contacts/index.html.haml +++ b/app/views/contacts/index.html.haml @@ -24,7 +24,7 @@ #aspect_controls - suggested_limit = 16 - conv_opts = { :class => "button conversation_button", :rel => "facebox"} - - conv_opts[:title] = "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." 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 - if @contacts.size > suggested_limit diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index b8a609eb0..4bac06a5f 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: From f3d185fe410238158fe703ae95aaf2f62d985423 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 6 Jul 2011 17:13:11 -0700 Subject: [PATCH 03/10] hovercard on comments --- app/models/person.rb | 2 +- app/models/status_message.rb | 4 ++-- public/stylesheets/sass/application.sass | 18 ++++++++++++++---- spec/models/status_message_spec.rb | 4 ++-- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/models/person.rb b/app/models/person.rb index c56adb374..e67a5071f 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 0c8e998b2..a5aed41b3 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 ? "@#{ERB::Util.h(person.name)}" : ERB::Util.h($~[1]) + person ? "@#{ERB::Util.h(person.name)}" : ERB::Util.h($~[1]) end end form_message @@ -107,7 +107,7 @@ class StatusMessage < Post http://activitystrea.ms/schema/1.0/post http://activitystrea.ms/schema/1.0/note - XML + XML end def socket_to_user(user_or_id, opts={}) diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 5faf6cf0b..401703856 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -3082,12 +3082,21 @@ ul.left_nav :background :color $background + :height 70px + :padding 5px - :bottom 55px + :bottom 25px :border 1px solid #999 :width 240px + + h4 + :margin + :bottom 10px + a + :font + :weight bold !important .hovercard_footer :position absolute @@ -3097,8 +3106,7 @@ ul.left_nav :color #eee :width 100% - :height 20px - :min-height 20px + :min-height 19px :font :size smaller @@ -3107,7 +3115,7 @@ ul.left_nav :top 1px solid #ccc .footer_container - :padding 2px 5px + :padding 1px 5px .hashtags :overflow hidden @@ -3118,6 +3126,8 @@ ul.left_nav :color #999 :margin :right 4px + :font + :weight normal #hovercard_container :padding 10px diff --git a/spec/models/status_message_spec.rb b/spec/models/status_message_spec.rb index 80969ddb0..ce2f6e557 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 From 03df3e3e59f26f49bfd09cddf2c7e1fbd3571b81 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Wed, 6 Jul 2011 18:32:46 -0700 Subject: [PATCH 04/10] Fix manages_aspects feature --- app/views/aspect_memberships/create.js.erb | 2 -- app/views/aspect_memberships/destroy.js.erb | 1 - 2 files changed, 3 deletions(-) diff --git a/app/views/aspect_memberships/create.js.erb b/app/views/aspect_memberships/create.js.erb index 2292d0ae6..28f41cb13 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 3c48c7229..e8a933719 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); From 46ef376bc1e4ad97da9b978cd27c08fa70347ec2 Mon Sep 17 00:00:00 2001 From: Raphael Sofaer Date: Wed, 6 Jul 2011 18:51:34 -0700 Subject: [PATCH 05/10] Fix notifications feature --- features/step_definitions/user_steps.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/features/step_definitions/user_steps.rb b/features/step_definitions/user_steps.rb index 1bf2f0d6b..e7054bdc5 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 From b1fc87ea30eb2661288f6a723cbdc54c299852db Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 6 Jul 2011 19:07:44 -0700 Subject: [PATCH 06/10] add basic overview page to admin controller --- app/controllers/admins_controller.rb | 8 ++++++++ app/views/admins/stats.html.haml | 19 +++++++++++++++++++ config/routes.rb | 1 + spec/controllers/admins_controller_spec.rb | 12 ++++++++++++ 4 files changed, 40 insertions(+) create mode 100644 app/views/admins/stats.html.haml diff --git a/app/controllers/admins_controller.rb b/app/controllers/admins_controller.rb index 1b7e858f8..bd2dc4d13 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/views/admins/stats.html.haml b/app/views/admins/stats.html.haml new file mode 100644 index 000000000..565e7cfdf --- /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/config/routes.rb b/config/routes.rb index e78d8b2ec..4cfdf5bcc 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/spec/controllers/admins_controller_spec.rb b/spec/controllers/admins_controller_spec.rb index 48348e0da..5b744d9c5 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 From 2d98b939d10af04ef03c2cb65a6fd94174367d08 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 6 Jul 2011 19:11:53 -0700 Subject: [PATCH 07/10] ordered hash stuff --- app/views/admins/stats.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/stats.html.haml b/app/views/admins/stats.html.haml index 565e7cfdf..cc9073ea4 100644 --- a/app/views/admins/stats.html.haml +++ b/app/views/admins/stats.html.haml @@ -1,7 +1,7 @@ .span-24.last %h3 = for tg in @popular_tags - = link_to tg, tags_path(tg) + = link_to tg.first.first.name, tags_path(tg.first.first.name) %br %br From f0fa79bb09173c94a5dd538a626b716669767420 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 6 Jul 2011 19:13:34 -0700 Subject: [PATCH 08/10] Revert "ordered hash stuff" This reverts commit 2d98b939d10af04ef03c2cb65a6fd94174367d08. --- app/views/admins/stats.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admins/stats.html.haml b/app/views/admins/stats.html.haml index cc9073ea4..565e7cfdf 100644 --- a/app/views/admins/stats.html.haml +++ b/app/views/admins/stats.html.haml @@ -1,7 +1,7 @@ .span-24.last %h3 = for tg in @popular_tags - = link_to tg.first.first.name, tags_path(tg.first.first.name) + = link_to tg, tags_path(tg) %br %br From fdaa44ca9c476f2cf8062a273210999911cac501 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 6 Jul 2011 21:09:24 -0700 Subject: [PATCH 09/10] add hovercards to links in likes --- app/helpers/notifications_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index 5c30f9ede..a9353fd5a 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 number_of_actors < 4 message = actor_links.to_sentence(sentence_translations) From e994c90559b9fb379eb1e5de0ea4931c9b2e07c2 Mon Sep 17 00:00:00 2001 From: danielgrippi Date: Wed, 6 Jul 2011 21:33:59 -0700 Subject: [PATCH 10/10] don't show hovercard for current_user in likes field + fixed hovercard styling in likes field --- app/helpers/notifications_helper.rb | 2 +- public/stylesheets/sass/application.sass | 3 +++ public/stylesheets/sass/ui.sass | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb index a9353fd5a..e15a1d6fd 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), :class => 'hovercardable')} + 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/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 401703856..ccfdfee8b 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -3078,6 +3078,8 @@ ul.left_nav :width 70px :margin :right 10px + :left 0 + :top 0 !important :background :color $background @@ -3095,6 +3097,7 @@ ul.left_nav :margin :bottom 10px a + :color $blue :font :weight bold !important diff --git a/public/stylesheets/sass/ui.sass b/public/stylesheets/sass/ui.sass index c811f7da6..a5b9eaaa1 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