From 8fafc48d320f640b645f561c4754c8cfaf6ccbaa Mon Sep 17 00:00:00 2001 From: danielgrippi <daniel@joindiaspora.com> Date: Fri, 4 Mar 2011 18:17:49 -0800 Subject: [PATCH] more private message wip. --- app/controllers/conversations_controller.rb | 3 ++ app/views/conversations/_conversation.haml | 8 +--- app/views/conversations/_show.haml | 26 ++++++------ app/views/conversations/index.haml | 11 ++++-- app/views/conversations/new.haml | 6 +++ public/stylesheets/sass/application.sass | 44 +++++++++++---------- 6 files changed, 56 insertions(+), 42 deletions(-) diff --git a/app/controllers/conversations_controller.rb b/app/controllers/conversations_controller.rb index 3ff512e526..d83b89504d 100644 --- a/app/controllers/conversations_controller.rb +++ b/app/controllers/conversations_controller.rb @@ -4,6 +4,9 @@ class ConversationsController < ApplicationController respond_to :html, :json def index + + @all_contacts_and_ids = current_user.contacts.map{|c| {:id => c.id, :name => c.person.name}} + @conversations = Conversation.joins(:conversation_visibilities).where( :conversation_visibilities => {:person_id => current_user.person.id}).paginate( :page => params[:page], :per_page => 15, :order => 'updated_at DESC') diff --git a/app/views/conversations/_conversation.haml b/app/views/conversations/_conversation.haml index 5e1c450f86..bcf865746d 100644 --- a/app/views/conversations/_conversation.haml +++ b/app/views/conversations/_conversation.haml @@ -3,7 +3,7 @@ -# the COPYRIGHT file. .stream_element.conversation{:data=>{:guid=>conversation.id}} - = person_image_tag(conversation.messages.last.author) + = person_image_tag(authors[conversation.id]) .subject .message_count @@ -14,11 +14,7 @@ .last_author .timestamp = time_ago_in_words conversation.updated_at - = conversation.author.name + = authors[conversation.id].name - if conversation.participants.size > 2 %span.participant_count = "(+#{conversation.participants.size - 1})" - - .message - = "#{conversation.messages.last.text[0..45]}..." - diff --git a/app/views/conversations/_show.haml b/app/views/conversations/_show.haml index b9566615fe..e92f8bf9c5 100644 --- a/app/views/conversations/_show.haml +++ b/app/views/conversations/_show.haml @@ -2,23 +2,25 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. -.conversation_participants.span-16.last - .span-10 - %h3 - = conversation.subject - - .conversation_controls - = link_to (image_tag('reply.png', :height => 14, :width => 14) + ' ' + 'reply'), '#', :id => 'reply_to_conversation' - = link_to (image_tag('deletelabel.png') + ' ' + t('delete').downcase), conversation_conversation_visibility_path(conversation), :method => 'delete', :confirm => t('are_you_sure') - .span-6.avatars.last - - for participant in conversation.participants - = person_image_link(participant) +.span-15.last + .conversation_participants + .span-9 + %h3 + = conversation.subject + + .conversation_controls + = link_to (image_tag('reply.png', :height => 14, :width => 14) + ' ' + 'reply'), '#', :id => 'reply_to_conversation' + = link_to (image_tag('deletelabel.png') + ' ' + t('delete').downcase), conversation_conversation_visibility_path(conversation), :method => 'delete', :confirm => t('are_you_sure') + + .span-6.avatars.last + - for participant in conversation.participants + = person_image_link(participant) %br %br %br -.span-16.last +.span-15.last .stream = render :partial => 'messages/message', :collection => conversation.messages diff --git a/app/views/conversations/index.haml b/app/views/conversations/index.haml index 21c51f3305..2064f25c1d 100644 --- a/app/views/conversations/index.haml +++ b/app/views/conversations/index.haml @@ -12,8 +12,11 @@ :css footer{ display:none;} -.span-5.append-3 - %h3.fixit{:style => 'width:300px;'} + += hidden_field_tag :contact_json, @all_contacts_and_ids.to_json + +.span-5.append-4 + %h3.fixit{:style => 'width:340px;'} .right = link_to 'New Message', new_conversation_path, :class => 'button', :rel => 'facebox' Inbox @@ -24,13 +27,13 @@ #conversation_inbox - if @conversations.count > 0 .stream.conversations - = render :partial => 'conversations/conversation', :collection => @conversations + = render :partial => 'conversations/conversation', :collection => @conversations, :locals => {:authors => @authors} = will_paginate @conversations - else %i You have no messages -#conversation_show.span-16.last +#conversation_show.span-15.last - if @conversation = render 'conversations/show', :conversation => @conversation - else diff --git a/app/views/conversations/new.haml b/app/views/conversations/new.haml index 03542287a7..072e88f34a 100644 --- a/app/views/conversations/new.haml +++ b/app/views/conversations/new.haml @@ -2,6 +2,12 @@ -# licensed under the Affero General Public License version 3 or later. See -# the COPYRIGHT file. +:javascript + $(document).ready(function () { + $("#my-text-input").tokenInput("/url/to/your/script/"); + }); + + #new_message_pane #facebox_header diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 8c3f721bc3..1213d33650 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -52,6 +52,12 @@ form :width 50px :height 50px +#content + :background + :color #fff + :border 1px solid #ccc + :height 100% + #flash_notice, #flash_error, #flash_alert @@ -2271,7 +2277,8 @@ ul.show_comments :position relative :top 10px -#aspect_edit_pane +#aspect_edit_pane, +#new_message_pane :width 400px .person_tiles .tile @@ -2295,6 +2302,10 @@ ul.show_comments &.larger :width 600px +#new_message_pane + input + :width 90% + #facebox_header :padding 1em :background @@ -2484,7 +2495,7 @@ ul.show_comments .stream_element .subject :font - :size 14px + :size 13px :weight bold :color #444 :overflow hidden @@ -2493,12 +2504,8 @@ ul.show_comments .last_author :font :size 12px - :weight bold :color #777 - .message - :font - :size 12px .conversation_participants :z-index 3 @@ -2532,8 +2539,7 @@ ul.show_comments :border :bottom 1px solid #666 - :padding 5px - :left 10px + :padding 0 :top 90px :margin :top -100px @@ -2541,6 +2547,8 @@ ul.show_comments .avatars :text :align right + :margin + :top 9px .stream_element.new_message :border @@ -2557,10 +2565,11 @@ ul.show_comments :right -11px .stream_element.conversation - :padding 5px + :padding 10px + :min-height 0px .message_count - :right 6px + :right 10px :background :color #999 :color #eee @@ -2570,6 +2579,8 @@ ul.show_comments :size 12px :weight normal :-webkit-border-radius 3px + :-moz-border-radius 3px + :border-radius 3px .participant_count :font @@ -2577,7 +2588,7 @@ ul.show_comments .timestamp :position absolute - :right 6px + :right 10px :font :weight normal :color $blue @@ -2587,11 +2598,7 @@ ul.show_comments :width 35px :height 35px :margin - :right 5px - - .message - :padding - :left 40px + :right 10px &:hover:not(.selected) :background @@ -2606,8 +2613,6 @@ ul.show_comments :color #fff .last_author :color #fff - .message - :color #eee .timestamp :color #eee :border @@ -2621,11 +2626,10 @@ ul.show_comments :overflow-x none :background :color #f8f8f8 - :width 300px + :width 358px :border :right 2px solid #999 - :left 2px solid #eee .fixit :position fixed -- GitLab