Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix bug and change readme file

  • Loading branch information...
commit 3c87b8207034540a4de31d950c0455eb549727d9 1 parent fcbeae1
@yencn02 yencn02 authored
View
80 README.md
@@ -7,7 +7,7 @@ Overview of features:
- Compose new message with: multiple receivers, multiple attachments. If this is a reply, quote the replied message.
- Message view (1 message only, no threading gmail style), options to download attachment and delete the message.
-This Messaging System also exists as a Refinery CMS engine, see https://github.com/frodefi/refinerycms-messaging.
+This Messaging System also exists as a Refinery CMS engine
Installing the gem
==================
@@ -23,6 +23,7 @@ gem 'mailboxer', git: 'git://github.com/dickeytk/mailboxer.git'
Install messaging
````
+$ bundle install
$ rails generate messaging:install
````
@@ -41,7 +42,82 @@ Set the default host and set a root route (required for Devise)
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
````
-These steps will work for RefineryCMS 2.0 or for standard Rails applications.
+These steps will work for standard Rails applications.
+
+Make the rails-messaging work for RefineryCMS 2.0
+===============
+
+Remove this line from /config/routes.rb
+
+````ruby
+devise_for :messaging_users
+````
+
+Replace content of /app/models/messaging_user.rb as below
+
+````ruby
+class MessagingUser < Refinery::User
+
+end
+````
+
+Create /app/decorators/models/messaging/message_decorator.rb and insert the below content
+
+````ruby
+Messaging::Message.class_eval do
+
+ def recipients=(string='')
+ @recipient_list = []
+ string.split(',').each do |s|
+ unless s.blank?
+ recipient = Refinery::User.find_by_email(s.strip)
+ @recipient_list << recipient if recipient
+ end
+ end
+ end
+
+end
+````
+
+Create /app/decorators/models/refinery/user_decorator.rb and insert the below content
+
+````ruby
+Refinery::User.class_eval do
+ include Mailboxer::Models::Messageable
+ acts_as_messageable
+
+ def name
+ self.to_s
+ end
+
+ def mailboxer_email(message)
+ email
+ end
+
+ def to_s
+ email
+ end
+end
+````
+
+Create /app/decorators/controllers/messaging/application_controller_decorator.rb and insert the below content
+
+````ruby
+Messaging::ApplicationController.class_eval do
+ skip_filter :authenticate_messaging_user!
+ before_filter :login_required
+ helper_method :current_messaging_user
+
+ protected
+ def login_required
+ redirect_to main_app.new_refinery_user_session_path unless current_refinery_user
+ end
+
+ def current_messaging_user
+ current_refinery_user
+ end
+end
+````
Enabling Search
===============
View
2  lib/generators/messaging/devise/templates/messaging_user.rb.erb
@@ -6,7 +6,7 @@ class MessagingUser < ActiveRecord::Base
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
-
+ include Mailboxer::Models::Messageable
acts_as_messageable
def name
Please sign in to comment.
Something went wrong with that request. Please try again.