global_alerts 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -5
- data/lib/global_alerts/engine.rb +2 -1
- data/lib/global_alerts/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2d276ba651ab199596da21e5cb21f6df96f799c095a06a7df9a54f155adc6c8
|
4
|
+
data.tar.gz: 3edc15a256ecac67413234f6b244b44a045206e6645aa1f7cd762a656072e4a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bee7b578178af6d0151486664d193d768879dd3153967e4d96feaf69a1bca77d127557f4087fba2fcf44747f332c10be3d6c21ba7e534ed8e42c3f71bb000352
|
7
|
+
data.tar.gz: d8a26ecee06b70f5679e07e7fca6395979649391ddb6a44b839a7436eef3cafb98d0d7e04804165d1852ddd9f1211d7be8b59cde2f9fea894dfe525446d0dbbb
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# GlobalAlerts
|
2
|
-
|
2
|
+
A gem for managing user-facing alerts across the portfolio.
|
3
|
+
⚠️[See current alerts](https://github.com/sul-dlss/global_alerts/blob/main/sul.yaml)
|
3
4
|
|
4
5
|
## Usage
|
5
6
|
|
6
7
|
### Consuming
|
7
8
|
|
8
9
|
- Add the gem
|
9
|
-
- Set
|
10
|
+
- Set GLOBAL_ALERTS to `<%= true %>` in the application settings.
|
11
|
+
- Set any engine configuration in the consuming application's initializers:
|
10
12
|
- GlobalAlerts::Engine.config.cache (Cache for the alerts feed; defaults to the Rails cache)
|
11
13
|
- GlobalAlerts::Engine.config.application_name (Used for app-specific alerts, default is derived from the application name)
|
12
14
|
- GlobalAlerts::Engine.config.url (URL to pull alerts from)
|
@@ -24,6 +26,44 @@ Consuming applications will pick only the first relevant alert.
|
|
24
26
|
|
25
27
|
Restart any consuming applications.
|
26
28
|
|
29
|
+
### Example Alerts
|
30
|
+
|
31
|
+
#### Basic alert
|
32
|
+
```
|
33
|
+
alerts:
|
34
|
+
- html: A single <em>sample alert</em> across all apps. This will appear until manually removed from the YML file.
|
35
|
+
```
|
36
|
+
|
37
|
+
#### `to`
|
38
|
+
```
|
39
|
+
alerts:
|
40
|
+
- to: '2020-12-07T12:00:00-07:00'
|
41
|
+
html: This message will appear immediately and will expire on December 7th at noon.
|
42
|
+
```
|
43
|
+
|
44
|
+
#### `from`
|
45
|
+
```
|
46
|
+
alerts:
|
47
|
+
- from: '2020-12-07T12:00:00-07:00'
|
48
|
+
html: This message will begin on December 7th at noon and must be manually removed.
|
49
|
+
```
|
50
|
+
#### `from` and `to`
|
51
|
+
```
|
52
|
+
alerts:
|
53
|
+
- from: '2020-12-24T12:00:00-07:00'
|
54
|
+
to: '2020-12-25T12:00:00-07:00'
|
55
|
+
html: This message will appear from December 24th at noon and expire on December 25th at noon. This YML should be removed later.
|
56
|
+
```
|
57
|
+
|
58
|
+
#### `application_name`
|
59
|
+
```
|
60
|
+
alerts:
|
61
|
+
- application_name: 'MyLibrary
|
62
|
+
html: This message will appear on MyLibrary until manually removed.
|
63
|
+
- html: This alert will appear on all other applications with GLOBAL_ALERTS enabled
|
64
|
+
```
|
65
|
+
|
66
|
+
|
27
67
|
## Installation
|
28
68
|
Add this line to your application's Gemfile:
|
29
69
|
|
@@ -40,6 +80,3 @@ Or install it yourself as:
|
|
40
80
|
```bash
|
41
81
|
$ gem install global_alerts
|
42
82
|
```
|
43
|
-
|
44
|
-
## Contributing
|
45
|
-
Contribution directions go here.
|
data/lib/global_alerts/engine.rb
CHANGED
@@ -7,7 +7,8 @@ module GlobalAlerts
|
|
7
7
|
config.url = 'https://github.com/sul-dlss/global-alerts/raw/main/sul.yaml'
|
8
8
|
|
9
9
|
initializer('global_alerts_default') do |app|
|
10
|
-
|
10
|
+
# parent_name is deprecated in Rails 6.1
|
11
|
+
config.application_name ||= app.class.respond_to?(:parent_name) ? app.class.parent_name.underscore : app.class.module_parent_name.underscore
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: global_alerts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|