messaging_4 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +39 -0
  4. data/app/assets/javascripts/messaging/adapt.js +135 -0
  5. data/app/assets/javascripts/messaging/application.js +10 -0
  6. data/app/assets/javascripts/messaging/messages.coffee +33 -0
  7. data/app/assets/stylesheets/messaging/1200.css +357 -0
  8. data/app/assets/stylesheets/messaging/1560.css +357 -0
  9. data/app/assets/stylesheets/messaging/1920.css +358 -0
  10. data/app/assets/stylesheets/messaging/2520.css +359 -0
  11. data/app/assets/stylesheets/messaging/720.css +357 -0
  12. data/app/assets/stylesheets/messaging/960.css +357 -0
  13. data/app/assets/stylesheets/messaging/application.css +8 -0
  14. data/app/assets/stylesheets/messaging/messages.sass +225 -0
  15. data/app/assets/stylesheets/messaging/mobile.css +26 -0
  16. data/app/assets/stylesheets/messaging/reset.css +48 -0
  17. data/app/controllers/messaging/application_controller.rb +9 -0
  18. data/app/controllers/messaging/messages_controller.rb +71 -0
  19. data/app/helpers/messaging/application_helper.rb +4 -0
  20. data/app/models/messaging/message.rb +35 -0
  21. data/app/views/layouts/messaging/application.html.haml +62 -0
  22. data/app/views/messaging/messages/index.html.haml +28 -0
  23. data/app/views/messaging/messages/new.html.haml +11 -0
  24. data/app/views/messaging/messages/show.html.haml +23 -0
  25. data/config/routes.rb +13 -0
  26. data/lib/generators/messaging/devise/devise_generator.rb +34 -0
  27. data/lib/generators/messaging/devise/templates/messaging_user.rb.erb +23 -0
  28. data/lib/generators/messaging/install/install_generator.rb +12 -0
  29. data/lib/messaging.rb +9 -0
  30. data/lib/messaging/engine.rb +5 -0
  31. data/lib/messaging/version.rb +3 -0
  32. data/lib/tasks/messaging_tasks.rake +4 -0
  33. data/test/dummy/Rakefile +7 -0
  34. data/test/dummy/app/assets/javascripts/application.js +9 -0
  35. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  36. data/test/dummy/app/controllers/application_controller.rb +3 -0
  37. data/test/dummy/app/controllers/home_controller.rb +9 -0
  38. data/test/dummy/app/helpers/application_helper.rb +2 -0
  39. data/test/dummy/app/models/messaging_user.rb +23 -0
  40. data/test/dummy/app/models/user.rb +23 -0
  41. data/test/dummy/app/views/layouts/application.html.haml +11 -0
  42. data/test/dummy/config.ru +4 -0
  43. data/test/dummy/config/application.rb +45 -0
  44. data/test/dummy/config/boot.rb +10 -0
  45. data/test/dummy/config/database.yml +25 -0
  46. data/test/dummy/config/environment.rb +5 -0
  47. data/test/dummy/config/environments/development.rb +32 -0
  48. data/test/dummy/config/environments/production.rb +60 -0
  49. data/test/dummy/config/environments/test.rb +39 -0
  50. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  51. data/test/dummy/config/initializers/devise.rb +209 -0
  52. data/test/dummy/config/initializers/inflections.rb +10 -0
  53. data/test/dummy/config/initializers/mailboxer.rb +12 -0
  54. data/test/dummy/config/initializers/mime_types.rb +5 -0
  55. data/test/dummy/config/initializers/secret_token.rb +7 -0
  56. data/test/dummy/config/initializers/session_store.rb +8 -0
  57. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  58. data/test/dummy/config/locales/devise.en.yml +58 -0
  59. data/test/dummy/config/locales/en.yml +5 -0
  60. data/test/dummy/config/routes.rb +10 -0
  61. data/test/dummy/db/migrate/20111204041734_devise_create_users.rb +25 -0
  62. data/test/dummy/db/migrate/20111204042609_create_mailboxer.rb +61 -0
  63. data/test/dummy/db/migrate/20111204042610_add_notified_object.rb +17 -0
  64. data/test/dummy/db/migrate/20111204042611_add_notification_code.rb +13 -0
  65. data/test/dummy/db/migrate/20111205020919_add_attachments.rb +5 -0
  66. data/test/dummy/db/migrate/20111213052240_devise_create_messaging_users.rb +25 -0
  67. data/test/dummy/db/schema.rb +99 -0
  68. data/test/dummy/public/404.html +26 -0
  69. data/test/dummy/public/422.html +26 -0
  70. data/test/dummy/public/500.html +26 -0
  71. data/test/dummy/public/favicon.ico +0 -0
  72. data/test/dummy/script/rails +6 -0
  73. data/test/dummy/test/fixtures/messaging_users.yml +11 -0
  74. data/test/dummy/test/fixtures/users.yml +11 -0
  75. data/test/dummy/test/unit/messaging_user_test.rb +7 -0
  76. data/test/dummy/test/unit/user_test.rb +7 -0
  77. data/test/integration/navigation_test.rb +10 -0
  78. data/test/messaging_test.rb +7 -0
  79. data/test/test_helper.rb +10 -0
  80. metadata +281 -0
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,12 @@
1
+ Mailboxer.setup do |config|
2
+
3
+ #Configures if you applications uses or no the email sending for Notifications and Messages
4
+ config.uses_emails = true
5
+
6
+ #Configures the default from for the email sent for Messages and Notifications of Mailboxer
7
+ config.default_from = "no-reply@mailboxer.com"
8
+
9
+ #Configures the methods needed by mailboxer
10
+ #config.email_method = :mailboxer_email
11
+ #config.name_method = :name
12
+ end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ Dummy::Application.config.secret_token = 'f4d71fce2fcb8506fd567764a5582f2ddf94500b95e093ea8502b814ba3ff15f8f99bcdb265eb4760d175074fea4b95a0d4f2dad8a6acd57b72726812d2e71ad'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # Disable root element in JSON by default.
12
+ ActiveSupport.on_load(:active_record) do
13
+ self.include_root_in_json = false
14
+ end
@@ -0,0 +1,58 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ errors:
5
+ messages:
6
+ expired: "has expired, please request a new one"
7
+ not_found: "not found"
8
+ already_confirmed: "was already confirmed, please try signing in"
9
+ not_locked: "was not locked"
10
+ not_saved:
11
+ one: "1 error prohibited this %{resource} from being saved:"
12
+ other: "%{count} errors prohibited this %{resource} from being saved:"
13
+
14
+ devise:
15
+ failure:
16
+ already_authenticated: 'You are already signed in.'
17
+ unauthenticated: 'You need to sign in or sign up before continuing.'
18
+ unconfirmed: 'You have to confirm your account before continuing.'
19
+ locked: 'Your account is locked.'
20
+ invalid: 'Invalid email or password.'
21
+ invalid_token: 'Invalid authentication token.'
22
+ timeout: 'Your session expired, please sign in again to continue.'
23
+ inactive: 'Your account was not activated yet.'
24
+ sessions:
25
+ signed_in: 'Signed in successfully.'
26
+ signed_out: 'Signed out successfully.'
27
+ passwords:
28
+ send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
+ updated: 'Your password was changed successfully. You are now signed in.'
30
+ updated_not_active: 'Your password was changed successfully.'
31
+ send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
32
+ confirmations:
33
+ send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34
+ send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
35
+ confirmed: 'Your account was successfully confirmed. You are now signed in.'
36
+ registrations:
37
+ signed_up: 'Welcome! You have signed up successfully.'
38
+ inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
39
+ updated: 'You updated your account successfully.'
40
+ destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
41
+ reasons:
42
+ inactive: 'inactive'
43
+ unconfirmed: 'unconfirmed'
44
+ locked: 'locked'
45
+ unlocks:
46
+ send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
47
+ unlocked: 'Your account was successfully unlocked. You are now signed in.'
48
+ send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
49
+ omniauth_callbacks:
50
+ success: 'Successfully authorized from %{kind} account.'
51
+ failure: 'Could not authorize you from %{kind} because "%{reason}".'
52
+ mailer:
53
+ confirmation_instructions:
54
+ subject: 'Confirmation instructions'
55
+ reset_password_instructions:
56
+ subject: 'Reset password instructions'
57
+ unlock_instructions:
58
+ subject: 'Unlock Instructions'
@@ -0,0 +1,5 @@
1
+ # Sample localization file for English. Add more files in this directory for other locales.
2
+ # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
+
4
+ en:
5
+ hello: "Hello world"
@@ -0,0 +1,10 @@
1
+ Rails.application.routes.draw do
2
+
3
+ devise_for :messaging_users
4
+
5
+ devise_for :users
6
+
7
+ mount Messaging::Engine => "/messaging"
8
+
9
+ root to: 'home#index'
10
+ end
@@ -0,0 +1,25 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ t.database_authenticatable :null => false
5
+ t.recoverable
6
+ t.rememberable
7
+ t.trackable
8
+
9
+ # t.encryptable
10
+ # t.confirmable
11
+ # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
12
+ # t.token_authenticatable
13
+
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ add_index :users, :email, :unique => true
19
+ add_index :users, :reset_password_token, :unique => true
20
+ # add_index :users, :confirmation_token, :unique => true
21
+ # add_index :users, :unlock_token, :unique => true
22
+ # add_index :users, :authentication_token, :unique => true
23
+ end
24
+
25
+ end
@@ -0,0 +1,61 @@
1
+ class CreateMailboxer < ActiveRecord::Migration
2
+ def self.up
3
+ #Tables
4
+ #Conversations
5
+ create_table :conversations do |t|
6
+ t.column :subject, :string, :default => ""
7
+ t.column :created_at, :datetime, :null => false
8
+ t.column :updated_at, :datetime, :null => false
9
+ end
10
+ #Receipts
11
+ create_table :receipts do |t|
12
+ t.references :receiver, :polymorphic => true
13
+ t.column :notification_id, :integer, :null => false
14
+ t.column :read, :boolean, :default => false
15
+ t.column :trashed, :boolean, :default => false
16
+ t.column :deleted, :boolean, :default => false
17
+ t.column :mailbox_type, :string, :limit => 25
18
+ t.column :created_at, :datetime, :null => false
19
+ t.column :updated_at, :datetime, :null => false
20
+ end
21
+ #Notifications and Messages
22
+ create_table :notifications do |t|
23
+ t.column :type, :string
24
+ t.column :body, :text
25
+ t.column :subject, :string, :default => ""
26
+ t.references :sender, :polymorphic => true
27
+ t.references :object, :polymorphic => true
28
+ t.column :conversation_id, :integer
29
+ t.column :draft, :boolean, :default => false
30
+ t.column :updated_at, :datetime, :null => false
31
+ t.column :created_at, :datetime, :null => false
32
+ end
33
+
34
+
35
+ #Indexes
36
+ #Conversations
37
+ #Receipts
38
+ add_index "receipts","notification_id"
39
+
40
+ #Messages
41
+ add_index "notifications","conversation_id"
42
+
43
+ #Foreign keys
44
+ #Conversations
45
+ #Receipts
46
+ add_foreign_key "receipts", "notifications", :name => "receipts_on_notification_id"
47
+ #Messages
48
+ add_foreign_key "notifications", "conversations", :name => "notifications_on_conversation_id"
49
+ end
50
+
51
+ def self.down
52
+ #Tables
53
+ remove_foreign_key "receipts", :name => "receipts_on_notification_id"
54
+ remove_foreign_key "notifications", :name => "notifications_on_conversation_id"
55
+
56
+ #Indexes
57
+ drop_table :receipts
58
+ drop_table :conversations
59
+ drop_table :notifications
60
+ end
61
+ end
@@ -0,0 +1,17 @@
1
+ class AddNotifiedObject < ActiveRecord::Migration
2
+ def self.up
3
+ change_table :notifications do |t|
4
+ t.references :notified_object, :polymorphic => true
5
+ t.remove :object_id
6
+ t.remove :object_type
7
+ end
8
+ end
9
+
10
+ def self.down
11
+ change_table :notifications do |t|
12
+ t.remove :notified_object_id
13
+ t.remove :notified_object_type
14
+ t.references :object, :polymorphic => true
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ class AddNotificationCode < ActiveRecord::Migration
2
+ def self.up
3
+ change_table :notifications do |t|
4
+ t.string :notification_code, :default => nil
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ change_table :notifications do |t|
10
+ t.remove :notification_code
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class AddAttachments < ActiveRecord::Migration
2
+ def change
3
+ add_column :notifications, :attachment, :string
4
+ end
5
+ end
@@ -0,0 +1,25 @@
1
+ class DeviseCreateMessagingUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:messaging_users) do |t|
4
+ t.database_authenticatable :null => false
5
+ t.recoverable
6
+ t.rememberable
7
+ t.trackable
8
+
9
+ # t.encryptable
10
+ # t.confirmable
11
+ # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
12
+ # t.token_authenticatable
13
+
14
+
15
+ t.timestamps
16
+ end
17
+
18
+ add_index :messaging_users, :email, :unique => true
19
+ add_index :messaging_users, :reset_password_token, :unique => true
20
+ # add_index :messaging_users, :confirmation_token, :unique => true
21
+ # add_index :messaging_users, :unlock_token, :unique => true
22
+ # add_index :messaging_users, :authentication_token, :unique => true
23
+ end
24
+
25
+ end
@@ -0,0 +1,99 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20111213052240) do
15
+
16
+ create_table "conversations", :force => true do |t|
17
+ t.string "subject", :default => ""
18
+ t.datetime "created_at", :null => false
19
+ t.datetime "updated_at", :null => false
20
+ end
21
+
22
+ create_table "messaging_message_drafts", :force => true do |t|
23
+ t.integer "user_id"
24
+ t.string "recipients"
25
+ t.string "subject"
26
+ t.string "body"
27
+ t.datetime "created_at"
28
+ t.datetime "updated_at"
29
+ end
30
+
31
+ create_table "messaging_users", :force => true do |t|
32
+ t.string "email", :default => "", :null => false
33
+ t.string "encrypted_password", :limit => 128, :default => "", :null => false
34
+ t.string "reset_password_token"
35
+ t.datetime "reset_password_sent_at"
36
+ t.datetime "remember_created_at"
37
+ t.integer "sign_in_count", :default => 0
38
+ t.datetime "current_sign_in_at"
39
+ t.datetime "last_sign_in_at"
40
+ t.string "current_sign_in_ip"
41
+ t.string "last_sign_in_ip"
42
+ t.datetime "created_at"
43
+ t.datetime "updated_at"
44
+ end
45
+
46
+ add_index "messaging_users", ["email"], :name => "index_messaging_users_on_email", :unique => true
47
+ add_index "messaging_users", ["reset_password_token"], :name => "index_messaging_users_on_reset_password_token", :unique => true
48
+
49
+ create_table "notifications", :force => true do |t|
50
+ t.string "type"
51
+ t.text "body"
52
+ t.string "subject", :default => ""
53
+ t.integer "sender_id"
54
+ t.string "sender_type"
55
+ t.integer "conversation_id"
56
+ t.boolean "draft", :default => false
57
+ t.datetime "updated_at", :null => false
58
+ t.datetime "created_at", :null => false
59
+ t.integer "notified_object_id"
60
+ t.string "notified_object_type"
61
+ t.string "notification_code"
62
+ t.string "attachment"
63
+ end
64
+
65
+ add_index "notifications", ["conversation_id"], :name => "index_notifications_on_conversation_id"
66
+
67
+ create_table "receipts", :force => true do |t|
68
+ t.integer "receiver_id"
69
+ t.string "receiver_type"
70
+ t.integer "notification_id", :null => false
71
+ t.boolean "read", :default => false
72
+ t.boolean "trashed", :default => false
73
+ t.boolean "deleted", :default => false
74
+ t.string "mailbox_type", :limit => 25
75
+ t.datetime "created_at", :null => false
76
+ t.datetime "updated_at", :null => false
77
+ end
78
+
79
+ add_index "receipts", ["notification_id"], :name => "index_receipts_on_notification_id"
80
+
81
+ create_table "users", :force => true do |t|
82
+ t.string "email", :default => "", :null => false
83
+ t.string "encrypted_password", :limit => 128, :default => "", :null => false
84
+ t.string "reset_password_token"
85
+ t.datetime "reset_password_sent_at"
86
+ t.datetime "remember_created_at"
87
+ t.integer "sign_in_count", :default => 0
88
+ t.datetime "current_sign_in_at"
89
+ t.datetime "last_sign_in_at"
90
+ t.string "current_sign_in_ip"
91
+ t.string "last_sign_in_ip"
92
+ t.datetime "created_at"
93
+ t.datetime "updated_at"
94
+ end
95
+
96
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
97
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
98
+
99
+ end
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>