Commit 431fa3fd authored by Ilya Zhitomirskiy's avatar Ilya Zhitomirskiy Committed by danielgrippi

removing getting started on first post and having tooltips in the

publisher
parent 1ccf9651
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
class StatusMessagesController < ApplicationController class StatusMessagesController < ApplicationController
before_filter :authenticate_user! before_filter :authenticate_user!
before_filter :remove_getting_started, :only => [:create]
respond_to :html respond_to :html
respond_to :mobile respond_to :mobile
...@@ -96,4 +98,11 @@ class StatusMessagesController < ApplicationController ...@@ -96,4 +98,11 @@ class StatusMessagesController < ApplicationController
def comments_expanded def comments_expanded
true true
end end
def remove_getting_started
if current_user.getting_started == true
current_user.update_attributes(:getting_started => false)
end
true
end
end end
...@@ -10,6 +10,8 @@ module InterimStreamHackinessHelper ...@@ -10,6 +10,8 @@ module InterimStreamHackinessHelper
end end
end end
##### These methods need to go away once we pass publisher object into the partial ######
def publisher_prefill_text def publisher_prefill_text
if params[:prefill].present? if params[:prefill].present?
params[:prefill] params[:prefill]
...@@ -43,4 +45,20 @@ module InterimStreamHackinessHelper ...@@ -43,4 +45,20 @@ module InterimStreamHackinessHelper
false false
end end
end end
def publisher_public
if defined?(@stream)
@stream.publisher.public?
else
false
end
end
def publisher_explain
if defined?(@stream)
@stream.publisher.public?
else
false
end
end
end end
...@@ -16,6 +16,19 @@ ...@@ -16,6 +16,19 @@
Publisher.open(); Publisher.open();
}); });
-if publisher_explain
:javascript
$(document).ready(function()
{
$("#publisher .dropdown").tipsy({trigger: 'manual', gravity: 'n'});
$("#publisher .dropdown").tipsy("show");
$("#publisher .dropdown").bind("click", function(){$(this).tipsy("hide")});
$("#publisher #status_message_fake_text").tipsy({trigger: 'manual', gravity: 'w', id: "first_message_explain"});
$("#publisher #status_message_fake_text").tipsy("show");
$("#publisher #status_message_fake_text").bind("click", function(){$(this).tipsy("hide")});
});
#publisher.closed{:class => ((aspect == :profile)? 'mention_popup' : nil )} #publisher.closed{:class => ((aspect == :profile)? 'mention_popup' : nil )}
.content_creation .content_creation
= form_for(StatusMessage.new, :remote => remote?, :html => {"data-type" => "json"}) do |status| = form_for(StatusMessage.new, :remote => remote?, :html => {"data-type" => "json"}) do |status|
...@@ -25,14 +38,16 @@ ...@@ -25,14 +38,16 @@
#publisher_textarea_wrapper #publisher_textarea_wrapper
= link_to( image_tag('deletelabel.png'), "#", :id => "hide_publisher", :title => t('.discard_post')) = link_to( image_tag('deletelabel.png'), "#", :id => "hide_publisher", :title => t('.discard_post'))
%ul#photodropzone %ul#photodropzone
= status.text_area :fake_text, :rows => 2, :value => h(publisher_prefill_text), :tabindex => 1, :placeholder => t('.whats_on_your_mind') = status.text_area :fake_text, :rows => 2, :value => h(publisher_prefill_text), :tabindex => 1, :placeholder => t('.whats_on_your_mind'), :title => t('shared.public_explain.new_user_welcome_message')
= status.hidden_field :text, :value => '', :class => 'clear_on_submit' = status.hidden_field :text, :value => '', :class => 'clear_on_submit'
#file-upload{:title => t('.upload_photos')} #file-upload{:title => t('.upload_photos')}
= image_tag 'icons/camera.svg', :height => 14 = image_tag 'icons/camera.svg', :height => 14
- if all_aspects_selected?(selected_aspects) - if publisher_public
= hidden_field_tag 'aspect_ids[]', "public"
- elsif all_aspects_selected?(selected_aspects)
= hidden_field_tag 'aspect_ids[]', "all_aspects" = hidden_field_tag 'aspect_ids[]', "all_aspects"
- else - else
- for aspect_id in aspect_ids - for aspect_id in aspect_ids
...@@ -48,9 +63,11 @@ ...@@ -48,9 +63,11 @@
// NOTE(dropdown special casing to DRY up -- taken from the aspect_dropdown partial) // NOTE(dropdown special casing to DRY up -- taken from the aspect_dropdown partial)
.dropdown{:class => "hang_right"} .dropdown{:class => "hang_right", :title => t('shared.public_explain.visibility_dropdown')}
.button.toggle.publisher .button.toggle.publisher
- if selected_aspects.size == all_aspects.size - if publisher_public
= t('public')
- elsif all_aspects_selected?(selected_aspects)
= t('all_aspects') = t('all_aspects')
- elsif selected_aspects.size == 1 - elsif selected_aspects.size == 1
= selected_aspects.first.name = selected_aspects.first.name
...@@ -60,11 +77,11 @@ ...@@ -60,11 +77,11 @@
.wrapper .wrapper
%ul.dropdown_list{:unSelectable => 'on', 'data-person_id' => (person.id if defined?(person) && person), 'data-service_uid' => (service_uid if defined?(service_uid))} %ul.dropdown_list{:unSelectable => 'on', 'data-person_id' => (person.id if defined?(person) && person), 'data-service_uid' => (service_uid if defined?(service_uid))}
%li.public.radio{"data-aspect_id" => "public"} %li.public.radio{"data-aspect_id" => "public", :class => ("selected" if publisher_public)}
Public Public
%li.divider.all_aspects.radio{:style => "border-bottom: 1px solid #ddd;", "data-aspect_id" => "all_aspects", :class => ("selected" if all_aspects_selected?(selected_aspects))} %li.divider.all_aspects.radio{:style => "border-bottom: 1px solid #ddd;", "data-aspect_id" => "all_aspects", :class => ("selected" if (!publisher_public && all_aspects_selected?(selected_aspects)))}
All Aspects = t('all_aspects')
- for aspect in all_aspects - for aspect in all_aspects
= aspect_dropdown_list_item(aspect, !all_aspects_selected?(selected_aspects) && selected_aspects.include?(aspect) ) = aspect_dropdown_list_item(aspect, !all_aspects_selected?(selected_aspects) && selected_aspects.include?(aspect) )
......
...@@ -731,6 +731,9 @@ en: ...@@ -731,6 +731,9 @@ en:
whats_on_your_mind: "What's on your mind?" whats_on_your_mind: "What's on your mind?"
publishing_to: "publishing to: " publishing_to: "publishing to: "
discard_post: "Discard post" discard_post: "Discard post"
new_user_prefill:
hello: "Hey everyone, I'm #%{new_user_tag}. "
i_like: "I like %{tags}."
add_contact: add_contact:
enter_a_diaspora_username: "Enter a Diaspora username:" enter_a_diaspora_username: "Enter a Diaspora username:"
your_diaspora_username_is: "Your Diaspora username is: %{diaspora_handle}" your_diaspora_username_is: "Your Diaspora username is: %{diaspora_handle}"
...@@ -750,6 +753,8 @@ en: ...@@ -750,6 +753,8 @@ en:
reshare: reshare:
reshare: "Reshare" reshare: "Reshare"
public_explain: public_explain:
new_user_welcome_message: "Welcome aboard! If you want, this can be your first message."
visibility_dropdown: "Use this dropdown to change visibility of your post"
title: "Set up connected services" title: "Set up connected services"
outside: "Public messages will be available for others outside of Diaspora to see." outside: "Public messages will be available for others outside of Diaspora to see."
logged_in: "logged in to %{service}" logged_in: "logged in to %{service}"
......
class Publisher class Publisher
attr_accessor :user, :open, :prefill, :public attr_accessor :user, :open, :prefill, :public, :explain
def initialize(user, opts={}) def initialize(user, opts={})
self.user = user self.user = user
self.open = (opts[:open] == true)? true : false self.open = (opts[:open] == true)? true : false
self.prefill = opts[:prefill] self.prefill = opts[:prefill]
self.public = (opts[:public] == true)? true : false self.public = (opts[:public] == true)? true : false
self.explain = (opts[:explain] == true)? true : false
end end
def open? def open?
...@@ -15,4 +16,8 @@ class Publisher ...@@ -15,4 +16,8 @@ class Publisher
def public? def public?
self.public self.public
end end
def explain?
self.explain
end
end end
...@@ -141,11 +141,10 @@ class Stream::Aspect < Stream::Base ...@@ -141,11 +141,10 @@ class Stream::Aspect < Stream::Base
# #
# @return [String] # @return [String]
def publisher_prefill def publisher_prefill
prefill = "Hi, I'm #newhere." prefill = I18n.t("shared.publisher.new_user_prefill.hello", :new_user_tag => "newHere")
if self.user.followed_tags.size > 0 if self.user.followed_tags.size > 0
tag_string = self.user.followed_tags.map{|t| "##{t.name}"}.join(", ") tag_string = self.user.followed_tags.map{|t| "##{t.name}"}.to_sentence
prefill << "I like #{tag_string}." prefill << I18n.t("shared.publisher.new_user_prefill.i_like", :tags => tag_string)
end end
prefill prefill
......
...@@ -47,6 +47,11 @@ describe StatusMessagesController do ...@@ -47,6 +47,11 @@ describe StatusMessagesController do
}, },
:aspect_ids => [@aspect1.id.to_s] } :aspect_ids => [@aspect1.id.to_s] }
} }
it 'removes getting started from new users' do
@controller.should_receive(:remove_getting_started)
post :create, status_message_hash
end
context 'js requests' do context 'js requests' do
it 'responds' do it 'responds' do
...@@ -155,4 +160,24 @@ describe StatusMessagesController do ...@@ -155,4 +160,24 @@ describe StatusMessagesController do
end end
end end
end end
describe '#remove_getting_started' do
it 'removes the getting started flag from new users' do
alice.getting_started = true
alice.save
expect{
@controller.remove_getting_started
}.should change{
alice.reload.getting_started
}.from(true).to(false)
end
it 'does nothing for returning users' do
expect{
@controller.remove_getting_started
}.should_not change{
alice.reload.getting_started
}
end
end
end end
...@@ -9,15 +9,7 @@ describe Publisher do ...@@ -9,15 +9,7 @@ describe Publisher do
@publisher = Publisher.new(alice) @publisher = Publisher.new(alice)
end end
describe '#open?' do
it 'defaults to closed' do
@publisher.open?.should be_false
end
it 'listens to the opts' do
Publisher.new(alice, :open => true).open?.should be_true
end
end
describe "#prefill" do describe "#prefill" do
it 'defaults to nothing' do it 'defaults to nothing' do
...@@ -29,13 +21,17 @@ describe Publisher do ...@@ -29,13 +21,17 @@ describe Publisher do
end end
end end
describe "#public?" do
it 'defaults to false' do
@publisher.public?.should be_false
end
it 'listens to the opts' do ["open", "public", "explain"].each do |property|
Publisher.new(alice, :public => true).public?.should be_true describe "##{property}?" do
it 'defaults to closed' do
@publisher.send("#{property}?".to_sym).should be_false
end
it 'listens to the opts' do
Publisher.new(alice, {property.to_sym => true}).send("#{property}?".to_sym).should be_true
end
end end
end end
end end
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