No commit activity in last 3 years
No release in over 3 years
Chat Panel for Denshobato messaging.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.11
~> 10.0
~> 3.0

Runtime

>= 0
 Project Readme

DenshobatoChatPanel

Gem Version Build Status

DenshobatoChatPanel, is a official addon for Denshobato Gem, it provides simple chat panel for you. If you don't need any special customization for dialog panel, or if you want to try messaging quickly, you can use chat panel.

Denshobato Chat Panel

Installation

Add this line to your application's Gemfile:

gem 'denshobato_chat_panel'

And then execute:

$ bundle

Or install it yourself as:

$ gem install denshobato_chat_panel

Usage

Install Chat

rails g denshobato_chat_panel:install

This command copies assets to vendor/public/assets

#####1. Add method denshobato_chat_panel to your model

class Customer < ActiveRecord::Base
  denshobato_for :customer
  denshobato_chat_panel
end

#####2. Copy this line to your config/initializers/assets.rb

 Rails.application.config.assets.precompile += %w( denshobato.js )

#####3. In your application.scss import css

 @import 'denshobato';

#####4. In layouts/application.erb include javascript file in the bottom

<body>
  <div class='container'>
    <%= render 'layouts/header' %>
    <%= yield %>
  </div>

<%= javascript_include_tag 'denshobato' %>
</body>

#####5. Mount API route in your routes.rb

 mount Denshobato::DenshobatoApi => '/'

#####6. On the page with your conversation, e.g localhost:3000/conversation/32, add this helper with arguments

= render_denshobato_messages(@conversation, current_user)
// =>  When @conversation = Denshobato::Conversation.find(params[:id])
// => and current_user is your signed in user, e.g Devise current_user etc.

A few methods for Chat Panel

You need to set up name and image for chat independently. By default, name show a class name of model, e.g Customer, or User, and a gravatar.

Go to your user model and rewrite these methods.

class User < ActiveRecord::Base
  denshobato_for :user
  denshobato_chat_panel

  def full_name
    "#{first_name}, #{last_name}"
  end

  def image
    avatar.url
  end
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/ID25/denshobato_chat_panel.

License

The gem is available as open source under the terms of the MIT License.

Copyright (c) 2016 Eugene Domosedov (ID25)