eventifier 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/.travis.yml +7 -8
- data/Gemfile +1 -1
- data/README.textile +44 -3
- data/app/assets/images/eventifier/notifications-bell.png +0 -0
- data/app/assets/images/eventifier/notifications-tower.png +0 -0
- data/app/assets/javascripts/eventifier/notifications.coffee +196 -0
- data/app/assets/javascripts/eventifier/templates/dropdown.hamlc +10 -0
- data/app/assets/javascripts/eventifier/templates/settings.hamlc +11 -0
- data/app/assets/stylesheets/eventifier/notifications.scss +167 -0
- data/app/controllers/eventifier/application_controller.rb +4 -0
- data/app/controllers/eventifier/notifications_controller.rb +36 -0
- data/app/controllers/eventifier/preferences_controller.rb +19 -0
- data/app/helpers/eventifier/notification_helper.rb +87 -0
- data/app/helpers/eventifier/path_helper.rb +15 -0
- data/app/mailers/eventifier/mailer.rb +12 -0
- data/app/models/event_tracking.rb +3 -0
- data/app/models/eventifier/event.rb +22 -0
- data/app/models/eventifier/ghost.rb +21 -0
- data/app/models/eventifier/notification.rb +38 -0
- data/app/models/eventifier/notification_setting.rb +14 -0
- data/app/views/eventifier/_notification.haml +1 -0
- data/app/views/eventifier/email/_notification.haml +2 -0
- data/app/views/eventifier/mailer/notifications.haml +5 -0
- data/app/views/eventifier/notifications/index.jbuilder +6 -0
- data/config/routes.rb +7 -0
- data/config.ru +7 -0
- data/{lib/generators/eventifier/install/templates/migration.rb → db/migrate/1_eventifier_setup.rb} +2 -3
- data/db/migrate/2_eventifier_notification_settings.rb +11 -0
- data/db/migrate/3_notification_sent_status.rb +15 -0
- data/db/migrate/4_event_groupable.rb +19 -0
- data/eventifier.gemspec +12 -15
- data/lib/eventifier/delivery.rb +59 -0
- data/lib/eventifier/{railtie.rb → engine.rb} +4 -2
- data/lib/eventifier/event_subscriber.rb +44 -0
- data/lib/eventifier/event_tracking.rb +5 -58
- data/lib/eventifier/mailers/helpers.rb +70 -0
- data/lib/eventifier/notifier/notification_mapping.rb +34 -0
- data/lib/eventifier/notifier/notification_subscriber.rb +23 -0
- data/lib/eventifier/notifier/notifier.rb +21 -0
- data/lib/eventifier/preferences.rb +44 -0
- data/lib/eventifier/relationship.rb +36 -0
- data/lib/eventifier/trackable_class.rb +74 -0
- data/lib/eventifier/tracker.rb +18 -0
- data/lib/eventifier.rb +35 -11
- data/lib/generators/eventifier/install/install_generator.rb +2 -5
- data/lib/generators/eventifier/install/templates/events.en.yaml +1 -0
- data/lib/tasks/email.rake +8 -0
- data/spec/controllers/eventifier/notifications_controller_spec.rb +24 -0
- data/spec/controllers/eventifier/preferences_controller_spec.rb +56 -0
- data/spec/eventifier/delivery_spec.rb +110 -0
- data/spec/eventifier/preferences_spec.rb +69 -0
- data/spec/eventifier/relationship_spec.rb +33 -0
- data/spec/eventifier_spec.rb +6 -48
- data/spec/fabricators/fabricator.rb +11 -11
- data/spec/helpers/eventifier/notification_helper_spec.rb +169 -0
- data/spec/helpers/eventifier/path_helper_spec.rb +19 -0
- data/spec/integration/eventifier_spec.rb +113 -70
- data/spec/integration/internationalisation_spec.rb +39 -0
- data/spec/internal/app/controllers/application_controller.rb +3 -0
- data/spec/internal/app/lib/event_tracking.rb +12 -0
- data/spec/internal/app/models/category.rb +3 -0
- data/spec/internal/app/models/post.rb +8 -0
- data/spec/internal/app/models/subscription.rb +4 -0
- data/spec/internal/app/models/user.rb +4 -0
- data/spec/internal/app/views/eventifier/dropdown/_awesome_object.haml +0 -0
- data/spec/internal/config/database.yml +4 -0
- data/spec/internal/config/initializers/eventifier.rb +1 -0
- data/spec/internal/config/locales/events.en.yml +20 -0
- data/spec/internal/config/routes.rb +5 -0
- data/spec/internal/db/schema.rb +31 -0
- data/spec/internal/log/.gitignore +1 -0
- data/spec/internal/public/favicon.ico +0 -0
- data/spec/models/eventifier/event_spec.rb +23 -0
- data/spec/{ghost_spec.rb → models/eventifier/ghost_spec.rb} +3 -3
- data/spec/{notification_spec.rb → models/eventifier/notification_spec.rb} +1 -9
- data/spec/notification_mailer_spec.rb +8 -4
- data/spec/notifier/notification_mapping_spec.rb +28 -0
- data/spec/spec_helper.rb +14 -8
- data/spec/support/controller_helpers.rb +14 -0
- metadata +205 -128
- data/Gemfile.lock +0 -97
- data/lib/eventifier/active_record/event.rb +0 -10
- data/lib/eventifier/active_record/event_observer.rb +0 -8
- data/lib/eventifier/active_record/event_tracking.rb +0 -11
- data/lib/eventifier/active_record/ghost.rb +0 -9
- data/lib/eventifier/active_record/notification.rb +0 -13
- data/lib/eventifier/active_record_support.rb +0 -5
- data/lib/eventifier/event_helper.rb +0 -40
- data/lib/eventifier/event_mixin.rb +0 -45
- data/lib/eventifier/event_observer_mixin.rb +0 -44
- data/lib/eventifier/ghost_mixin.rb +0 -27
- data/lib/eventifier/helper_methods.rb +0 -36
- data/lib/eventifier/mongoid/event.rb +0 -16
- data/lib/eventifier/mongoid/event_observer.rb +0 -7
- data/lib/eventifier/mongoid/event_tracking.rb +0 -13
- data/lib/eventifier/mongoid/ghost.rb +0 -15
- data/lib/eventifier/mongoid/notification.rb +0 -19
- data/lib/eventifier/mongoid/user_patch.rb +0 -3
- data/lib/eventifier/mongoid_support.rb +0 -6
- data/lib/eventifier/notification_helper.rb +0 -42
- data/lib/eventifier/notification_mailer.rb +0 -18
- data/lib/eventifier/notification_mixin.rb +0 -50
- data/lib/eventifier/version.rb +0 -3
- data/spec/event_helper_spec.rb +0 -67
- data/spec/event_observer_spec.rb +0 -20
- data/spec/event_spec.rb +0 -39
- data/spec/helper_methods_spec.rb +0 -36
- data/spec/notification_helper_spec.rb +0 -65
- data/spec/support/action_mailer.rb +0 -3
- data/spec/support/database_cleaner.rb +0 -3
- data/spec/test_classes/active_record_support.rb +0 -72
- data/spec/test_classes/mongoid_support.rb +0 -34
@@ -1,72 +0,0 @@
|
|
1
|
-
require 'active_record'
|
2
|
-
|
3
|
-
ActiveRecord::Base.establish_connection(
|
4
|
-
:adapter => "postgresql",
|
5
|
-
:database => "eventifier"
|
6
|
-
)
|
7
|
-
|
8
|
-
ActiveRecord::Schema.define(:version => 0) do
|
9
|
-
|
10
|
-
create_table :events, :force => true do |t|
|
11
|
-
t.integer :user_id
|
12
|
-
t.string :eventable_type
|
13
|
-
t.integer :eventable_id
|
14
|
-
t.string :verb
|
15
|
-
t.text :change_data
|
16
|
-
|
17
|
-
t.timestamps
|
18
|
-
end
|
19
|
-
|
20
|
-
create_table :ghosts, :force => true do |t|
|
21
|
-
t.string :ghost_class
|
22
|
-
t.integer :ghost_id
|
23
|
-
t.text :data_hash
|
24
|
-
|
25
|
-
t.timestamps
|
26
|
-
end
|
27
|
-
|
28
|
-
create_table :notifications, :force => true do |t|
|
29
|
-
t.integer :event_id
|
30
|
-
t.integer :user_id
|
31
|
-
t.integer :parent_id
|
32
|
-
t.string :url
|
33
|
-
|
34
|
-
t.timestamps
|
35
|
-
end
|
36
|
-
|
37
|
-
create_table :users, :force => true do |t|
|
38
|
-
t.column :name, :string
|
39
|
-
t.column :email, :string
|
40
|
-
t.column :notifications_last_read_at, :datetime
|
41
|
-
end
|
42
|
-
|
43
|
-
create_table :posts, :force => true do |t|
|
44
|
-
t.column :title, :string
|
45
|
-
t.column :author_id, :integer
|
46
|
-
t.column :body, :text
|
47
|
-
end
|
48
|
-
|
49
|
-
create_table :subscriptions, :force => true do |t|
|
50
|
-
t.column :user_id, :integer
|
51
|
-
t.column :post_id, :integer
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
class User < ActiveRecord::Base
|
57
|
-
has_many :subscriptions
|
58
|
-
validates :name, :presence => true, :uniqueness => true
|
59
|
-
end
|
60
|
-
|
61
|
-
class Subscription < ActiveRecord::Base
|
62
|
-
belongs_to :user
|
63
|
-
belongs_to :post
|
64
|
-
end
|
65
|
-
|
66
|
-
class Post < ActiveRecord::Base
|
67
|
-
belongs_to :author, :class_name => "User"
|
68
|
-
has_many :subscriptions
|
69
|
-
has_many :readers, :through => :subscriptions, :source => :user
|
70
|
-
|
71
|
-
alias_method :user, :author
|
72
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
require 'mongoid'
|
2
|
-
|
3
|
-
Mongoid.configure do |config|
|
4
|
-
config.master = Mongo::Connection.new("localhost", 27017).db('eventifier')
|
5
|
-
end
|
6
|
-
|
7
|
-
class User
|
8
|
-
include Mongoid::Document
|
9
|
-
|
10
|
-
field :name, :type => String
|
11
|
-
|
12
|
-
has_many :subscriptions
|
13
|
-
validates :name, :presence => true, :uniqueness => true
|
14
|
-
end
|
15
|
-
|
16
|
-
class Subscription
|
17
|
-
include Mongoid::Document
|
18
|
-
|
19
|
-
belongs_to :user
|
20
|
-
belongs_to :post
|
21
|
-
end
|
22
|
-
|
23
|
-
class Post
|
24
|
-
include Mongoid::Document
|
25
|
-
|
26
|
-
belongs_to :author, :class_name => "User"
|
27
|
-
has_many :subscriptions
|
28
|
-
|
29
|
-
def readers
|
30
|
-
subscriptions.map &:user
|
31
|
-
end
|
32
|
-
|
33
|
-
alias_method :user, :author
|
34
|
-
end
|