Skip to content
Extraits de code Groupes Projets
Valider 2777f16f rédigé par Ilyaaaaaaaaaaaaa Zhitomirskiy's avatar Ilyaaaaaaaaaaaaa Zhitomirskiy
Parcourir les fichiers

Merge branch 'issue1586-aspectdropdown-when-posting'

parents 8b278adf 064ae972
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Affichage de
avec 73 ajouts et 38 suppressions
......@@ -158,7 +158,7 @@ class PeopleController < ApplicationController
def aspect_membership_dropdown
@person = Person.find(params[:person_id])
@contact = current_user.contact_for(@person) || Contact.new
render :partial => 'aspect_memberships/aspect_dropdown', :locals => {:contact => @contact, :person => @person, :hang => 'left'}
render :partial => 'aspect_membership_dropdown', :locals => {:contact => @contact, :person => @person, :hang => 'left'}
end
private
......
......@@ -65,8 +65,17 @@ module AspectGlobalHelper
end
end
def aspect_dropdown_list_item(aspect, contact, person)
checked = (contact.persisted? && contact.in_aspect?(aspect))
def aspect_membership_dropdown(contact, person, hang, aspect=nil)
selected_aspects = all_aspects.select{|aspect| contact.in_aspect?(aspect) }
render "shared/aspect_dropdown",
:selected_aspects => selected_aspects,
:person => person,
:hang => hang,
:dropdown_class => "aspect_membership"
end
def aspect_dropdown_list_item(aspect, checked)
klass = checked ? "selected" : ""
str = <<LISTITEM
......@@ -76,4 +85,8 @@ module AspectGlobalHelper
LISTITEM
str.html_safe
end
def dropdown_may_create_new_aspect
@aspect == :profile || @aspect == :tag || @aspect == :search || @aspect == :notification
end
end
-# Copyright (c) 2011, Diaspora Inc. This file is
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
= aspect_dropdown_list_item(aspect, contact, person)
......@@ -16,7 +16,7 @@
- else
= @aspects.to_sentence
= render 'shared/publisher', :aspect => aspect, :aspect_ids => aspect_ids
= render 'shared/publisher', :selected_aspects => @aspects, :aspect_ids => aspect_ids, :aspect => @aspect
- if posts.length == 0
= render 'aspects/no_posts_message'
......
......@@ -3,7 +3,7 @@
// the COPYRIGHT file.
var dropdown = $("ul.dropdown_list[data-person_id=<%= @person.id %>]")
$('.newItem', dropdown).before("<%= escape_javascript( render('aspect_memberships/aspect_dropdown_list_item', :aspect => @aspect, :person => @person, :contact => @contact)) %>");
$('.newItem', dropdown).before("<%= escape_javascript( aspect_dropdown_list_item(@aspect, @contact.aspects.include?(@aspect))) %>");
ContactEdit.updateNumber(dropdown, "<%= @person.id %>", <%= @contact.aspects.size %>);
$.facebox.close();
......
......@@ -17,4 +17,4 @@
%a.more-link.paginate{:href => next_page_path}
%h2= t("more")
- content_for :subpages do
= render 'shared/publisher', :aspect_ids => @aspect_ids
= render 'shared/publisher', :aspect_ids => @aspect_ids, :selected_aspects => @aspects, :aspect => @aspect
......@@ -23,7 +23,7 @@
= contact.person.diaspora_handle
.right
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => contact.person, :hang => 'right'
= aspect_membership_dropdown(contact, contact.person, 'right')
%br
%div{:style => "text-align:right;"}
......
......@@ -24,7 +24,7 @@
.stream_element{:data=>{:guid => note.id}, :class => "#{note.unread ? 'unread' : ''}"}
- if note.type == "Notifications::StartedSharing" && contact = current_user.contact_for(note[:target])
.right
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => note[:target], :hang => 'left'
= aspect_membership_dropdown(contact, note[:target], 'left')
%span.from
= notification_message_for(note)
......
= aspect_membership_dropdown(@contact, @person, 'left')
- unless person == current_user.person
- contact = current_user.contacts.find_by_person_id(person.id)
- contact ||= Contact.new(:person => person)
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => person, :hang => 'left'
= aspect_membership_dropdown(contact, person, 'left')
-else
= t('people.person.thats_you')
#author_info
.right
- if user_signed_in? && current_user.person != person
= render 'aspect_memberships/aspect_dropdown', :contact => contact, :person => person, :hang => 'left'
= aspect_membership_dropdown(contact, person, 'left')
- elsif user_signed_in? && current_user.person == person
= link_to t('people.profile_sidebar.edit_my_profile'), edit_profile_path, :class => 'button creation'
......
......@@ -4,9 +4,9 @@
- if friend.already_invited?
= link_to t('.resend'), service_inviter_path(:uid => friend.uid, :provider => 'facebook', :invitation_id => friend.invitation_id)
- elsif friend.on_diaspora?
= render 'aspect_memberships/aspect_dropdown', :contact => contact_proxy(friend), :person => friend.person, :hang => 'left'
= render 'shared/aspect_dropdown', :selected_aspects => contact_proxy(friend).aspects, :person => friend.person, :hang => 'left'
- else
= render 'aspect_memberships/aspect_dropdown', :contact => contact_proxy(friend), :person => friend.person, :hang => 'left', :extra_class => 'inviter', :service_uid => friend.uid
= render 'shared/aspect_dropdown', :selected_aspects => contact_proxy(friend).aspects, :person => friend.person, :hang => 'left', :dropdown_class => 'inviter', :service_uid => friend.uid
- if friend.on_diaspora?
= person_image_link(friend.person, :size => :thumb_small)
......
......@@ -2,20 +2,20 @@
-# licensed under the Affero General Public License version 3 or later. See
-# the COPYRIGHT file.
.dropdown{:class => "hang_#{hang} #{extra_class if defined?(extra_class)}"}
.button.toggle{:class => ("in_aspects" if contact.aspects.size > 0)}
- if contact.aspects.size == 1
= contact.aspects.first.name
.dropdown{:class => ["hang_#{hang}", defined?(dropdown_class) && dropdown_class]}
.button.toggle{:class => ("in_aspects" if selected_aspects.size > 0)}
- if selected_aspects.size == 1
= selected_aspects.first.name
- else
= t('.toggle', :count => contact.aspects.size)
= t('.toggle', :count => selected_aspects.size)
&#9660;
.wrapper
%ul.dropdown_list{:unSelectable => 'on', 'data-person_id' => ((person.id) if 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))}
- for aspect in all_aspects
= aspect_dropdown_list_item(aspect, contact, person)
= aspect_dropdown_list_item(aspect, selected_aspects.include?(aspect) )
- if @aspect && (@aspect == :profile || @aspect == :getting_started || @aspect == :tag || @aspect == :search || @aspect == :notification)
- if (dropdown_may_create_new_aspect && defined?(person) && person)
%li.newItem
.add_aspect
= link_to t('contacts.index.add_a_new_aspect'), new_aspect_path(:person_id => person.id), :rel => 'facebox', :class => 'new_aspect'
= link_to t('contacts.index.add_a_new_aspect'), new_aspect_path(:person_id => person.id), :rel => 'facebox'
......@@ -29,12 +29,6 @@
= hidden_field_tag 'aspect_ids[]', aspect_id.to_s
.options_and_submit
- if aspect == :profile
.mention_helper
.badges
%i= t('.publishing_to')
= aspect_badges(aspects_with_person, :link => false)
.public_toggle
%span#publisher_service_icons
= t("shared.publisher.click_to_share_with")
......@@ -45,6 +39,7 @@
- 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}"
= link_to (image_tag "icons/monotone_wrench_settings.png"), "#question_mark_pane", :class => 'question_mark', :rel => 'facebox', :title => t('shared.public_explain.manage')
= render "shared/aspect_dropdown", :selected_aspects => selected_aspects, :hang => 'left'
= status.submit t('.share'), :disable_with => t('.posting'), :class => 'button creation', :tabindex => 2
.facebox_content
......
......@@ -10,7 +10,7 @@
:javascript
Diaspora.widgets.i18n.loadLocale(#{get_javascript_strings_for(current_user.language).to_json}, "#{current_user.language}");
$(document).ready(function()
$(document).ready(function()
{
Publisher.open();
$("#publisher").bind('ajax:success', function(){
......@@ -24,7 +24,7 @@
if ("#{params[:notes]}".length > 0){
contents = contents + " - #{params[:notes]}";
}
$("#publisher #status_message_fake_text").val(contents);
$("#publisher #status_message_text").val(contents);
$('input.button')[0].removeAttribute('disabled');
......@@ -34,5 +34,5 @@
.span-15.last
%h4
=t('bookmarklet.post_something')
= render :partial => 'shared/publisher', :locals => { :aspect => :profile, :aspects_with_person => @aspects, :aspect_ids => @aspect_ids}
= render :partial => 'shared/publisher', :locals => { :aspect => :profile, :selected_aspects => @aspects, :aspect_ids => @aspect_ids }
......@@ -6,7 +6,7 @@
= javascript_include_tag "publisher.js"
:javascript
$(document).ready(function()
$(document).ready(function()
{
var person = {name: '#{@person.name}', handle: '#{@person.diaspora_handle}' };
Publisher.autocompletion.onSelect($("#status_message_fake_text"),person,'#{@person.name}');
......@@ -21,5 +21,5 @@
%h3
= t('.mentioning', :person => @person.name)
= render :partial => 'shared/publisher', :locals => { :aspect => @aspect, :aspect_ids => @aspect_ids, :aspects_with_person => @aspects_with_person, :person => @person}
= render :partial => 'shared/publisher', :locals => { :aspect => @aspect, :aspect_ids => @aspect_ids, :selected_aspects => @aspects_with_person, :person => @person}
......@@ -42,6 +42,7 @@ javascripts:
- public/javascripts/stream.js
- public/javascripts/content-updater.js
- public/javascripts/search.js
- public/javascripts/aspects-dropdown.js
- public/javascripts/contact-edit.js
- public/javascripts/contact-list.js
- public/javascripts/aspect-sorting.js
......
......@@ -180,14 +180,6 @@ en:
success: "Successfully removed person from aspect"
failure: "Failed to remove person from aspect"
no_membership: "Could not find the selected person in that aspect"
aspect_dropdown:
add_to_aspect: "Add to aspect"
toggle:
zero: "Add to aspect"
one: "In %{count} aspect"
few: "In %{count} aspects"
many: "In %{count} aspects"
other: "In %{count} aspects"
bookmarklet:
heading: "Bookmarklet"
......@@ -653,6 +645,14 @@ en:
not_on_diaspora: "Not yet on Diaspora"
shared:
aspect_dropdown:
add_to_aspect: "Add to aspect"
toggle:
zero: "Add to aspect"
one: "In %{count} aspect"
few: "In %{count} aspects"
many: "In %{count} aspects"
other: "In %{count} aspects"
publisher:
posting: "Posting..."
share: "Share"
......
......@@ -154,7 +154,8 @@ Feature: posting
And I click "Mention" button
And I expand the publisher in the modal window
And I append "I am eating a yogurt" to the publisher
And I follow "DidntPostTo" within "#publisher" in the modal window
And I press the aspect dropdown in the modal window
And I toggle the aspect "DidntPostTo" in the modal window
And I press "Share" in the modal window
And I am on the aspects page
And I follow "<aspect>" within "#aspect_nav"
......
......@@ -11,6 +11,15 @@ And /^I expand the publisher$/ do
')
end
When /^I press the aspect dropdown$/ do
find('.dropdown .button').click
end
And /^I toggle the aspect "([^"]*)"$/ do |aspect_name|
aspect = @me.aspects.where(:name => aspect_name).first
find("li[data-aspect_id='#{aspect.id}']").click
end
Then /^the publisher should be collapsed$/ do
find("#publisher")["class"].should include("closed")
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter