Merge pull request #1731 from ticho/1587-publisher-globe-icon-tooltip

More descriptive and context-aware tooltip for the globe icon in publisher.
This commit is contained in:
Sarah Mei 2011-08-06 16:03:48 -07:00
commit ffb6b18ce8
5 changed files with 24 additions and 6 deletions

View file

@ -40,7 +40,7 @@
= t("shared.publisher.click_to_share_with") = t("shared.publisher.click_to_share_with")
- if aspect == :all || aspect == :profile - if aspect == :all || aspect == :profile
= status.hidden_field(:public) = status.hidden_field(:public)
= image_tag "icons/globe.png", :title => t('.public'), :class => 'public_icon dim', :width => 16, :height => 16 = image_tag "icons/globe.png", :title => t('javascripts.publisher.limited'), :class => 'public_icon dim', :width => 16, :height => 16
- if current_user.services - if current_user.services
- for service in current_user.services - for service in current_user.services
= image_tag "social_media_logos/#{service.provider}-16x16.png", :title => service.provider.titleize, :class => "service_icon dim", :id =>"#{service.provider}", :maxchar => "#{service.class::MAX_CHARACTERS}" = image_tag "social_media_logos/#{service.provider}-16x16.png", :title => service.provider.titleize, :class => "service_icon dim", :id =>"#{service.provider}", :maxchar => "#{service.class::MAX_CHARACTERS}"

View file

@ -662,7 +662,6 @@ en:
share_with: "share with" share_with: "share with"
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: "
public: "Public"
click_to_share_with: "Click to share with: " click_to_share_with: "Click to share with: "
discard_post: "Discard post" discard_post: "Discard post"
add_contact: add_contact:

View file

@ -29,6 +29,8 @@ en:
search_for: "Search for {{name}}" search_for: "Search for {{name}}"
publisher: publisher:
at_least_one_aspect: "You must publish to at least one aspect" at_least_one_aspect: "You must publish to at least one aspect"
limited: "Limited - your post will only be seen by people you are sharing with"
public: "Public - your post will be visible to everyone and found by search engines"
infinite_scroll: infinite_scroll:
no_more: "No more posts." no_more: "No more posts."
web_sockets: web_sockets:

View file

@ -289,9 +289,18 @@ var Publisher = {
bindPublicIcon: function(){ bindPublicIcon: function(){
$(".public_icon").bind("click", function(evt){ $(".public_icon").bind("click", function(evt){
$(this).toggleClass("dim"); $(this).toggleClass("dim");
var public_field= $("#publisher #status_message_public"); var public_field = $("#publisher #status_message_public");
(public_field.val() == 'false') ? (public_field.val('true')) : (public_field.val('false')); if (public_field.val() == 'false') {
public_field.val('true');
$(this).attr('title', Diaspora.widgets.i18n.t('publisher.public'));
} else {
public_field.val('false');
$(this).attr('title', Diaspora.widgets.i18n.t('publisher.limited'));
}
$(this).tipsy(true).fixTitle();
$(this).tipsy(true).show();
}); });
}, },
toggleServiceField: function(service){ toggleServiceField: function(service){

View file

@ -110,6 +110,9 @@ describe("Publisher", function() {
describe("bindPublicIcon", function() { describe("bindPublicIcon", function() {
beforeEach( function(){ beforeEach( function(){
spec.loadFixture('aspects_index_services'); spec.loadFixture('aspects_index_services');
Diaspora.widgets.i18n.loadLocale(
{ 'publisher' :
{ 'public' : 'is public', 'limited' : 'is limited' } }, 'en');
}); });
it('gets called on initialize', function(){ it('gets called on initialize', function(){
@ -131,8 +134,13 @@ describe("Publisher", function() {
$(".public_icon").click(); $(".public_icon").click();
expect($('#publisher #status_message_public').val()).toBe('true'); expect($('#publisher #status_message_public').val()).toBe('true');
});
it('toggles the tooltip on the clicked icon', function(){
Publisher.bindPublicIcon();
$(".public_icon").click();
expect($(".public_icon")).toHaveAttr('original-title', 'is public');
$(".public_icon").click();
expect($(".public_icon")).toHaveAttr('original-title', 'is limited');
}); });
}); });
describe("bindServiceIcons", function() { describe("bindServiceIcons", function() {