On Monday, December 30, 2019 at 4:52:46 PM UTC-5, Sampson Crowley wrote:
>
> there are a massive number of possible reasons. you really should do some 
> research on css display types, as I'm assuming `right` is supposed to be a 
> element with "float: right" but "span" tags don't respond to floats unless 
> they have been set as block-level elements
>
> On Tuesday, December 24, 2019 at 7:07:32 PM UTC-7, fugee ohu wrote:
>>
>> $('#message_holder').append('<div class="container"><span class="right">' 
>> + data.content + '</span><br></div>')
>>
>> The string gets appended to the message_holder div like so:
>>
>> <div class="container"><span class="right">9</span><br></div>
>>
>> but the styling defined in .right doesn't get applied What to do?
>>
>>

view:
<h3>Conversation with <%= @conversation_with.name %></h3>
<%= content_tag :div, id: "message_holder", data: {conversation_with_id: 
@conversation_with.id} do %>

   <% @messages.each do |m| %>
        <% if m.sender==@conversation_with.id %>
            <div class="container-left"><%= m.content %></div>
        <% else %>
            <div class="container-right"><%= m.content %></div>
        <% end %>
    <% end %>

<% end %>

js:

 received(data) {
    
            if 
(data.sender==$('#message_holder').data-conversation_with_id) 
               {
               $('#message_holder').append('<div class="container-left">' + 
data.content +  '</div>');
               }
            else 
               {
               $('#message_holder').append('<div class="container-right">' 
+ data.content + 'converation_with_id:'  +  '</div>');
               }

  }
});

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/2ab75cf8-3ebd-4aa9-9450-83d37d5c27fa%40googlegroups.com.

Reply via email to