Module: Signum
- Defined in:
- app/components/signum/notification/component.rb,
lib/signum.rb,
lib/signum/engine.rb,
lib/signum/version.rb,
app/models/signum/signal.rb,
lib/signum/configuration.rb,
app/jobs/signum/application_job.rb,
lib/signum/active_record_helpers.rb,
app/models/signum/application_record.rb,
app/helpers/signum/application_helper.rb,
app/mailers/signum/application_mailer.rb,
lib/generators/signum/install_generator.rb,
app/controllers/signum/signal_controller.rb,
app/components/signum/notifications/component.rb,
app/controllers/signum/application_controller.rb,
lib/generators/signum/tailwind_config_generator.rb,
app/components/signum/notification_body/component.rb,
app/components/signum/notification_drawer/component.rb,
app/components/signum/notification_drawer_item/component.rb
Overview
Defined Under Namespace
Modules: ActiveRecordHelpers, ApplicationHelper, Configurable, Generators, Notification, NotificationBody, NotificationDrawer, NotificationDrawerItem, Notifications, Options Classes: ApplicationController, ApplicationJob, ApplicationMailer, ApplicationRecord, Configuration, Engine, Error, InstallGenerator, Signal, SignalController
Constant Summary collapse
- VERSION =
"0.7.8"
Class Method Summary collapse
- .config ⇒ Object
-
.error(signalable, options) ⇒ Object
Signal about an error.
-
.info(signalable, options) ⇒ Object
Signal about something that happened.
- .setup {|config| ... } ⇒ Object
-
.signal(signalable_receiver, options) ⇒ Object
Generic notice.
-
.success(signalable, options) ⇒ Object
Signal about something that went sucessfully.
-
.warning(signalable, options) ⇒ Object
Signal about something that could go wrong.
Class Method Details
.config ⇒ Object
10 11 12 |
# File 'lib/signum.rb', line 10 def config @config ||= Configuration.new end |
.error(signalable, options) ⇒ Object
Signal about an error
46 47 48 49 50 |
# File 'lib/signum.rb', line 46 def error(signalable, ) return unless signalable signal(signalable, .merge(kind: "error", icon: Signum.config.icons[:error])) end |
.info(signalable, options) ⇒ Object
Signal about something that happened
39 40 41 42 43 |
# File 'lib/signum.rb', line 39 def info(signalable, ) return unless signalable signal(signalable, .merge(kind: "info", icon: Signum.config.icons[:info])) end |
.setup {|config| ... } ⇒ Object
14 15 16 17 |
# File 'lib/signum.rb', line 14 def setup @config = Configuration.new yield config end |
.signal(signalable_receiver, options) ⇒ Object
Generic notice
24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/signum.rb', line 24 def signal(signalable_receiver, ) return unless signalable_receiver if signalable_receiver.is_a?(Signum.config.user_model_name.constantize) signalable_receiver.signals.create!() elsif signalable_receiver.respond_to?(:each) signalable_receiver.each { |signalable| signal(signalable, ) } nil else Signal.create!(.merge(key: signalable_receiver.to_s)) end end |