Ruby on Rails Tuesday, January 21, 2020



On Sunday, January 19, 2020 at 4:56:19 PM UTC-5, Walter Lee Davis wrote:


> On Jan 19, 2020, at 4:10 PM, fugee ohu <fuge...@gmail.com> wrote:
>
> Got my chat app working in rails 6 with channels but now how do I let users send  pictures in channels? I've seen chat apps where after you upload the picture it displays with a circled button that says send and you can also delete it instead How do I do that?
>

With JavaScript. One of the neatest implementations I've seen of this is in Trix (ActionText), which is open-source, so you could see how they do it there. Also GitLab has a nice one, and the source is available for that (unlike GitHub, who also have one). You're basically intercepting the drop and paste events, checking to see whether the payload was an image, and then doing some out-of-band trickery to make a file attachment using a separate model and controller. Trix uses the new ActiveStorage goodies for its implementation. Not sure what the others use.

Walter


Yes thanks I went with trix on this The problem I'm having now is ActionCable.server.broadcast unexpectedly sends a truncated version of the value of the rich text field over to my channel Maybe something in ActionCable config?

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9a98d700-342a-416a-9ccc-ed8574365b30%40googlegroups.com.

Ruby on Rails Monday, January 20, 2020

Hello,

This is Aamil with Collabera. I just picked up a Sr. Software engineer role with my client who is the largest and fastest-growing player in the luxury items sales online, providing with millions of shoppers and consignors, three retail stores in NYC & LA and 9 Luxury Consignment Offices across the country. 

This role can be remote. 

Have a look and pass it on to someone who might be looking, if you are not open to the job market right now. I also pay some good $$$ for successful referrals.  

DUTIES & RESPONSIBILITIES

  • Produce high quality, performant, testable code
  • Design and build software for automating critical operation processes
  • Review pull requests and provide constructive feedback
  • Pair up with someone to work together on a feature
  • Learn something new, and mentor junior engineers
  • Deploy to production multiple times
  • Help define technical strategy and architecture
REQUIREMENTS

  • 5+ years of professional web application development experience
  • Fluency with any of Ruby, Elixir, Erlang
  • Strong understanding of web technologies: HTML5, Javascript, CSS/SASS, REST, JSON
  • Strong understanding of web-app performance fundamentals and related dev tools
  • Strong database fundamentals and experience with MySql or Postgresql
  • Worked with search engines such as ElasticSearch, Lucene, Solr
  • Experience using async message queues
  • Mastery of git and Github workflows
  • Bachelor of Computer Science degree or equivalent
NICE TO HAVE

  • Experience with Elixir, Phoenix
  • Advanced CS degree or equivalent

Best,
Aamil Saiyed
Senior Recruiter Direct Hire

T: (470) 447-2384   
Calendar ðŸ“…https://calendly.com/aamilsaiyed

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/14d99313-542b-4feb-836c-be19a731091e%40googlegroups.com.

Ruby on Rails

My app was working before I tried adding images in the richtext field Now the form field doesn't clear on submit and everything appends to the element I'm appending to from my javascript channel file (room.js) wrapped in <div class="trix-content"> So the problem is it doesn't display until the page is refreshed then they're displayed from the database and the form field doesn't clear

$('#message_holder').append('<div class="container-right"><div class="subscript">' + data.sender_name + '<br>' + data.msg_time + '</div>' + data.content.body  + '</div>');

Here it is in page source appended to the bottom of <div id="message_holder">

<div class="container-right">  				<div class="subscript">fugee<br>Mon, 20 Jan 2020 20:13:46 +0000</div>  				<div class="trix-content">    <div>hey<action-text-attachment sgid="BAh7CEkiCGdpZAY6BkVUSSI4Z2lkOi8vaWduYXR6bW91c2UvQWN0aXZlU3RvcmFnZTo6QmxvYi8xMj9leHBpcmVzX2luBjsAVEkiDHB1cnBvc2UGOwBUSSIPYXR0YWNoYWJsZQY7AFRJIg9leHBpcmVzX2F0BjsAVDA=--931b645abd976e02a37e809257c4837f7c4fda64" content-type="image/jpeg" url="http://localhost:3000/rails/active_storage/blobs/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bffdde6476172b543d8e5dd879a742b559406b74/Katana2.jpg" filename="Katana2.jpg" filesize="26982" width="410" height="512" previewable="true" presentation="gallery"><figure class="attachment attachment--preview attachment--jpg">      <img src="http://localhost:3000/rails/active_storage/representations/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBFUT09IiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--bffdde6476172b543d8e5dd879a742b559406b74/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCam9VY21WemFYcGxYM1J2WDJ4cGJXbDBXd2RwQWdBRWFRSUFBdz09IiwiZXhwIjpudWxsLCJwdXIiOiJ2YXJpYXRpb24ifX0=--69a726fe314cc814b26ade236a1f8e8b78481edd/Katana2.jpg">      <figcaption class="attachment__caption">        <span class="attachment__name">Katana2.jpg</span>        <span class="attachment__size">26.3 KB</span>    </figcaption>  </figure></action-text-attachment>  </div>  </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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/224b03d3-2851-41d4-9b42-0880875691bd%40googlegroups.com.