Top Menu

Jump to content
Home
    Modules
      • Projects
      • Activity
      • Work packages
      • Gantt charts
      • Calendars
      • Team planners
      • Boards
      • News
    • Getting started
    • Introduction video
      Welcome to OpenProject Community
      Get a quick overview of project management and team collaboration with OpenProject. You can restart this video from the help menu.

    • Help and support
    • Upgrade to Enterprise edition
    • User guides
    • Videos
    • Shortcuts
    • Community forum
    • Enterprise support

    • Additional resources
    • Data privacy and security policy
    • Digital accessibility (DE)
    • OpenProject website
    • Security alerts / Newsletter
    • OpenProject blog
    • Release notes
    • Report a bug
    • Development roadmap
    • Add and edit translations
    • API documentation
  • Sign in
      Forgot your password?

      or sign in with your existing account

      Google

Side Menu

  • Overview
  • Activity
    Activity
  • Roadmap
  • Work packages
    Work packages
  • Gantt charts
    Gantt charts
  • Calendars
    Calendars
  • Team planners
    Team planners
  • Boards
    Boards
  • News
  • Forums

Content

Development
  1. OpenProject
  2. Forums
  3. Development
  4. Simple chat plugin

Simple chat plugin

Added by Markus Wende over 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)

RE: Simple chat plugin - Added by Oliver Günther over 5 years ago

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

RE: Simple chat plugin - Added by Markus Wende over 5 years ago

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:

<%= labelled_tabular_form_for [@conversation, @message] do |f|%>
  <div class="custom-form">
    <%= f.text_area :body,
                    :cols => 80,
                    :rows => 5,
                    label: "&#8203;".html_safe,
                    container_class: '-xxwide',
                    with_text_formatting: true %>
  </div>
  <%= f.button t(:send), class: 'button -highlight -with-icon icon-checkmark' %>
  <hr class="form-separator">
<% end %>



<div id="conversation_messages">
  <% @conversation.conversation_messages.last(11).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><%= format_text message.body %></p>
        </div>
      </div>
    <% end %>
  <% end %>
</div>

I think this topic is now closed. Looks good to me (⌐■_■)

--

Markus

RE: Simple chat plugin - Added by Timotheus Pokorra over 4 years ago

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

RE: Simple chat plugin - Added by Markus Wende over 4 years ago

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

RE: Simple chat plugin - Added by Timotheus Pokorra over 4 years ago

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

  • (1 - 5/5)
Loading...