concerto_emergency 0.8 → 0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae5b167fe1838320f01a54deb219434671fd73a5
4
- data.tar.gz: 05ca46587948ef1b4d354706a75998d057aada44
3
+ metadata.gz: bbe8cb5f8f6eb97b1449435c8ae086f10a47e9fe
4
+ data.tar.gz: bd60f314f7a1da48eaed20333fc56744b71038ec
5
5
  SHA512:
6
- metadata.gz: e77365dc568c0e369e8e18f9d97f78180bc5a6cdc2f2897b73e1b3b19b9ba372b2442b1e6f5711d1db8b43d2d6e653bc14cce7d9a7c94e6ffacb610fb1a52748
7
- data.tar.gz: c72bb0080e297eca9b7e99b41dd58000b3934b9bcb31fb90a6b415180e345effee7cf2585ab7fa61d544357993cfe40d7e95dce0fdbb7004ef287bdd28d35a9c
6
+ metadata.gz: 1823eef4014e539816c927c730341a8c7d9dd05e4f97dec0332dada6cf041af5434d329466cfbb5897e808c507511b75cd935172e7ef413b7b22dc53810826d4
7
+ data.tar.gz: 66996517877481d64bd810f38ea9c27ddcec2d9154b53f46dd8d22d10a0eb1bf7d6ad6969561910b505a0e30244e8923a4676e477513305f51a8becbd7c1dfd9
data/README.md CHANGED
@@ -1,12 +1,10 @@
1
1
  Concerto Emergency
2
2
  ==================
3
3
 
4
- This plugin provides [Concerto Digital Signage](https://github.com/concerto/concerto) with emergency alert capabilities. When an emergency alert is submitted manually or an emergency alert is detected on an RSS feed, the plugin will change the effective template and display the alert.
4
+ This plugin provides [Concerto Digital Signage](https://github.com/concerto/concerto) with emergency alert capabilities. When content is submitted manually (or via an RSS feed) to a designated emergency alert feed, the plugin will change the effective template and display the emergency alert feed content.
5
5
 
6
6
  Instructions
7
7
  ------------
8
- 1. Clone the repository, navigate to the plugins page and add a new plugin using the filesystem path to concerto-emergency.
8
+ Clone the repository, navigate to the plugins page and add a new plugin using the filesystem path to concerto-emergency and then run ```bundle install```. Or choose to add a new plugin within the concerto ui, choose Rubygems as the source and enter _concerto_emergency_ as the plugin name.
9
9
 
10
- 2. Run ```bundle install```
11
-
12
- 3. Plugin settings can be found under Admin > Settings > Emergency Alerts. The emergency template will replace the current template when emergency alerts are detected in the emergency feed.
10
+ Plugin settings can be found under Admin > Settings > Emergency Alerts. The emergency template will replace the current template when any content is detected on the designated feed. This plugin automatically creates a new feed called "Emergency Alerts" the first time it is loaded.
@@ -8,13 +8,33 @@ module ConcertoEmergency
8
8
  def plugin_info(plugin_info_class)
9
9
  @plugin_info ||= plugin_info_class.new do
10
10
 
11
+ # if we have not yet set up the configuration for this plugin...
12
+ unless ConcertoConfig.find_by(key: 'emergency_feed').present?
13
+ # set default emergency feed to "Emergency Alerts" so we need to make sure it exists here
14
+ unless Feed.find_by(name: "Emergency Alerts").present?
15
+
16
+ # set up the content types allowed on the new emergency feed to be all inclusive initially
17
+ content_types = {}
18
+ Feed.all.each {|f| content_types.merge! f.content_types }
19
+
20
+ Feed.create({
21
+ name: "Emergency Alerts",
22
+ description: "Content on this feed is immediately displayed on all screens",
23
+ is_viewable: true,
24
+ is_submittable: true,
25
+ content_types: content_types,
26
+ group: Group.first
27
+ })
28
+ end
29
+ end
30
+
11
31
  # Add configuration options under Concerto Admin Settings
12
32
  add_config("emergency_template", "Default Template",
13
33
  :value_type => "string",
14
34
  :category => "Emergency Alerts",
15
35
  :description => "Template used to display emergency alerts")
16
36
 
17
- add_config("emergency_feed", "Concerto",
37
+ add_config("emergency_feed", "Emergency Alerts",
18
38
  :value_type => "string",
19
39
  :category => "Emergency Alerts",
20
40
  :description => "Feed monitored for emergency alert content")
@@ -27,14 +47,15 @@ module ConcertoEmergency
27
47
  add_controller_hook "Screen", :frontend_display, :before do
28
48
 
29
49
  emergency_feed = Feed.find_by_name(ConcertoConfig[:emergency_feed])
30
- emergency_active = emergency_feed.submissions.approved.active.includes(:content).where("kind_id != 4").present?
31
-
32
50
  # Check for emergency content
33
- if not emergency_feed.nil? and emergency_active
34
- # swap template to emergency template if emergency content is present
35
- emergency_template = Template.find_by_name(ConcertoConfig[:emergency_template])
36
- if not emergency_template.nil?
37
- self.template = emergency_template
51
+ if not emergency_feed.nil?
52
+ emergency_active = emergency_feed.submissions.approved.active.includes(:content).where("kind_id != 4").present?
53
+ if emergency_active
54
+ # swap template to emergency template if emergency content is present
55
+ emergency_template = Template.find_by_name(ConcertoConfig[:emergency_template])
56
+ if not emergency_template.nil?
57
+ self.template = emergency_template
58
+ end
38
59
  end
39
60
  end
40
61
 
@@ -44,17 +65,14 @@ module ConcertoEmergency
44
65
  add_controller_hook "Frontend::ContentsController", :index, :after do
45
66
 
46
67
  emergency_feed = Feed.find_by_name(ConcertoConfig[:emergency_feed])
47
- emergency_active = emergency_feed.submissions.approved.active.includes(:content).where("kind_id != 4").present?
48
-
49
68
  if not emergency_feed.nil?
69
+ emergency_active = emergency_feed.submissions.approved.active.includes(:content).where("kind_id != 4").present?
50
70
  emergency_submissions = emergency_feed.submissions.approved.active.includes(:content).where("kind_id = ?", @field.kind_id)
51
71
  emergency_contents = Array.new()
52
72
  emergency_submissions.each { |submission| emergency_contents << Content.find(submission.content_id) }
53
73
 
54
74
  if emergency_active
55
-
56
- # Change template identifier so the screen knows a template
57
- # is used for emergency alerts
75
+ # swap template to emergency template if emergency content is present
58
76
  emergency_template = Template.find_by_name(ConcertoConfig[:emergency_template])
59
77
  if not emergency_template.nil?
60
78
  @screen.template = emergency_template
@@ -1,3 +1,3 @@
1
1
  module ConcertoEmergency
2
- VERSION = "0.8"
2
+ VERSION = "0.9"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: concerto_emergency
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.8'
4
+ version: '0.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Concerto Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-15 00:00:00.000000000 Z
11
+ date: 2015-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails