Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

denshobato_chat_panel

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

denshobato_chat_panel

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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)

FAQs

Package last updated on 13 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc