Content
You are here:
Simple chat plugin
Added by Markus Wende almost 5 years ago
Hello OpenProject Community,
I am a beginner rails developer and I try to develope a simple chat plugin for OpenProject. I used
mickygingers walkthrough and adapted it to run as a plugin.
What I have so far is a simple chat for all users on my OpenProject server. Here are some
pictures of the rendered plugin:
(sorry for mixing languages (english + german) in the pictures)
My question is now.. How do I implement the ckeditor used by OpenProject instead of the simple form text_area.
The index.html.erb of the messages view looks like:
<%= form_for [@conversation, @message] do |f| %>
<div class="custom-form">
<div class="form-group">
<%= f.text_area :body, autofocus: true, placeholder: "Your message", class: "form-control", rows: 5 %>
</div>
<%= f.button t(:send), class: 'button -highlight -with-icon icon-checkmark' %>
</div>
<% end %>
<div id="conversation_messages">
<% @conversation.conversation_messages.reverse_each do |message| %>
<% if message.body %>
<div class="media">
<div class="media-left">
<%= avatar(message.user) %> <strong> <%= message.user.name %> </strong> <%= message.message_time %>
</div>
<div class="media-body">
<p><%= simple_format message.body %></p>
</div>
</div>
<% end %>
<% end %>
</div>
Thx, for the help.
--
Markus
Replies (5)
Hi Markus,
change your text_area as follows to add a class we use for positioning and use the
with_text_formatting
flag<%= f.text_area :body, class: 'wiki-edit', with_text_formatting: true, autofocus: true, placeholder: "Your message", class: "form-control", rows: 5 %>
That should be all!
Best,
Oliver
Hey Oliver,
Thank you for your support. Your hint to use the
with_text_formatting
flag was very good.I had to change some more things to get it up and running. For every one who is interested, here the
new index.html.erb:
I think this topic is now closed. Looks good to me (⌐■_■)
--
Markus
Hello @Markus,
I wonder if you were able to have a working prototype for your plugin?
Will you publish it as open source?
Thank you,
Timotheus
Hello Timotheus,
I had a working prototype. But after the last update its not working
anymore. It is ok for me if you use my code, but I don't publish the
plugin, because I am not working on it anymore and its not ready
to be published.
Markus
Hello Markus,
That would be great if you could send me the code to my email address: timotheus at pokorra.de
I have not worked with ruby before, but I would like to have a go at this challenge.
Thank you,
Timotheus