Commit 79ec50a1 authored by danielgrippi's avatar danielgrippi

DG MS; added setting for displaying spotlight members in soup stream

parent 1256b6f3
......@@ -41,12 +41,20 @@ class UsersController < ApplicationController
else
flash[:error] = I18n.t 'users.update.password_not_changed'
end
elsif u[:show_community_spotlight_in_stream]
if @user.update_attributes(u)
flash[:notice] = I18n.t 'users.update.settings_updated'
redirect_to soup_path
return
else
flash[:notice] = I18n.t 'users.update.settings_not_updated'
end
elsif u[:language]
if @user.update_attributes(:language => u[:language])
if @user.update_attributes(u)
I18n.locale = @user.language
flash[:notice] = I18n.t 'users.update.language_changed'
flash[:notice] = I18n.t 'users.update.language_updated'
else
flash[:error] = I18n.t 'users.update.language_not_changed'
flash[:error] = I18n.t 'users.update.language_not_updated'
end
elsif u[:email]
@user.unconfirmed_email = u[:email]
......
......@@ -5,7 +5,7 @@ module InterimStreamHackinessHelper
@commenting_disabled
elsif defined?(@stream)
!@stream.can_comment?(post)
else
else
false
end
end
......@@ -31,4 +31,8 @@ module InterimStreamHackinessHelper
def what_soup_sentence(post)
from_group(post).map{|x| x.to_s.gsub("_soup", '').gsub('_',' ').titleize}.to_sentence
end
def stream_settings_link(post)
link_to "", "#{edit_user_path}#stream-preferences"
end
end
......@@ -58,7 +58,8 @@ class User < ActiveRecord::Base
:language,
:disable_mail,
:invitation_service,
:invitation_identifier
:invitation_identifier,
:show_community_spotlight_in_stream
def self.all_sharing_with_person(person)
......
......@@ -16,11 +16,12 @@
= render 'shared/publisher', :selected_aspects => stream.aspects, :aspect_ids => stream.aspect_ids, :for_all_aspects => stream.for_all_aspects?, :aspect => stream.aspect
= render 'aspects/no_posts_message'
- if current_user.contacts.size < 2
= render 'aspects/no_contacts_message'
#main_stream.stream{:data => {:guids => stream.aspect_ids.join(','), :time_for_scroll => time_for_scroll(stream.ajax_stream?, stream)}}
- if !stream.ajax_stream? && stream.posts.length > 0
= render 'shared/stream', :posts => stream.posts
#pagination
=link_to(t('more'), next_page_path(:ajax_stream => stream.ajax_stream?), :class => 'paginate')
- if current_user.contacts.size < 2
= render 'aspects/no_contacts_message'
......@@ -17,7 +17,10 @@
%p
= t('share_visibilites.update.see_it_on_their_profile', :name => person_link(post.author)).html_safe
= link_to t('undo'), share_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true
.indicator{:title => "from #{what_soup_sentence(post)}"}
= stream_settings_link(post)
.sm_body
= person_image_link(post.author, :size => :thumb_small)
.content
......
......@@ -68,6 +68,24 @@
= f.select :language, available_language_options
= f.submit t('.change_language')
%br
%br
%hr
%br
%h3#stream-preferences
= t('.stream_preferences')
= form_for current_user, :url => user_path, :html => { :method => :put } do |f|
= f.error_messages
%p.checkbox_select
= f.label t('.show_community_spotlight')
= f.check_box :show_community_spotlight_in_stream
%br
= f.submit t('.change'), :class => 'button'
%br
%br
%hr
......
......@@ -116,7 +116,7 @@ en:
start_talking: "Nobody has said anything yet!"
no_contacts_message:
you_should_add_some_more_contacts: "You should add some more contacts!"
try_adding_some_more_contacts: "You can search (top) or invite (right) more contacts."
try_adding_some_more_contacts: "You can search or invite more contacts."
or_spotlight: "Or you can share with %{link}"
community_spotlight: "community spotlight"
aspect_listings:
......@@ -876,6 +876,8 @@ en:
reshared: "...someone reshares your post?"
change: "Change"
email_awaiting_confirmation: "We have sent you an activation link to %{unconfirmed_email}. Until you follow this link and activate the new address, we will continue to use your original address %{email}."
stream_preferences: "Stream Preferences"
show_community_spotlight: "Show Community Spotlight in Stream?"
destroy: "Your account has been locked. It may take 20 minutes for us to finish closing your account. Thank you for trying Diaspora."
getting_started:
welcome: "Welcome!"
......@@ -924,8 +926,13 @@ en:
update:
password_changed: "Password changed. You can now log in with your new password."
password_not_changed: "Password change failed"
language_changed: "Language changed"
language_not_changed: "Language change failed"
settings_updated: "Settings updated"
settings_not_updated: "Settings update failed"
email_notifications_changed: "Email notifications changed"
unconfirmed_email_changed: "Email changed. Needs activation."
unconfirmed_email_not_changed: "Email change failed"
......
class AddCommunitySpotlightInStream < ActiveRecord::Migration
def self.up
add_column :users, :show_community_spotlight_in_stream, :boolean, :null => false, :default => true
ActiveRecord::Base.connection.execute <<SQL
UPDATE users
SET show_community_spotlight_in_stream = false
SQL
end
def self.down
remove_column :users , :show_community_spotlight_in_stream
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20111018010003) do
ActiveRecord::Schema.define(:version => 20111021184041) do
create_table "aspect_memberships", :force => true do |t|
t.integer "aspect_id", :null => false
......@@ -32,8 +32,10 @@ ActiveRecord::Schema.define(:version => 20111018010003) do
end
add_index "aspect_visibilities", ["aspect_id"], :name => "index_aspect_visibilities_on_aspect_id"
add_index "aspect_visibilities", ["shareable_id", "aspect_id"], :name => "index_aspect_visibilities_on_post_id_and_aspect_id", :unique => true
add_index "aspect_visibilities", ["shareable_id", "shareable_type", "aspect_id"], :name => "shareable_and_aspect_id"
add_index "aspect_visibilities", ["shareable_id", "shareable_type"], :name => "index_aspect_visibilities_on_shareable_id_and_shareable_type"
add_index "aspect_visibilities", ["shareable_id"], :name => "index_aspect_visibilities_on_post_id"
create_table "aspects", :force => true do |t|
t.string "name", :null => false
......@@ -48,17 +50,17 @@ ActiveRecord::Schema.define(:version => 20111018010003) do
add_index "aspects", ["user_id"], :name => "index_aspects_on_user_id"
create_table "comments", :force => true do |t|
t.text "text", :null => false
t.integer "commentable_id", :null => false
t.integer "author_id", :null => false
t.string "guid", :null => false
t.text "text", :null => false
t.integer "commentable_id", :null => false
t.integer "author_id", :null => false
t.string "guid", :null => false
t.text "author_signature"
t.text "parent_author_signature"
t.text "youtube_titles"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "likes_count", :default => 0, :null => false
t.string "commentable_type", :limit => 60, :default => "Post", :null => false
t.integer "likes_count", :default => 0, :null => false
t.string "commentable_type", :default => "Post", :null => false
end
add_index "comments", ["author_id"], :name => "index_comments_on_person_id"
......@@ -364,15 +366,17 @@ ActiveRecord::Schema.define(:version => 20111018010003) do
add_index "services", ["user_id"], :name => "index_services_on_user_id"
create_table "share_visibilities", :force => true do |t|
t.integer "shareable_id", :null => false
t.integer "shareable_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "hidden", :default => false, :null => false
t.integer "contact_id", :null => false
t.string "shareable_type", :limit => 60, :default => "Post", :null => false
t.boolean "hidden", :default => false, :null => false
t.integer "contact_id", :null => false
t.string "shareable_type", :default => "Post", :null => false
end
add_index "share_visibilities", ["contact_id", "shareable_id"], :name => "index_post_visibilities_on_contact_id_and_post_id", :unique => true
add_index "share_visibilities", ["contact_id"], :name => "index_post_visibilities_on_contact_id"
add_index "share_visibilities", ["shareable_id", "hidden", "contact_id"], :name => "index_post_visibilities_on_post_id_and_hidden_and_contact_id", :unique => true
add_index "share_visibilities", ["shareable_id", "shareable_type", "contact_id"], :name => "shareable_and_contact_id"
add_index "share_visibilities", ["shareable_id", "shareable_type", "hidden", "contact_id"], :name => "shareable_and_hidden_and_contact_id"
add_index "share_visibilities", ["shareable_id"], :name => "index_post_visibilities_on_post_id"
......@@ -415,32 +419,33 @@ ActiveRecord::Schema.define(:version => 20111018010003) do
create_table "users", :force => true do |t|
t.string "username"
t.text "serialized_private_key"
t.boolean "getting_started", :default => true, :null => false
t.boolean "disable_mail", :default => false, :null => false
t.boolean "getting_started", :default => true, :null => false
t.boolean "disable_mail", :default => false, :null => false
t.string "language"
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "invitation_token", :limit => 60
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "invitation_token", :limit => 60
t.datetime "invitation_sent_at"
t.string "reset_password_token"
t.string "remember_token"
t.datetime "remember_created_at"
t.integer "sign_in_count", :default => 0
t.integer "sign_in_count", :default => 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "invitation_service", :limit => 127
t.string "invitation_identifier", :limit => 127
t.string "invitation_service", :limit => 127
t.string "invitation_identifier", :limit => 127
t.integer "invitation_limit"
t.integer "invited_by_id"
t.string "invited_by_type"
t.string "authentication_token", :limit => 30
t.string "authentication_token", :limit => 30
t.string "unconfirmed_email"
t.string "confirm_email_token", :limit => 30
t.string "confirm_email_token", :limit => 30
t.datetime "locked_at"
t.boolean "show_community_spotlight_in_stream", :default => true, :null => false
end
add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token", :unique => true
......
......@@ -40,7 +40,7 @@ class Stream::Soup < Stream::Base
end
def include_community_spotlight?
false
user.show_community_spotlight_in_stream?
end
def aspects_post_ids
......
......@@ -3500,6 +3500,12 @@ ul#getting_started
:height 4px
:float right
a
:display block
:height 100%
:width 100%
:padding 0
:margin 0
.community_spotlight_soup
.indicator
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment