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
......@@ -5,6 +5,8 @@
class StatusMessagesController < ApplicationController
before_filter :authenticate_user!
before_filter :remove_getting_started, :only => [:create]
respond_to :html
respond_to :mobile
......@@ -96,4 +98,11 @@ class StatusMessagesController < ApplicationController
def comments_expanded
true
end
def remove_getting_started
if current_user.getting_started == true
current_user.update_attributes(:getting_started => false)
end
true
end
end
......@@ -10,6 +10,8 @@ module InterimStreamHackinessHelper
end
end
##### These methods need to go away once we pass publisher object into the partial ######
def publisher_prefill_text
if params[:prefill].present?
params[:prefill]
......@@ -43,4 +45,20 @@ module InterimStreamHackinessHelper
false
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
......@@ -16,6 +16,19 @@
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 )}
.content_creation
= form_for(StatusMessage.new, :remote => remote?, :html => {"data-type" => "json"}) do |status|
......@@ -25,14 +38,16 @@
#publisher_textarea_wrapper
= link_to( image_tag('deletelabel.png'), "#", :id => "hide_publisher", :title => t('.discard_post'))
%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'
#file-upload{:title => t('.upload_photos')}
= 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"
- else
- for aspect_id in aspect_ids
......@@ -48,9 +63,11 @@
// 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
- if selected_aspects.size == all_aspects.size
- if publisher_public
= t('public')
- elsif all_aspects_selected?(selected_aspects)
= t('all_aspects')
- elsif selected_aspects.size == 1
= selected_aspects.first.name
......@@ -60,11 +77,11 @@
.wrapper
%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
%li.divider.all_aspects.radio{:style => "border-bottom: 1px solid #ddd;", "data-aspect_id" => "all_aspects", :class => ("selected" if all_aspects_selected?(selected_aspects))}
All 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)))}
= t('all_aspects')
- for aspect in all_aspects
= aspect_dropdown_list_item(aspect, !all_aspects_selected?(selected_aspects) && selected_aspects.include?(aspect) )
......
......@@ -731,6 +731,9 @@ en:
whats_on_your_mind: "What's on your mind?"
publishing_to: "publishing to: "
discard_post: "Discard post"
new_user_prefill:
hello: "Hey everyone, I'm #%{new_user_tag}. "
i_like: "I like %{tags}."
add_contact:
enter_a_diaspora_username: "Enter a Diaspora username:"
your_diaspora_username_is: "Your Diaspora username is: %{diaspora_handle}"
......@@ -750,6 +753,8 @@ en:
reshare:
reshare: "Reshare"
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"
outside: "Public messages will be available for others outside of Diaspora to see."
logged_in: "logged in to %{service}"
......
class Publisher
attr_accessor :user, :open, :prefill, :public
attr_accessor :user, :open, :prefill, :public, :explain
def initialize(user, opts={})
self.user = user
self.open = (opts[:open] == true)? true : false
self.prefill = opts[:prefill]
self.public = (opts[:public] == true)? true : false
self.explain = (opts[:explain] == true)? true : false
end
def open?
......@@ -15,4 +16,8 @@ class Publisher
def public?
self.public
end
def explain?
self.explain
end
end
......@@ -141,11 +141,10 @@ class Stream::Aspect < Stream::Base
#
# @return [String]
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
tag_string = self.user.followed_tags.map{|t| "##{t.name}"}.join(", ")
prefill << "I like #{tag_string}."
tag_string = self.user.followed_tags.map{|t| "##{t.name}"}.to_sentence
prefill << I18n.t("shared.publisher.new_user_prefill.i_like", :tags => tag_string)
end
prefill
......
......@@ -48,6 +48,11 @@ describe StatusMessagesController do
: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
it 'responds' do
post :create, status_message_hash.merge(:format => 'js')
......@@ -155,4 +160,24 @@ describe StatusMessagesController do
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
......@@ -9,15 +9,7 @@ describe Publisher do
@publisher = Publisher.new(alice)
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
it 'defaults to nothing' do
......@@ -29,13 +21,17 @@ describe Publisher do
end
end
describe "#public?" do
it 'defaults to false' do
@publisher.public?.should be_false
["open", "public", "explain"].each do |property|
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, :public => true).public?.should be_true
Publisher.new(alice, {property.to_sym => true}).send("#{property}?".to_sym).should be_true
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