Module: Proclaim
- Defined in:
- app/models/proclaim/post.rb,
lib/proclaim.rb,
lib/proclaim/engine.rb,
lib/proclaim/version.rb,
app/models/proclaim/comment.rb,
app/models/proclaim/subscription.rb,
app/helpers/proclaim/posts_helper.rb,
app/jobs/proclaim/application_job.rb,
app/policies/proclaim/post_policy.rb,
app/policies/proclaim/comment_policy.rb,
app/models/proclaim/application_record.rb,
app/helpers/proclaim/application_helper.rb,
app/mailers/proclaim/application_mailer.rb,
lib/generators/proclaim/views_generator.rb,
app/mailers/proclaim/subscription_mailer.rb,
app/controllers/proclaim/posts_controller.rb,
app/policies/proclaim/subscription_policy.rb,
lib/generators/proclaim/install_generator.rb,
app/controllers/proclaim/comments_controller.rb,
app/controllers/proclaim/application_controller.rb,
app/controllers/proclaim/subscriptions_controller.rb
Overview
require_dependency “proclaim/application_controller”
Defined Under Namespace
Modules: ApplicationHelper, Generators, PostsHelper
Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Comment, CommentPolicy, CommentsController, Engine, Post, PostPolicy, PostsController, Subscription, SubscriptionMailer, SubscriptionPolicy, SubscriptionsController
Constant Summary
collapse
- VERSION =
'0.6.6'
- @@author_class =
"User"
- @@author_name_method =
:name
- @@current_author_method =
"current_#{@@author_class.underscore}".to_sym
- @@authentication_method =
"authenticate_#{@@author_class.underscore}!".to_sym
- @@excerpt_length =
500 characters (won’t interrupt words)
500
- @@editor_toolbar =
[
['bold', 'italic', 'underline', 'strike', 'code'],
[{ 'header': 1 }, { 'header': 2 }],
['blockquote', 'code-block'],
[{ 'align': []}],
[{ 'list': 'ordered'}, { 'list': 'bullet'}],
['link', 'image', 'video', 'formula']
]
- @@editor_formats =
[
'align', 'blockquote', 'bold', 'code', 'code-block', 'formula', 'header',
'image', 'indent', 'italic', 'link', 'list', 'strike', 'underline', 'video'
]
- @@mailer_sender =
nil
- @@secret_key =
nil
- @@post_published_callbacks =
Array.new
Array.new
- @@new_subscription_callbacks =
Array.new
Class Method Summary
collapse
Class Method Details
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/proclaim.rb', line 79
def self.(*callbacks, &block)
callbacks.each do |callback|
if callback.respond_to? :call
@@new_comment_callbacks.unshift(callback)
else
raise "Proclaim does not support callbacks that aren't blocks or "\
"Procs"
end
end
if block_given?
@@new_comment_callbacks.unshift(block)
end
end
|
.after_new_subscription(*callbacks, &block) ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/proclaim.rb', line 98
def self.after_new_subscription(*callbacks, &block)
callbacks.each do |callback|
if callback.respond_to? :call
@@new_subscription_callbacks.unshift(callback)
else
raise "Proclaim does not support callbacks that aren't blocks or "\
"Procs"
end
end
if block_given?
@@new_subscription_callbacks.unshift(block)
end
end
|
.after_post_published(*callbacks, &block) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/proclaim.rb', line 60
def self.after_post_published(*callbacks, &block)
callbacks.each do |callback|
if callback.respond_to? :call
@@post_published_callbacks.unshift(callback)
else
raise "Proclaim does not support callbacks that aren't blocks or "\
"Procs"
end
end
if block_given?
@@post_published_callbacks.unshift(block)
end
end
|
123
124
125
126
127
|
# File 'lib/proclaim.rb', line 123
def self.()
@@new_comment_callbacks.each do |callback|
callback.call()
end
end
|
.notify_new_subscription(subscription) ⇒ Object
129
130
131
132
133
|
# File 'lib/proclaim.rb', line 129
def self.notify_new_subscription(subscription)
@@new_subscription_callbacks.each do |callback|
callback.call(subscription)
end
end
|
.notify_post_published(post) ⇒ Object
117
118
119
120
121
|
# File 'lib/proclaim.rb', line 117
def self.notify_post_published(post)
@@post_published_callbacks.each do |callback|
callback.call(post)
end
end
|
94
95
96
|
# File 'lib/proclaim.rb', line 94
def self.
@@new_comment_callbacks = Array.new
end
|
.reset_new_subscription_callbacks ⇒ Object
113
114
115
|
# File 'lib/proclaim.rb', line 113
def self.reset_new_subscription_callbacks
@@new_subscription_callbacks = Array.new
end
|
.reset_post_published_callbacks ⇒ Object
75
76
77
|
# File 'lib/proclaim.rb', line 75
def self.reset_post_published_callbacks
@@post_published_callbacks = Array.new
end
|
.setup {|_self| ... } ⇒ Object
Default way to setup Proclaim from initializer
56
57
58
|
# File 'lib/proclaim.rb', line 56
def self.setup
yield self
end
|