Permalink
Browse files

added attachment support

  • Loading branch information...
1 parent eba1e41 commit 69d7283d0ead1808d39f2ecc3f128b70d10908a5 @jdxcode jdxcode committed Dec 5, 2011
View
@@ -3,5 +3,6 @@ log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
+test/dummy/public/uploads
test/dummy/tmp/
.sass-cache
View
@@ -5,7 +5,8 @@ gemspec
gem 'haml'
gem 'devise'
gem 'simple_form'
-gem 'mailboxer'
+gem 'mailboxer', git: 'git://github.com/dickeytk/mailboxer'
+gem 'carrierwave'
gem "jquery-rails"
gem 'coffee-rails'
gem 'sass-rails'
View
@@ -1,3 +1,12 @@
+GIT
+ remote: git://github.com/dickeytk/mailboxer
+ revision: 18b7aad4ac06265c952a30f212db6ead1c8cc94a
+ specs:
+ mailboxer (0.5.4)
+ carrierwave (>= 0.5.8)
+ foreigner (>= 0.9.1)
+ rails (>= 3.1.0)
+
PATH
remote: .
specs:
@@ -38,6 +47,8 @@ GEM
arel (2.2.1)
bcrypt-ruby (3.0.1)
builder (3.0.0)
+ carrierwave (0.5.8)
+ activesupport (~> 3.0)
coffee-rails (3.1.1)
coffee-script (>= 2.2.0)
railties (~> 3.1.0)
@@ -65,9 +76,6 @@ GEM
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- mailboxer (0.5.4)
- foreigner (>= 0.9.1)
- rails (>= 3.1.0)
mime-types (1.17.2)
multi_json (1.0.4)
orm_adapter (0.0.5)
@@ -112,7 +120,7 @@ GEM
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- sqlite3 (1.3.4)
+ sqlite3 (1.3.5)
thor (0.14.6)
tilt (1.3.3)
treetop (1.4.10)
@@ -126,11 +134,12 @@ PLATFORMS
ruby
DEPENDENCIES
+ carrierwave
coffee-rails
devise
haml
jquery-rails
- mailboxer
+ mailboxer!
messaging!
sass-rails
simple_form
View
@@ -7,4 +7,31 @@ 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, see https://github.com/frodefi/refinerycms-messaging.
+
+Running the demo app
+====================
+
+To run the demo app, first clone the repo
+
+````
+$ git clone git@github.com:frodefi/rails-messaging.git
+````
+
+Install gems from project root
+
+````
+bundle
+````
+
+From the dummy app (./test/dummy), create the database
+
+````
+$ rake db:migrate
+````
+
+Start the server!
+
+````
+$ rails server
+````
View
@@ -1,3 +0,0 @@
-= Messaging
-
-This project rocks and uses MIT-LICENSE.
@@ -45,14 +45,14 @@ header
box-shadow: 0 0 7px black
nav
+ margin: 9px 0
> a
display: block
- margin: 9px 0 10px 0
+ margin: 1px 0
text-align: left
padding: 10px
vertical-align: middle
display: block
- padding: 10px
font-weight: bold
&:hover
background-color: #eee
@@ -188,6 +188,10 @@ textarea
clear: both
padding: 20px 0
line-height: 1.4
+ .attachment
+ margin: 10px 0
+ .attachment:before
+ content: 'Attachment: '
#compose
margin: 55px 0
@@ -20,12 +20,12 @@ def create
flash[:alert] = "You do not have permission to view that conversation."
return redirect_to root_path
end
- receipt = current_user.reply_to_conversation(@conversation, @message.body)
+ receipt = current_user.reply_to_conversation(@conversation, @message.body, nil, true, true, @message.attachment)
else
unless @message.valid?
return render :new
end
- receipt = current_user.send_message(@message.recipients, @message.body, @message.subject)
+ receipt = current_user.send_message(@message.recipients, @message.body, @message.subject, true, @message.attachment)
end
flash[:notice] = "Message sent."
@@ -4,7 +4,7 @@ class Message
include ActiveModel::Conversion
extend ActiveModel::Naming
- attr_accessor :recipients, :subject, :body, :conversation_id
+ attr_accessor :recipients, :subject, :body, :conversation_id, :attachment
validates :recipients, presence: true
validates :subject, presence: true
@@ -7,4 +7,5 @@
= f.input_field :subject
= f.label :body, required: false
= f.input_field :body, as: :text
+ = f.input :attachment, as: :file
= f.button :submit, 'Send message'
@@ -11,9 +11,13 @@
.from= message.sender
.date #{message.created_at.to_s(:long)} (#{time_ago_in_words(message.created_at)} ago)
.body= message.body
+ - if message.attachment.url
+ .attachment
+ = link_to message.attachment_identifier, message.attachment.url
#reply
= simple_form_for @message do |f|
= f.input :conversation_id, as: :hidden
= f.label :body, label: 'Reply', required: false
= f.input_field :body, as: :text, label: 'Reply'
+ = f.input :attachment, as: :file
= f.button :submit, 'Reply to conversation'
@@ -0,0 +1,5 @@
+class AddAttachments < ActiveRecord::Migration
+ def change
+ add_column :notifications, :attachment, :string
+ end
+end
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20111204042611) do
+ActiveRecord::Schema.define(:version => 20111205020919) do
create_table "conversations", :force => true do |t|
t.string "subject", :default => ""
@@ -32,6 +32,7 @@
t.integer "notified_object_id"
t.string "notified_object_type"
t.string "notification_code"
+ t.string "attachment"
end
add_index "notifications", ["conversation_id"], :name => "index_notifications_on_conversation_id"

0 comments on commit 69d7283

Please sign in to comment.