Giter Site home page Giter Site logo

inboxes's Introduction

PLEASE NOTE, THIS PROJECT IS NO LONGER BEING MAINTAINED

Inboxes

Build Status

Inboxes is a young messaging system for Rails app. It:

  • provides 3 models for developers: Discussion, Message and Speaker
  • read/unread discussions counter
  • any user can be invited to discussion by the member of this discussion, so you can chat with unlimited number of users
  • have configurable behavior via CanCan Ability
Sponsored by Evrone

Getting Started

Prerequisites

Inboxes requires Rails 3.x and Devise for user identification (surely, messaging system is not possible without users). We recommend to use Inboxes with Faye, because it's really sexy with it.

Remember that unfortunately, Inboxes reserve 3 resources names: Discussion, Message and Speaker.

Since version 0.2.0, it is possible to add has_inboxes option to any model. For instance, it can be Person or Teacher.

Installation

Make sure that Devise and CanCan are already installed and configured in your app!

  1. Add gem "inboxes", "~> 0.2.0" to the Gemfile and run bundle install
  2. Execute rails generate inboxes:install. This command will generate migration for messaging system. Don't forget to run migrations: rake db:migrate
  3. Add has_inboxes to your User model like here.
  4. Add CanCan abilities to manage Inboxes models:
can [:index, :create], Discussion
can :read, Discussion do |discussion|
  discussion.can_participate?(user)
end
  1. Now Inboxes are ready to use. Open http://yoursite.dev/discussions to see the list of discussions. You can start new one.

Default Inboxes views are ugly, so you can copy into your app and make anything with them: rails generate inboxes:views If you have problems with installation, you can check code of demo app

Usage

I18n

By default, the gem provides localized phrases for Russian and English languages. You can easily override any of them. Here is list of all I18n phrases.

Integration with Faye

You can watch the demo of integration on YouTube

  1. Add gem "faye" to your Gemfile and run bundle install. Install Faye by the screencast

  2. Create messaging.js in app/assets/javascripts/ with this line: //= require inboxes/faye

  3. Copy or replace 2 views from Inboxes example app to your application: app/views/inboxes/messages/_form and app/views/inboxes/messages/create

  4. Add config parameters to your application config (last 2 are not necessary):

config.inboxes.faye_enabled = true
config.inboxes.faye_host = "inboxes-app.dev" # localhost by default
config.inboxes.faye_port = 9292 # 9292 by default
  1. Faye installation is finished. If you have any troubles, check the example app

While running Inboxes with Faye, don't forget to run Faye worker it: rackup faye.ru -s thin -E production You can read more about that on it's official page.

Hints

  1. If you want to add breadcrumbs to Inboxes pages, we recommend you to use crummy gem. It allows to define breadcrumbs in views.
  2. Add Pusher capability
  3. Email notifications and the ability to answer received emails like in Github issues (#7)

Running the tests

Finalize RSpec tests (are located in rspec branch)

Contributing

Please read Code of Conduct and Contributing Guidelines for submitting pull requests to us.

Changelog

The changelog is here.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License.

inboxes's People

Contributors

alec-c4 avatar ashalaev avatar bryant1410 avatar divineforest avatar dkoropenko avatar dmitriy-kiriyenko avatar dom1nga avatar finist avatar kirs avatar liothen avatar ognevsky avatar pronix avatar rspiridonov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

inboxes's Issues

message apears twice with faye

Hello everyone
i have a strange behavour - when i send a message it apears twice on page (but in database it's writen only once as normal). seems JS script with eval(data) runs twice. Why this might happen?

i've changed init.js.cofee to make sure

$ ->
  fayeUrl = window.location.protocol + "//" + window.location.hostname + ":9292/faye" # change port for post of your Faye daemon
  fayeJS = fayeUrl + ".js"
  $.getScript(fayeJS, (e)->
    faye = new Faye.Client(fayeUrl)
    faye.subscribe(window.location.pathname, (data)->
      console.log(data)
    )
  )

and in console i see:

$("#messages_box").append("<div class=\'message\'>\n  <p>\n    <span>\n      [email protected]\n      @\n      Пн, 03 дек. 2012, 05:08:28 +0000\n      :\n    <\/span>\n    <b>666<\/b>\n  <\/p>\n<\/div>\n");
    $("#new_message")[0].reset();
 init.js:11
    $("#messages_box").append("<div class=\'message\'>\n  <p>\n    <span>\n      [email protected]\n      @\n      Пн, 03 дек. 2012, 05:08:28 +0000\n      :\n    <\/span>\n    <b>666<\/b>\n  <\/p>\n<\/div>\n");
    $("#new_message")[0].reset();

my faye.ru has content:

require 'faye'
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
Faye::WebSocket.load_adapter('thin')
run faye_server

Could you give me some idea why this does happen?

Migration generator bug

file:
lib/generators/inboxes/templates/install.rb
t.references :discussable
should be
t.references :discussable, :polymorphic => true

Ability to reply to the message via email

I've seen this feature here on Github. If I get direct message or a new message in the issue discussion, I can just reply to email (which is sent from a special address, like [email protected]) instead of going to my inbox and manually replaying.

It's super useful, especially when there is only my iPhone next to me at the moment.

What do you think about implementing it and then having an option on Inboxes initializer to enable such a cool feature?

0 messages

Can I ask why in method unread_messages_count_for you compare user_id with speaker.id and not speaker.user_id?

def unread_messages_count_for(user)
    speaker = find_speaker_by_user(user)
    messages.where("updated_at > ?", speaker.updated_at ).where("user_id != ?", speaker.id ).count
  end

I use inboxes in different user intefaces(admin and customer) and in case when admin send message to customer it method always return 0

read-unread

Please add additional property is_read to message. This property should be changed from false (default) to true on message load.

Create Message click, ubuntu 11.10, ruby 1.9.3p125

Showing /home/slavik/ror/inboxes-app/app/views/inboxes/messages/create.js.erb where line #1 raised:

getaddrinfo: Name or service not known
Extracted source (around line #1):

1: <% inboxes_faye_broadcast "/discussions/#{@message.discussion.id}" do %>
2: $("#messages_box").append("<%= escape_javascript render(@message) %>");
3: $("#new_message")[0].reset();
4: <% end %>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.